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

incorrect warning with option {schemaId: '$id'} and property "id" #521

Closed
moshewe opened this issue Jun 13, 2017 · 4 comments
Closed

incorrect warning with option {schemaId: '$id'} and property "id" #521

moshewe opened this issue Jun 13, 2017 · 4 comments
Labels

Comments

@moshewe
Copy link

moshewe commented Jun 13, 2017

Using the latest version (5.1.5), with the following options:

{
    schemaId: "$id", 
    extendRefs: 'fail',
}

Compiling this schema:

{
  "$id": "http://mydomain/schemas/node.json",
  "type": "object",
  "properties": {
    "id": {
      "description": "The unique identifier for a node",
      "type": "string"
    },
  },
  "required": [ "id"]
}

produces the following message: schema id ignored { type: 'string' }
I was expecting the object to just be able to have a string property called id. I've seen quite a few examples online (e.g. here) for this, so I'm not sure what's wrong here. I suspect it's the schemaId flag, but I don't understand why it applies to the id in the property map . I also have no idea how to make the $id coexist with the property named id.

@moshewe moshewe changed the title schemaId flag ignored schemaId flag with an object field named id Jun 13, 2017
@moshewe moshewe changed the title schemaId flag with an object field named id schemaId flag with an object field named id Jun 13, 2017
@moshewe moshewe changed the title schemaId flag with an object field named id schemaId flag with an object field named id ignores the field Jun 13, 2017
@epoberezkin
Copy link
Member

https://runkit.com/esp/59400ddaca4785001289c821

It should still validate correctly. You can either use it without schemaId option or just ignore the warning

@epoberezkin epoberezkin changed the title schemaId flag with an object field named id ignores the field incorrect warning with option {schemaId: '$id'} and property "id" Jun 13, 2017
@moshewe
Copy link
Author

moshewe commented Jun 14, 2017

It validates in Runkit and I've also ran it though my tests and you're right, it validates successfully. This warning is misleading, though.

@epoberezkin
Copy link
Member

in 5.1.6

@moshewe
Copy link
Author

moshewe commented Jun 16, 2017

Excellent! Thanks a bunch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants