Skip to content
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

Support overriding description of $ref as part of OpenAPI 3.1 #484

Closed
patricksamson opened this issue Apr 15, 2024 · 3 comments · Fixed by #576
Closed

Support overriding description of $ref as part of OpenAPI 3.1 #484

patricksamson opened this issue Apr 15, 2024 · 3 comments · Fixed by #576
Labels
enhancement New feature or request

Comments

@patricksamson
Copy link

patricksamson commented Apr 15, 2024

Hello,

I'm trying to add linting to large OpenAPI 3.1 files and and got many no-$ref-siblings errors because we often override the description to add more details.

Since this was supported by some tools and not others I started digging a bit more into what the standard actually is.

It seems that starting with OpenAPI 3.1, it is possible to override the description and summary of a reference, but ONLY those two fields.
Here's a link to the relevant part of the spec : https://spec.openapis.org/oas/v3.1.0#reference-object
And a relevant issue on the OpenAPI-Specifcation repo confirming this behaviour : OAI/OpenAPI-Specification#2744

Here's a quick a example that works if you paste it in https://editor-next.swagger.io, and stops working when setting the OpenAPI version to 3.0.0 :

openapi: 3.1.0
info:
  title: Demo
  version: 1.0.0

components:
  schemas:
    Order:
      description: An Order
      type: object
      properties:
        id:
          type: integer
        customer:
          description: A happy customer
          $ref: "#/components/schemas/Customer"

    Customer:
      description: A Customer
      type: object
      properties:
        id:
          type: integer
@daveshanley
Copy link
Owner

Cool, will add it to the list!

@LasneF
Copy link

LasneF commented Sep 26, 2024

a "recent" page explaining the $ref model in details has been published by OpenAPI initiative there
https://learn.openapis.org/referencing/overview.html and around how to resolve reference

@mchlumsky
Copy link

FastAPI, a popular rest API framework started generating OpenAPI specs that trigger no-$ref-siblings.

Even their testing would trigger that rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants