-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Bundle() incorrectly dereferences some literal $ref properties #160
Comments
Hey @pimterry, did you get a chance to dig into this at all, or is it still an issue? There's a loooooot of issues here and I'm trying to help, but maintenance of this repo isn't my job and I know you're smart! :D |
Hey @philsturgeon! I haven't dug into this any further, but I've just tested with the same code from above, and I can confirm it's still an issue: bundling the official GitHub OpenAPI spec fails with the same error, because it tries to dereference a $ref that's part of an example response, not a real usable reference. |
The prerequisite for implementing this (APIDevTools/json-schema-ref-parser#249) just shipped! We could now fix this here, we just need to pass an |
Just to update this: this is still an issue, and the current behaviour is certainly incorrect, but it fell off my todo list because GitHub changed their spec instead so it no longer applies to my use case. If anybody else is interested in this, feel free to pick it up! The new json-schema-ref-parser feature from APIDevTools/json-schema-ref-parser#249 should be sufficient to do this, you just need to use that to define which parts of an OpenAPI spec should not be dereferenced automatically (i.e. which parts are literal examples). |
Not all
$ref
properties are actual refs that should be dereferenced. Inexample
values specifically,$ref
can be used for a literal field name, and should never be dereferenced (I think? OAI/OpenAPI-Specification#1986 (comment) seems to agree).This matters unfortunately because GitHub's API spec does exactly that: github/rest-api-description#188. In their
components.examples
they have:The
$ref
properties within this are literal values, as they would be returned by the API. Bundling this spec fails, like so:Not sure if this applies to cases other than examples, but I wouldn't be that surprised.
The text was updated successfully, but these errors were encountered: