ajv #1131

node v10.24.1
version: master
endpointsharetweet
var Ajv = require('ajv'); var ajv = new Ajv({allErrors: true, format: 'full'}); var schema = { "$ref": "#/definitions/MyObject", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "Base<boolean>": { "additionalProperties": false, "properties": { "a": { "type": "boolean" } }, "required": [ "a" ], "type": "object" }, "Base<string>": { "additionalProperties": false, "properties": { "a": { "type": "string" } }, "required": [ "a" ], "type": "object" }, "MyObject": { "additionalProperties": false, "properties": { "a": { "type": "number" }, "b": { "type": "string" }, "c": { "$ref": "#/definitions/Base<string>" }, "d": { "$ref": "#/definitions/Base<boolean>" } }, "required": [ "a", "b", "c", "d" ], "type": "object" } } } ; var valid = ajv.validateSchema(schema); console.log(valid, ajv.errors);
Created from: https://npm.runkit.com/ajv
Loading…

no comments

    sign in to comment