Possible internal reference resolution issue
When trying to resolve a schema (available here), I get the following error:
** (ExJsonSchema.Schema.InvalidSchemaError) invalid reference #verb#languagemap
(ex_json_schema) lib/ex_json_schema/schema.ex:119: ExJsonSchema.Schema.get_fragment/2
(ex_json_schema) lib/ex_json_schema/schema.ex:110: ExJsonSchema.Schema.resolve_ref/2
(ex_json_schema) lib/ex_json_schema/schema.ex:98: ExJsonSchema.Schema.resolve_property/3
(ex_json_schema) lib/ex_json_schema/schema.ex:73: anonymous fn/3 in ExJsonSchema.Schema.do_resolve/3
(stdlib) lists.erl:1263: :lists.foldl/3
...
Replacing the $ref values w/ #/properties/xxx instead of #xxx seems to get me past this issue but others arise.
I'm unsure whether this is a bug, a limitation or something wrong I'm [not] doing?
I have seen this when attempting to $ref to an id that has a local pointer such as "#uuid".
FWIW i worked around this issue by modifying the schema document i'm parsing by:
- replacing the
propertiesproperty at the top level w/definitionsto follow best practices, - replacing all
$refproperty values to be of the form#/definitions/xxx, - removing any
idproperty present at the top level of referenced schema definitions.
w/ those changes the schema is parsed correctly and i'm able to validate against it.
local references to id of definitions does not appear to work.
Thanks for reporting this, I will have to look into it. To be honest, the whole part about using ids to change the resolution scope and referencing to them is the most confusing part about the whole specification for me. No idea yet how easy this would be to fix.