w3c / automotive

W3C Automotive Working Group Specifications
Other
145 stars 68 forks source link

JSON schema is invalid #486

Open dontcallmedom opened 9 months ago

dontcallmedom commented 9 months ago

VISSv2 Transport JSON Schema is invalid:

UlfBj commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 7 months ago

Set to "object" in PR#489