How to use the json-schema.mustBeValid function in json-schema

To help you get started, we’ve selected a few json-schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / json-schema / json-schema-tests.ts View on Github external
writeOnly: false,
        contentEncoding: 'base64',
        contentMediaType: 'text',
        else: {},
        if: {},
        then: {}
    }
    const c: JSONSchema7Definition = false;
}

// Class
class Schema7 implements JSONSchema7 {
}

let result = validate({}, { $id: 'schema-id' });
mustBeValid(result);

result = checkPropertyChange({ foo: 'bar' }, { $id: 'schema-id' }, 'foo');
github persvr / pintura / lib / facet.js View on Github external
if(facetPrototype.save){
								facetPrototype.save.call(this, source);
							}
							var validation = validate(this, facetSchema);
							var instance = this;
							for(var i in this){
								if(this.hasOwnProperty(i)){
									transfer(this[i]);
								}
							}
							for (var i in source){
								if(source.hasOwnProperty(i) && !this.hasOwnProperty(i)){
									transfer(undefined);
								}
							}
							mustBeValid(validation);
							if(transaction){
								var newIndex = transaction.newInstances && transaction.newInstances.indexOf(instance);
							} 
							try{
								var method = newIndex > -1 ? "create" : "put"; 
								if(typeof facetSchema[method] === "function"){
									var id = facetSchema[method](source, id);
								}
								else if(typeof facetSchema.put === "function"){
									var id = facetSchema.put(source, id);
								}
								else{
									if(facetSchema.__noSuchMethod__){
										var id = facetSchema.__noSuchMethod__(method, [source, id]);
									}
									else{