You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please add Schema.examples, and perhaps validateExamples(schema) to validate each example against the schema, similar to this code from my Jasmine tests.
type Schema = JsonSchema.Schema // & { examples : [] };
let Validator = require('jsonschema').Validator;
let validator = new Validator();
function validateExamples(schema : Schema) {
(schema as any).examples.map((e : any) => {
const result = validator.validate(e, schema);
expect(result.errors).toEqual([]);
if (result.errors.length) { console.log('validate()', e, result); }
});
}
The text was updated successfully, but these errors were encountered:
JSON Schema draft 6 adds an
examples
array "to provide an array of examples that validate against the schema":https://json-schema.org/understanding-json-schema/reference/generic.html#annotations
Please add
Schema.examples
, and perhapsvalidateExamples(schema)
to validate each example against the schema, similar to this code from my Jasmine tests.The text was updated successfully, but these errors were encountered: