SchemaStore / SchemaStore/schemastore
Invalid $ref and $schema version usage, leading to checks being noops across a number of schemas
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3.8k
- Forks
- 2.3k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 124
Description
Area with issue?
JSON Schema
✔️ Expected Behavior
See https://github.com/ExodusMovement/schemasafe/issues/158#issuecomment-1653608034
In draft-07 and below (below 2019-09), $ref makes all sibling keywords ignored: https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-01#section-8.3
Upstream testsuite: https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/8cdfac41e37527795879e480a483997cbd6188f3/tests/draft7/ref.json#L145-L177
❌ Actual Behavior
A number of schemas here don't check what they are supposed to, e.g. the following checks are noops/ignored in all JSON Schema implementations that pass on upstream testsuite:
properties is a noop/ignored, with all nested checks.
type is a noop/ignored.
type and properties are noops/ignored, with all nested checks.
-
A number of other schemas.
The ones above are just examples, this seems wide-spread.
Passing all schemas through schemasafe should highlight all issues — it refuses to compile such schemas in default configuration (unless schema mistakes are silenced).
YAML or JSON file that does not work.
No response
IDE or code editor.
None
Are you making a PR for this?
No, someone else must create the PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running schemasafe across the affected schemas, then inspect github-workflow.json, prettierrc.json, and stale.json at the linked $ref and $schema locations. Compare their behavior with the JSON Schema draft-07 ref tests. Done means the affected schemas no longer contain invalid $ref/$schema usage that causes sibling checks to be ignored.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, json
- Domain
- testing, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100