All Projects → mauriciolauffer → openui5-validator

mauriciolauffer / openui5-validator

Licence: MIT license
A library to validate OpenUI5 fields

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to openui5-validator

openui5-tour
OpenUI5 Tour enables an user-friendly way to showcase products and features in your website.
Stars: ✭ 21 (+23.53%)
Mutual labels:  sap, openui5, sapui5, ui5, openui5-framework
ui5-schemas
🚀 UI5 Schemas allows you to develop SAPUI5/OpenUI5 XML at a maximum convenience. It downloads, upgrades and sets up SAPUI5/OpenUI5 XML schemas for a better development experience in your favorite IDE (if it is WebStorm ;).
Stars: ✭ 50 (+194.12%)
Mutual labels:  sap, openui5, sapui5, ui5
ui5-cap-event-app
Showcase of SAP Cloud Application Programming Model and OData V4 with draft mode in a freestyle SAPUI5 app and an SAP Fiori elements app.
Stars: ✭ 70 (+311.76%)
Mutual labels:  openui5, sapui5, ui5
UI5-Best-Practice
living document on UI5 best practices
Stars: ✭ 52 (+205.88%)
Mutual labels:  openui5, sapui5, ui5
Ajv
The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)
Stars: ✭ 10,340 (+60723.53%)
Mutual labels:  json-schema, validator, ajv
Validr
A simple, fast, extensible python library for data validation.
Stars: ✭ 205 (+1105.88%)
Mutual labels:  validation, json-schema, validator
sapui5-cli
Simple CLI to scaffold SAPUI5 / OpenUI5 projects.
Stars: ✭ 17 (+0%)
Mutual labels:  sap, openui5, sapui5
wdi5
cross-platform test framework for UI5 web-apps. wdi5 = Webdriver.IO + UI5 Test API
Stars: ✭ 45 (+164.71%)
Mutual labels:  openui5, sapui5, ui5
tern-openui5
🛠 Autocomplete for the OpenUI5 framework for your favorite code editor, powered by Tern.
Stars: ✭ 26 (+52.94%)
Mutual labels:  sap, openui5, sapui5
Swagger Cli
Swagger 2.0 and OpenAPI 3.0 command-line tool
Stars: ✭ 321 (+1788.24%)
Mutual labels:  validation, json-schema, validator
ui5ts
This repo is no longer maintained. For a newer version supporting a more recent version of UI5, see neoprincie's fork:
Stars: ✭ 36 (+111.76%)
Mutual labels:  openui5, sapui5, ui5
Schemasafe
A reasonably safe JSON Schema validator with draft-04/06/07/2019-09 support.
Stars: ✭ 67 (+294.12%)
Mutual labels:  validation, json-schema, validator
Maat
Validation and transformation library powered by deductive ascending parser. Made to be extended for any kind of project.
Stars: ✭ 27 (+58.82%)
Mutual labels:  validation, json-schema, validator
Swagger Parser
Swagger 2.0 and OpenAPI 3.0 parser/validator
Stars: ✭ 710 (+4076.47%)
Mutual labels:  validation, json-schema, validator
ui5-service-worker-sample
ui5-service-worker-sample demonstrates how the Service Worker API, available in modern web browsers, could be used in a UI5 app to realize different caching strategies.
Stars: ✭ 16 (-5.88%)
Mutual labels:  openui5, sapui5, ui5
Json Schema Spec
The JSON Schema I-D sources
Stars: ✭ 2,441 (+14258.82%)
Mutual labels:  validation, json-schema
Validot
Validot is a performance-first, compact library for advanced model validation. Using a simple declarative fluent interface, it efficiently handles classes, structs, nested members, collections, nullables, plus any relation or combination of them. It also supports translations, custom logic extensions with tests, and DI containers.
Stars: ✭ 198 (+1064.71%)
Mutual labels:  validation, validator
Validation
The power of Respect Validation on Laravel
Stars: ✭ 188 (+1005.88%)
Mutual labels:  validation, validator
another-json-schema
Another JSON Schema validator, simple & flexible & intuitive.
Stars: ✭ 48 (+182.35%)
Mutual labels:  json-schema, validator
nwabap-ui5uploader
This module allows a developer to upload SAPUI5/OpenUI5 sources into a SAP NetWeaver ABAP system.
Stars: ✭ 15 (-11.76%)
Mutual labels:  sap, ui5

openui5-validator

npm test

An OpenUI5 library to validate fields.

This library uses Ajv, a JSON schema validator. All validation keywords available in Ajv can be used.

JSON Schema and Ajv

For any references, please follow

Ajv Options: https://github.com/epoberezkin/ajv#options

Ajv Keywords: https://github.com/epoberezkin/ajv#validation-keywords

Demo

You can check out a live demo here:

https://mauriciolauffer.github.io/openui5-validator/demo/webapp/index.html

Demo Screenshot

Project Structure

  • demo - Library's live demo
  • dist - Distribution folder which contains the library ready to use
  • src - Development folder
  • test - Testing framework for the library

Getting started

Installation

Install openui5-validator as an npm module

$ npm install openui5-validator

Configure manifest.json

Add the library to sap.ui5/dependencies/libs and set its path in sap.ui5/resourceRoots in your manifest.json file, as follows:

{
  "sap.ui5": {
    "dependencies": {
      "libs": {
        "openui5.validator": {}
      }
    },
    "resourceRoots": {
      "openui5.validator": "./FOLDER_WHERE_YOU_PLACED_THE_LIBRARY/openui5/validator/"
    }
  }
}

How to use

Import openui5-validator to your UI5 controller using sap.ui.require:

sap.ui.require([
  'openui5/validator/Validator'
], function (Validator) {
  const validationSchema = {
    properties: {
      email: { //UI5 control ID
        type: 'string',
        format: 'email',
        minLength: 3 //required
      },
      salary: { //UI5 control ID
        type: 'number',
        minimum: 0,
        maximum: 9999999
      },
      birthdate: { //UI5 control ID
        format: 'date'
      }
    }
  };

  const validator = new Validator(this.getView(), validationSchema);
  if (validator.validate()) {
    console.log('Valid!');
  } else {
    console.log('Invalid! Errors...');
    console.dir(validator.getErrors());
  }
});

Config Parameters

Name Type Default Description
view sap.ui.core.mvc.View null UI5 view which contains the fields to be validated.
schema object null JSON schema used for validation
opt object null Parameters to initialize Ajv

Author

Mauricio Lauffer

License

This project is licensed under the MIT License - see the LICENSE file for details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].