Comments (4)
(shema was invalid by the way, I forgot to mention that... )
from z-schema.
can you submit the invalid schema?
from z-schema.
Same problem, here is schema generated by
http://jsonschema.net/reboot/#/
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net#",
"type": "array",
"required": false,
"items": {
"id": "http://jsonschema.net/5#",
"type": "object",
"required": false,
"properties": {
"identifiers": {
"id": "http://jsonschema.net/5/identifiers#",
"type": "array",
"required": false,
"items": {
"id": "http://jsonschema.net/5/identifiers/0#",
"type": "object",
"required": false,
"properties": {
"identifier": {
"id": "http://jsonschema.net/5/identifiers/0/identifier#",
"type": "string",
"required": false
}
}
}
},
"vital": {
"id": "http://jsonschema.net/5/vital#",
"type": "object",
"required": false,
"properties": {
"name": {
"id": "http://jsonschema.net/5/vital/name#",
"type": "string",
"required": false
},
"code": {
"id": "http://jsonschema.net/5/vital/code#",
"type": "string",
"required": false
},
"code_system_name": {
"id": "http://jsonschema.net/5/vital/code_system_name#",
"type": "string",
"required": false
}
}
},
"status": {
"id": "http://jsonschema.net/5/status#",
"type": "string",
"required": false
},
"date": {
"id": "http://jsonschema.net/5/date#",
"type": "array",
"required": false,
"items": {
"id": "http://jsonschema.net/5/date/0#",
"type": "object",
"required": false,
"properties": {
"date": {
"id": "http://jsonschema.net/5/date/0/date#",
"type": "string",
"required": false
},
"precision": {
"id": "http://jsonschema.net/5/date/0/precision#",
"type": "string",
"required": false
}
}
}
},
"interpretations": {
"id": "http://jsonschema.net/5/interpretations#",
"type": "array",
"required": false,
"items": {
"id": "http://jsonschema.net/5/interpretations/0#",
"type": "string",
"required": false
}
},
"value": {
"id": "http://jsonschema.net/5/value#",
"type": "integer",
"required": false
},
"unit": {
"id": "http://jsonschema.net/5/unit#",
"type": "string",
"required": false
}
}
}
}
from z-schema.
@kachok That's not a valid version 4 schema (4 is currently the latest version, which this validator validates for, see http://json-schema.org/). What'd you expect to happen with an invalid schema? I'm correctly getting a list of errors when I try to compile it like this:
var validator = new ZSchema({ sync: true });
try {
validator.compileSchema(schema);
} catch (e) {
console.log(e);
}
Errors:
{ [Error: Validation failed]
errors:
[ { [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[identifiers]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[identifiers]/items',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[identifiers]/items/properties[identifier]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[vital]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[vital]/properties[name]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[vital]/properties[code]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[vital]/properties[code_system_name]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[status]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[date]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[date]/items',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[date]/items/properties[date]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[date]/items/properties[precision]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[interpretations]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[interpretations]/items',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[value]',
params: [Object] },
{ [Error: Keyword "required" is expected to be of type "array"]
code: 'KEYWORD_TYPE_EXPECTED',
message: 'Keyword "required" is expected to be of type "array"',
path: '#/items/properties[unit]',
params: [Object] } ],
warnings: [] }
from z-schema.
Related Issues (20)
- add keyword in error objects of getLastErrors()
- Allow to specify errors to be reported
- why when schema type is string, there is no error when the value type is integer or number ? HOT 2
- Update to core-js 3.x
- Doesn't validate minimum and maximum on numbers HOT 1
- Versions mismatch cause npm error HOT 4
- Remove core-js HOT 2
- Missing type for Validator.validate(json, schema, options) HOT 3
- 'email' format accepts email addresses with several types of whitespace. HOT 3
- 'ARRAY_ADDITIONAL_ITEMS' error unreachable?
- Is there any approach to suppress an error code HOT 2
- Local schemas not being retrieved from cache
- zSchema doesn't support json-schema post 2020-12
- Vulnerabilities introduced by package validator HOT 2
- Vulnerability in Validator JS HOT 1
- Update Validator to 13.7.0 HOT 1
- `lastReport` absent in `index.d.ts` HOT 2
- Update commander as it's version marked as EOL
- Support for Unicode Properties
- List on json-schema.org HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from z-schema.