Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example file does not validate #1

Open
rohan-plt opened this issue Aug 18, 2017 · 1 comment
Open

example file does not validate #1

rohan-plt opened this issue Aug 18, 2017 · 1 comment

Comments

@rohan-plt
Copy link

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"}

@lapalme
Copy link
Contributor

lapalme commented Aug 19, 2017

The validator by default validates json objects that sit on a single line.
You should use the --split option so that the reader builds JSON objects that span over many lines as in the booklist example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants