Skip to content

Commit

Permalink
Use patternProperties for $ref
Browse files Browse the repository at this point in the history
While draft-wright-json-schema-00 forbids JSON References except
where a schema is expected, no validators implement this until
draft-writght-json-schema-01.  wright-00 schemas are in practice
processed as draft-04 schemas, meaning that "$ref" is always
considered a JSON Reference.  Or, at least, some validators do
that.

We can work around this by using a pattern that only matches "$ref".
There is no problem with the $ref in the "required" keyword, as
only "$ref" as a property name is recognized as a reference.
  • Loading branch information
handrews committed Nov 8, 2018
1 parent 13a4fd2 commit 5529143
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions schemas/v3.0/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ definitions:
type: object
required:
- $ref
properties:
$ref:
patternProperties:
'^\$ref$':
type: string
format: uri-reference
Info:
Expand Down

0 comments on commit 5529143

Please sign in to comment.