8000 Schema validation · Issue #38 · everit-org/json-schema · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Schema validation #38
Closed
Closed
@romanpa

Description

@romanpa

Hi

The schema below should catch an error in an object below.
But id does not :(

Map schemaMap = getSchemaMap();
JSONObject rawSchema = new JSONObject(schemaMap);
Schema schema = SchemaLoader.load(rawSchema);
schema.validate(....)

{
"type" : "object",
"id" : "urn:jsonschema:com:zzzzz:tests:commons:jsonschema:models:Person",
"properties" : {
"book" : {
"type" : "object",
"id" : "urn:jsonschema:com:zzzzz:tests:commons:jsonschema:models:PhoneBook",
"properties" : {
"numbers" : {
"type" : "array",
"items" : {
"type" : "object",
"id" : "urn:jsonschema:com:zzzzz:tests:commons:jsonschema:models:PhoneNumber",
"properties" : {
"number" : {
"type" : "string",
"pattern" : "+?\d+"
},
"type" : {
"type" : "string"
}
}
}
}
}
},
"phoneBooks" : {
"type" : "array",
"items" : {
"type" : "object",
"$ref" : "urn:jsonschema:com:zzzzz:tests:commons:jsonschema:models:PhoneBook"
}
}
}
}

{
"book" : {
"numbers" : [ {
"number" : "22222"
}, {
"number" : "11111"
} ]
},
"phoneBooks" : [ {
"numbers" : [ {
"number" : "22222"
}, {
"number" : "11111"
}, {
"number" : "aaaaa"
} ]
} ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0