redocly-cli-cookbook icon indicating copy to clipboard operation
redocly-cli-cookbook copied to clipboard

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

Open tatomyr opened this issue 1 year ago • 3 comments
trafficstars

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

tatomyr avatar Jan 21 '24 14:01 tatomyr

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

lornajane avatar Jan 26 '24 17:01 lornajane

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

tatomyr avatar Jan 30 '24 09:01 tatomyr

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

adamaltman avatar Apr 22 '24 15:04 adamaltman