question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swagger.Next: Forbid properties other than $ref inside JSON Pointer

See original GitHub issue

From 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 $refs.

@whitlockjc I believe you have some background on this issue.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
webroncommented, Apr 12, 2016

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…

1reaction
webroncommented, Feb 22, 2017

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found