Skip to content

w3plan/sdjs-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SDJS(Self Description JSON Schema) for web browsers

SDJS is a tool that validates JSON members matched with the descriptions of data presence, type, and constraint.

SDJS includes a group of rules and notations which describe data presence, data type and data constraints to a JSON data, the rules and notations don't change any key-value pairs in JSON, they are some extra members to JSON.

SDJS-Web is a version of SDJS specified for web browsers. To access SDJS-Web repository for the details.

The URL of SDJS-Web CDN is https://cdn.jsdelivr.net/gh/w3plan/sdjs-web/

Documentation

To see Self Description JSON Schema

Installation

Downloads sdjs-web from sdjs-web repository to the directory of web server, or includes sdjs.js via CDN with https://cdn.jsdelivr.net/gh/w3plan/sdjs-web@master/sdjs.js in web pages.

Usage

Adding <script src="https://cdn.jsdelivr.net/gh/w3plan/sdjs-web@master/sdjs.js"></script> or <script src="/directory-to-sdjs/sdjs.js"></script> to web pages then doing data validation:

  // supposing that sdjsObj is a JSON object with Self Description JSON Schema
  if ( sdjs.valiSdjs(sdjsObj) ) {
    console.log("validation succeeded.");
  } else {
    console.log("validation failed.");
  }  

Tests

Accessing /test/index.html from web server.

License

MIT

Keywords

presence, type, constraint, schema, sdjs, sdjs-web, json

About

SDJS is a tool that validates JSON members matched with the descriptions of data presence, type, and constraint.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published