Stream: conformance
Topic: json array validation
Patrick Werner (Mar 06 2020 at 16:09):
If i validate the following resource with meta.profile not containing a list but only a string, with the java validator i get no errors: https://gist.githubusercontent.com/patrick-werner/582b4d7f9362a1cedb1cdb1c1843d81b/raw/a14b87f7e2e918d000df159d3c10d3c608582575/example.json
Patrick Werner (Mar 06 2020 at 16:10):
Same for the hapi server and VONK. Grahames Server complains: "text": "Found a property of string looking for an array at $.meta.profile"
Patrick Werner (Mar 06 2020 at 16:10):
The java validator fails when using the resource as part of an IG: java.lang.ClassCastException: class com.google.gson.JsonPrimitive cannot be cast to class com.google.gson.JsonArray (com.google.gson.JsonPrimitive and com.google.gson.JsonArray are in unnamed module of loader 'app')
Patrick Werner (Mar 06 2020 at 16:14):
So there is some inconsistency in the validation.
@Grahame Grieve i think the java validator should also give an error when receiving a primitive instead of an array.
Grahame Grieve (Mar 06 2020 at 20:21):
umm wow.
Grahame Grieve (Mar 06 2020 at 20:22):
That's a shocking oversight and no one has ever picked it up. The validator does not check that a primitive property that should be an array actually is
Grahame Grieve (Mar 06 2020 at 20:50):
next release of the validator will note it as an error
Last updated: Apr 12 2022 at 19:14 UTC