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

Possible internal reference resolution issue #19

Open
raif-s-naffah opened this issue Apr 29, 2017 · 4 comments
Open

Possible internal reference resolution issue #19

raif-s-naffah opened this issue Apr 29, 2017 · 4 comments

Comments

@raif-s-naffah
Copy link

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?

@technomage
Copy link

I have seen this when attempting to $ref to an id that has a local pointer such as "#uuid".

@raif-s-naffah
Copy link
Author

FWIW i worked around this issue by modifying the schema document i'm parsing by:

  • replacing the properties property at the top level w/ definitions to follow best practices,
  • replacing all $ref property values to be of the form #/definitions/xxx,
  • removing any id property 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.

@technomage
Copy link

local references to id of definitions does not appear to work.

@jonasschmidt
Copy link
Owner

jonasschmidt commented Jun 11, 2017

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.

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