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

Schemas' content from discriminator.mapping are not displayed #9832

Open
AlexElin opened this issue Apr 16, 2024 · 1 comment
Open

Schemas' content from discriminator.mapping are not displayed #9832

AlexElin opened this issue Apr 16, 2024 · 1 comment

Comments

@AlexElin
Copy link

AlexElin commented Apr 16, 2024

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: Google Chrome
  • Version: 123.0.6312.107
  • Method of installation: -
  • Swagger-UI version: 5.13.0
  • Swagger/OpenAPI version: OpenAPI 3.1.0

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.1.0
info:
  title: OpenAPI definition
  version: v0
servers:
- url: http://localhost:8080
  description: Generated server url
paths:
  /address-part:
    get:
      tags:
      - demo-controller
      operationId: addressPart
      responses:
        "200":
          description: OK
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/AddressPart'
components:
  schemas:
    AddressPart:
      description: address
      discriminator:
        propertyName: type
        mapping:
          BUILDING: '#/components/schemas/Building'
          STREET: '#/components/schemas/Street'
      oneOf:
      - $ref: '#/components/schemas/Building'
      - $ref: '#/components/schemas/Street'
    Building:
      description: Building
      properties:
        number:
          type: integer
          format: int32
        type:
          type: string
    Street:
      description: Street
      properties:
        name:
          type: string
        type:
          type: string

Swagger-UI configuration options:

SwaggerUI({
    "configUrl": "/v3/api-docs/swagger-config",
    "oauth2RedirectUrl": "http://localhost:8080/swagger-ui/oauth2-redirect.html",
    "url": "/v3/api-docs",
    "validatorUrl": ""
})
?yourQueryStringConfig

Describe the bug you're encountering

Schemas' content from discriminator.mapping are not displayed.

To reproduce...

Steps to reproduce the behavior:

  1. Open the provided spec in the Swagger UI
  2. Click on 'Schemas' -> 'AddressPart' -> 'Discriminator'

Expected behavior

Schemas' content for mappings are displayed. E.g. the same way as it's done for oneOf (see the below screenshot)
image

Current behavior

Schemas are shown just as regular text (not hyperlinks)
image

@AlexElin AlexElin changed the title Schemas from discriminator.mapping are not rendered Schemas' content from discriminator.mapping are not displayed Apr 16, 2024
@tchaflich
Copy link

I have the same issue, and have noticed that the Example Values look fine, it's just the Schema that doesn't show correctly.

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

No branches or pull requests

2 participants