Closed lizjackson-toast closed 11 months ago
Thanks for the report and all the detective work.
If you do want to fix it yourself I'll take the patch, that would probably be faster than waiting for me to do it, given that I'm juggling about five projects at the moment.
You know what – turns out we resolved this issue by upgrading from 0.11.4
to 0.12.2
. No updates are needed after all; thanks for adding the latest updates!
Loading a JSON schema through a
SchemaStore
object results in an infinite loop if a JSON schema has a$schema
that has no content (such as http://json-schema.org/schema, which returns a 301) and also does not have an$id
.Here's how this happens:
while (true)
loop here.$schema
here andcontent
is null.store
call here throws an exception due to the null content.catch (JsonProcessingException e)
block.Document
object calleddoc
and anElements
object calledlinks
here. However, sincecontent
is null,doc
is null andlinks
has a size of zero.resolved
totrue
here because there are nolinks
to loop through, and we display the "Was not valid JSON" warning from this block.continue
here, loop again, hit the same problem, and keep looping ad infinitum.Even though the jsonschemafriend readme lists a specific set of schemas that are supported in the
$schema
field, jsonschemafriend should throw an exception if the$schema
has no content rather than looping infinitely.Let me know if you'd like me to fix this myself or if someone closer to jsonschema friend would prefer to address this.
Thank you!