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

feat: add custom refs plugin rules: no-refs-siblings and no-circular-refs #25

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tatomyr
Copy link
Contributor

@tatomyr tatomyr commented Jan 21, 2024

Created two rules in the scope of investigating issues Redocly/redocly-cli#1329 and
Redocly/redoc#2474.
Also related: Redocly/redocly-cli#644

Dealing with $refs might be quite a challenge sometimes.
This plugin introduces a few rules that could give insights into how the $refs are used.

### No $refs siblings
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe no unexpected $refs siblings? Because we do still allow the valid ones like description.

@lornajane
Copy link
Collaborator

I tried to test this and it didn't do what I expected. Did I find an edge case, or do I not understand what a circular reference is? My (I edited the components/schema section of the Museum API example example snippet is like this:

    TicketConfirmation:
      description: Unique confirmation code used to verify ticket purchase.
      $ref: '/#components/schemas/BuyMuseumTicketsResponse'
    BuyMuseumTicketsResponse:
      description: Details for a museum ticket after a successful purchase.
      type: object
      properties:
        confirmationCode: 
          $ref: '#/components/schemas/TicketConfirmation'
      required:
        - confirmationCode

@tatomyr tatomyr self-assigned this Jan 30, 2024
@tatomyr
Copy link
Contributor Author

tatomyr commented Jan 30, 2024

@lornajane there's a typo in '/#components/schemas/BuyMuseumTicketsResponse'. It should be the other way around: #/.... Anyway, it isn't get checked, so it looks like some kind of an edge case. Thanks for the catch! Will try to fix that a bit later.

@adamaltman adamaltman marked this pull request as draft April 22, 2024 15:53
@adamaltman
Copy link
Member

(I converted it to a draft because I come to check this PR every week and forget it is still in progress. 🧠 )

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

Successfully merging this pull request may close these issues.

None yet

3 participants