Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
readOnly: false,
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');
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');
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');
function validateJsonObjectJS(schema, input)
{
var report = mod_jsonschema.validate(input, schema);
if (report.errors.length === 0)
return (null);
/* Currently, we only do anything useful with the first error. */
var error = report.errors[0];
/* The failed property is given by a URI with an irrelevant prefix. */
var propname = error['property'];
var reason = error['message'].toLowerCase();
var i, j;
/*
* There's at least one case where the property error message is
* confusing at best. We work around this here.
*/
function validateJsonObjectJS(schema, input)
{
var report = mod_jsonschema.validate(input, schema);
if (report.errors.length === 0)
return (null);
/* Currently, we only do anything useful with the first error. */
var error = report.errors[0];
/* The failed property is given by a URI with an irrelevant prefix. */
var propname = error['property'];
var reason = error['message'].toLowerCase();
var i, j;
/*
* There's at least one case where the property error message is
* confusing at best. We work around this here.
*/
value: function(directives){
var i, id;
directives = directives || {};
if(this != source){
directives.previous = copy(source, {});
}
if(facetPrototype.save){
facetPrototype.save.call(this, directives);
}
var validation = validate(this, facetSchema);
var instance = this;
for(i in this){
if(this.hasOwnProperty(i)){
transfer(this[i]);
}
}
for (i in source){
if(source.hasOwnProperty(i) && !this.hasOwnProperty(i)){
transfer(undefined);
}
}
mustBeValid(validation);
var isNew = partial === NEW;
if(isNew && (typeof facetSchema.add === "function")){ // || )
partial = undefined;
id = facetSchema.add(source, directives);
/**
* This store wrapper provides a means for creating a set of stores (from a single store)
* that can inherit from each other with a superset/subset relation. One can use
* schemas to indicate the hierarchy (with the "extends" property), and a property
* is added to the instances to indicate what schema/model each instance belongs to.
* See tests/inherited.js for an example.
*/
var getLink = require("json-schema/lib/validate").getLink,
promise = require("promised-io/promise"),
subSchemas = {};
exports.Inherited = function(store, schemaProperty){
// TODO: determine the schemaProperty from the schema's "schema" relation
schemaProperty = schemaProperty || "__schema__";
var hierarchy = [];
var id = promise.defer();
var inheritingStore = {};
for(var i in store){
inheritingStore[i] = store[i];
}
var schema;
var originalSetSchema = store.setSchema;
inheritingStore.setSchema = function(newSchema){
schema = newSchema;
originalSetSchema && originalSetSchema.call(store, schema);
if(facetPrototype.save){
facetPrototype.save.call(this, directives);
}
var validation = validate(this, facetSchema);
var instance = this;
for(i in this){
if(this.hasOwnProperty(i)){
transfer(this[i]);
}
}
for (i in source){
if(source.hasOwnProperty(i) && !this.hasOwnProperty(i)){
transfer(undefined);
}
}
mustBeValid(validation);
var isNew = partial === NEW;
if(isNew && (typeof facetSchema.add === "function")){ // || )
partial = undefined;
id = facetSchema.add(source, directives);
}
else if(typeof facetSchema.put === "function"){
if(isNew){
directives.overwrite = false;
}
id = facetSchema.put(source, directives);
}
else if(permissive && isNew && typeof sourceClass.add === "function"){
id = sourceClass.add(source, directives);
}
else if(permissive && typeof sourceClass.put === "function"){
if(isNew){