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

SwaggerEditor@next: Schema reference not found in OpenAPI 3.1.0 definition #4029

Closed
notaphplover opened this issue Apr 8, 2023 · 2 comments

Comments

@notaphplover
Copy link

Q&A (please complete the following information)

  • OS: Linux
  • Browser: chrome and firefox
  • Method of installation: dist assests? I just browsed https://editor-next.swagger.io/
  • Swagger-UI version: 5
  • Swagger/OpenAPI version: OpenAPI 3.1

Content & configuration

Simply browse https://editor-next.swagger.io/ and try the example OpenAPI definition (yes, I tried to simplify it as much as possible 😃)

Example Swagger/OpenAPI definition:

openapi: 3.1.0
info:
  title: One game API
  version: "1.0"
servers:
  - url: http://127.0.0.1:8000
    description: Local development server
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    GameIdSlotIdUpdateQueryV1:
      $id: https://onegame.schemas/api/v1/games/game-id-slot-id-update-query.json
      title: GameIdSlotIdUpdateQueryV1
      type: object
      additionalProperties: false
      properties:
        userId:
          type:
            - "null"
            - string
      required:
        - userId
    ActiveGameSlotV1:
      $id: https://onegame.schemas/api/v1/games/active-game-slot.json
      title: ActiveGameSlotV1
      type: object
      additionalProperties: false
      properties:
        cardsAmount:
          type: integer
        userId:
          type: string
      required:
        - cardsAmount
        - userId
    ActiveGameSlotCardsV1:
      title: ActiveGameSlotCardsV1
      $ref: "#/components/schemas/CardArrayV1"
    CardV1:
      $id: https://onegame.schemas/api/v1/cards/card.json
      title: CardV1
      anyOf:
        - $ref: "#/components/schemas/BlankCardV1"
    CardArrayV1:
      $id: https://onegame.schemas/api/v1/cards/card-array.json
      title: CardArrayV1
      type: array
      items:
        $ref: "#/components/schemas/CardV1"
    BlankCardV1:
      $id: https://onegame.schemas/api/v1/cards/blank-card.json
      title: BlankCardV1
      additionalProperties: false
      type: object
      properties:
        kind:
          const: blank
          type: string
      required:
        - kind
paths:
  "/v1/games/{gameId}/slots/{gameSlotIndex}/cards":
    get:
      summary: Get a game slot cards
      parameters:
        - in: path
          name: gameId
          schema:
            type: string
          required: true
          description: Id of the game containing the game slot to get
        - in: path
          name: gameSlotIndex
          schema:
            type: integer
          required: true
          description: Index of the game slot to get
      responses:
        "200":
          description: Game slot cards found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ActiveGameSlotCardsV1"
      security:
        - bearerAuth: []

Swagger-UI configuration options:
Default ones

Describe the bug you're encountering

Line 88: local reference not found

To reproduce...

Steps to reproduce the behavior:

  1. Browse https://editor-next.swagger.io/
  2. Paste the example yaml.
  3. Scroll down until you reach the line 88.
  4. An error should be displayed.

Expected behavior

I expect #/components/schemas/ActiveGameSlotCardsV1 to be resolved since it is defined.

Screenshots

Error screenshot
image

Additional context or thoughts

To be honest I don't know why this is happening. Other OpenAPI 3.1 viewers can resolve the reference correctly.

cc @char0n, I submit this issue after we were requested in swagger-api/swagger-ui#5891 to test the alpha, hope this helps.

@char0n
Copy link
Member

char0n commented Apr 10, 2023

Yep, I can confirm, we'll have to investigate why this is happening. I've transfered issue to swagger-editor repo, as it's not related to SwaggerUI.

@char0n char0n transferred this issue from swagger-api/swagger-ui Apr 10, 2023
@char0n char0n changed the title OpenAPI 3.1.0 support: Schema reference not found SwaggerEditor@next: Schema reference not found in OpenAPI 3.1.0 definition Apr 12, 2023
@frantuma
Copy link
Member

fixed in swagger-api/apidom#2959

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

No branches or pull requests

3 participants