-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to make the $ref even more reusable with placeholders? #1749
Comments
This has been a fairly common request over the years. Sometimes it is described as an envelope or wrapper for the internal data. The issue is more of a schema related issue. If you can find a schema language that supports this concept then you may be able to use that using with the proposed From an API design perspective, I often find that envelopes around data are just duplicating what HTTP headers can already do. |
https://github.com/json-schema-org/json-schema-spec/issues/322 is the JSON Schema issue closest to this. It has not really found a champion, and it does open up considerable amounts of complexity. But we haven't rejected it either. It definitely won't go into draft-08, which is now wrapping up, but could possibly get into a future draft if someone can advocate for it successfully. I'm personally a bit skeptical as I've been down this road of essentially implementing function calls in what was supposed to be a declarative system before, and it was mostly a sign that the original solution was being re-purposed in a way that didn't really fit, but feel free to comment on the issue :-) |
This issue has been listed as a possible use case for Overlays. I don't think it would help here though - you could have overlays replace a value in the contract, but the replacement value would be fixed/static in the overlay, it would not be able to dynamically merge to elements. |
Do |
This issue has been labeled with |
My use case is the following:
I have several schema definitions. The API should return these definitions always wrapped in a certain structure. So my idea would be to have something like this:
Searching for placeholder, nested $ref, DRY, and similar variations did not lead me to satisfying solution. I found the
allOf
keyword but this forces me to rebuild the structure that should be provided by the scaffold.There is also something comparable for the
servers
key withurl
andvariables
.Is something comparable possible to reuse schema scaffolds?
If not I would rephrase this issue as feature request.
The text was updated successfully, but these errors were encountered: