Swagger.Next: Forbid properties other than $ref inside JSON Pointer
See original GitHub issueFrom JSON Reference:
Any members other than “$ref” in a JSON Reference object SHALL be ignored.
Implementations MAY choose to replace the reference with the referenced value.
So technically JSON Reference doesn’t forbid this behaviour, but it only makes the situation worse.
Since people expect different behaviour and it split lib/tools into two camps.
Ones who replace the reference and one who iterates through $ref
s.
@whitlockjc I believe you have some background on this issue.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Using $ref - Swagger
The value of $ref uses the JSON Reference notation, and the portion starting with # uses the JSON Pointer notation. This notation lets...
Read more >openapi - Swagger schema properties ignored when using $ref
A possible workaround is to wrap $ref into allOf - this can be used to "add" attributes to a $ref but not override...
Read more >Zalando RESTful API and Event Guidelines
Zalando's software architecture centers around decoupled microservices that provide functionality via RESTful APIs with a JSON payload.
Read more >Spring HATEOAS - Reference Documentation
1. The changes. The biggest changes in package structure were driven by the introduction of a hypermedia type registration API to support ...
Read more >An adventure in OpenAPI V3 code generation | Mux blog
$ref parameters are great because they allow you to use composition in your data models, as well as letting you break down your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This issue is incompatible with JSON Pointer because it adds a restriction that JSON Pointer doesn’t have. If the JSON Pointer’s spec writer wanted to disallow extra properties, they would have used different wording in the spec. I believe the wording there was intentional and we should not ignore it. And considering this feature wants to restrict JSON Pointer more than it is, and #556 calls for the opposite…
@handrews thanks for the pointer. We noticed that and explicitly mention in our spec that
$ref
anywhere in our spec (including Schema Objects) is our own Reference Object with follows the JSON Reference (draft) spec. So the absorption of JSON Reference and the added restrictions do not affect the OAS. This also takes away the discussion of Internal and External Reference support as we had the other day.