rali-udem / json-rnc Goto Github PK
View Code? Open in Web Editor NEWJSON validation with a RELAX-NG compact syntax
JSON validation with a RELAX-NG compact syntax
Hi,
I pasted the sample book JSON-RNC schema into book.json-rnc and the same booklist file into booklist.json and got the errors below (nothing validated, and it did not find the start of the schema). I ran Src/ParseJsonRnc.py which showed the JSON Schema I would have expected (also below).
$ Src/ValidateJsonRnc.py book.json-rnc booklist.json
Item 1: bad json object:Expecting object: line 1 column 28 (char 27)
Item 2: bad json object:Extra data: line 1 column 10 - line 2 column 1 (char 9 - 32)
Item 3: bad json object:Extra data: line 1 column 21 - line 2 column 1 (char 20 - 39)
Item 4: bad json object:Extra data: line 1 column 19 - line 2 column 1 (char 18 - 37)
Item 5: bad json object:Extra data: line 1 column 21 - line 2 column 1 (char 20 - 26)
Item 6: bad json object:Extra data: line 1 column 20 - line 2 column 1 (char 19 - 43)
Item 7: bad json object:Expecting object: line 1 column 37 (char 36)
Item 8: bad json object:Extra data: line 1 column 21 - line 2 column 1 (char 20 - 28)
Item 9: bad json object:Extra data: line 1 column 21 - line 2 column 1 (char 20 - 47)
Item 10: bad json object:Extra data: line 1 column 18 - line 2 column 1 (char 17 - 27)
Item 11: bad json object:Extra data: line 1 column 20 - line 2 column 1 (char 19 - 43)
Item 12: bad json object:Extra data: line 1 column 21 - line 2 column 1 (char 20 - 25)
Item 13: bad json object:Extra data: line 1 column 23 - line 2 column 1 (char 22 - 134)
Item 14: bad json object:Extra data: line 1 column 19 - line 2 column 1 (char 18 - 35)
Item 15: bad json object:Expecting object: line 1 column 25 (char 24)
Item 16: bad json object:Extra data: line 1 column 10 - line 2 column 1 (char 9 - 15)
Item 17: bad json object:Expecting object: line 1 column 33 (char 32)
Item 18: bad json object:Extra data: line 1 column 9 - line 2 column 1 (char 8 - 20)
Item 19: bad json object:Expecting object: line 1 column 31 (char 30)
Item 20: bad json object:Extra data: line 1 column 9 - line 1 column 18 (char 8 - 17)
20 objects read: 0 invalid, 20 bad, 0 with duplicate fields
{"$schema":"http://json-schema.org/draft-04/schema#",
"definitions":{"Book":{"properties":{"$id":{"type":"string"},
"ISBN":{"type":"string"},
"author":{"type":"string"},
"number":{"type":"integer"},
"subtitle":{"type":"string"},
"title":{"type":"string"},
"type":{"$ref":"#/definitions/BookType"},
"weight":{"type":"number"}},
"required":["title","author","ISBN","weight","type"],
"type":"object"},
"BookList":{"properties":{"books":{"items":{"$ref":"#/definitions/Book"},
"type":"array"},
"owner":{"type":"string"}},
"required":["books","owner"],
"type":"object"},
"BookType":{"oneOf":[{"pattern":"Paperback",
"type":"string"},
{"pattern":"Hardcover",
"type":"string"}]},
"Store":{"properties":{"name":{"type":"string"},
"url":{"type":"string"}},
"required":["name","url"],
"type":"object"},
"start":{"items":{"oneOf":[{"$ref":"#/definitions/BookList"},
{"$ref":"#/definitions/Store"}]},
"type":"array"}},
"description":"Written: 2017-08-18 16:18",
"items":{"oneOf":[{"$ref":"#/definitions/BookList"},
{"$ref":"#/definitions/Store"}]},
"title":"Created from JSON-RNC: book.json-rnc",
"type":"array"}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.