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

JSON schema is invalid #486

Open
dontcallmedom opened this issue Nov 28, 2023 · 4 comments
Open

JSON schema is invalid #486

dontcallmedom opened this issue Nov 28, 2023 · 4 comments

Comments

@dontcallmedom
Copy link
Member

VISSv2 Transport JSON Schema is invalid:

  • it's not valid JSON (e.g. trailing comma on L4)
  • once the JSON is corrected, I'm not clear that it is valid JSON schema (e.g. "type": "object/array" - although maybe it is valid in some version of JSON schema - but the spec should have a normative reference to the JSON schema version it relies on)
@UlfBj
Copy link
Contributor

UlfBj commented Dec 13, 2023

Invalid commas removed, and tested succesfully with JSON validator.
Following that, the schema was used as input to this JSON schema validator:
https://www.jsonschemavalidator.net/

The JSON schema was then used to validate VISSv2 messages such as

{"action":"subscribe","path":"Vehicle","filter":[{"type":"paths","parameter":["CurrentLocation.Latitude", "CurrentLocation.Longitude"]}, {"type":"curvelog","parameter":{"maxerr":"0.00001","bufsize":"100"}}],"requestId":"285"}

The schema validator responded: No errors found. JSON validates against the schema.

Judging from this, it seems the "object/array" expression is a valid schema expression.

@dontcallmedom
Copy link
Member Author

I don't know how thorough or reliable https://www.jsonschemavalidator.net/ - I can't find any mention of "object/array" in the JSON schema specs I see, and from the look of the VISS schema, "object" is probably what is wanted here. But the point remains that not knowing which version of the spec and which module the schema is based on is problematic given that this is a normative part of the spec.

@erikbosch
Copy link
Contributor

Would it be an idea to add the actual schema as separate file in the repo, then we could as part of continuous integration add whatever validator we consider to be correct. Possibly using something like https://www.xmodulo.com/validate-json-command-line-linux.html, possibly using multiple validators if we want to make sure that none report an error

Then we just need to make sure that the version in the html documentation is identical to the individual file in the repo. This could also be used to have more test cases/examples, i.e. the spec only showing a subset of the examples, for the rest look at the text folder.

@UlfBj
Copy link
Contributor

UlfBj commented Jan 10, 2024

Set to "object" in PR#489

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

3 participants