@nativeschema/native-schema
v1.0.6
Published
NativeSchema is a schema structure to define objects in every language
Downloads
10
Readme
NativeSchema for JavaScript
About
Native Schema has been created to create easily and migrate config between various platforms, programming languages etc.
Structure
NativeSchema supports for now two kinds of structures:
Value Spec
{
"$version": 1,
"$type": "ValueSpec",
"type": "string",
"optional": false,
"default": "undefined",
"validation": []
}
Schema Spec
{
"$version": 1,
"$type": "NativeSchema",
"version": "1.0.0",
"spec": {
"key": {
"$type": "ValueSpec",
"type": "string",
"optional": true,
"default": "undefined"
},
"compoundNestedObj": []
}
}
Basic Checks
Available functions:
isNativeValueSpec
- check if foreign object is value spec,isNativeSchemaSpec
- check if foreign object is schema spec,validateNativeValueSpec
- validate foreign object against value spec. It returns last error by default,validateNativeSchemaSpec
- validate foreign object against schema spec. It returns last error by default,