circlecell / jsonlint.com

[OLD] Please go to new source, link below.

Home Page:https://github.com/circlecell/jsonlint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

duplicate keys

eiswdaylaporte opened this issue · comments

Hi!

I just tried to run a somewhat complicated JSON Schema doc (draft 7, ~2K lines) through JSONlint.com and received word that validation failed due to duplicate keys.

I have been moving some of my enums and patterns into separate files and referencing them with the $ref keyword. In this case the duplicate key was the $ref keyword pointing to different files.

SyntaxError: Duplicate key '$ref' on line 1223

I can understand the use of flagging duplicate keys. However, could an exception be made for $ref keywords?

Thanks for the awesome tool!

@eiswdaylaporte thank you for the feature request. Key duplicate validation is something that many people asked to implement. We're not interested on allowing to duplicate keys of some specific pattern.

Follow up on this, the behaviour of duplicate keys is undefined!

In terms of JSON Schema, just wrap each of your $ref’s in an ‘allOf’. Done.