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

Switching between examples does not render the changed Example Value and Schema it keeps the request schema #5163

Open
Orgoth opened this issue Jun 21, 2024 · 0 comments

Comments

@Orgoth
Copy link

Orgoth commented Jun 21, 2024

Q&A (please complete the following information)

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.0
info:
  title: 'API'
  description: '!'
  contact:
    email: [email protected]
  version: 1.0.0
paths:
  /api/kundencenter/set:
    post:
      tags:
        - kundencenter
      description: 'An endpoint'
      operationId: ApiKundencenterSet
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/insertData'
            examples:
              'insert customer':
                $ref: '#/components/schemas/insertData'
              'update customer':
                $ref: '#/components/schemas/updateData'
      responses:
        '200':
          description: 'The data'
        '400':
          description: 'The data'
        '401':
          description: Unauthorized
      security:
        -
          bearerAuth: []
components:
  schemas:
    Angebot:
      title: 'Angebot model'
      description: 'Angebot model'
      properties:
        ident:
          title: ident
          description: ident
          type: string
          format: string
          default: angebot
          maxLength: 64
        title:
          title: Titel
          description: Titel
          type: string
          format: string
          default: test
          maxLength: 64
        sparte:
          title: sparte
          description: sparte
          type: string
          format: string
          default: PHV
          maxLength: 64
        json:
          title: json
          description: json
          type: object
          format: object
      type: object
    Kunde:
      title: 'Kunde model'
      description: 'Kunde model'
      properties:
        Anrede_k:
          title: Anrede
          description: Anrede
          type: string
          enum:
            - Herr
            - Frau
            - Firma
            - WEG
      type: object
    KundeUpdate:
      title: 'KundeUpdate model'
      description: 'KundeUpdate model'
      type: object
      allOf:
        -
          $ref: '#/components/schemas/Kunde'
        -
          properties:
            pk_k:
              title: pk_k
              description: pk_k
              type: integer
              format: int64
              default: '12345'
          type: object
    insertData:
      title: 'kundencenter insertData'
      description: 'kundencenter insertData'
      properties:
        Kunde:
          $ref: '#/components/schemas/Kunde'
        Angebot:
          $ref: '#/components/schemas/Angebot'
      type: object
    updateData:
      title: 'kundencenter updateData'
      description: 'kundencenter updateData'
      properties:
        Kunde:
          $ref: '#/components/schemas/KundeUpdate'
        Angebot:
          $ref: '#/components/schemas/Angebot'
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
security:
  -
    bearerAuth: []

Swagger-Editor configuration options:
https://editor-next.swagger.io/ or https://editor.swagger.io/

Describe the bug you're encountering

The editor should switch between the different examples and schemas which where referenced.
Instead, the editor always shows the referenced schema of the request.

To reproduce...

Steps to reproduce the behavior:

Example Value and Schema are not changing.

Expected behavior

If I select the example "update customer", Example Value should add the required property "pk_k" and the schema should change from "kundencenter insertData" to "kundencenter updateData".

Screenshots

Auswahl_1091
Auswahl_1092
Auswahl_1093
Auswahl_1094
Auswahl_1095

Additional context or thoughts

Same issue exists within the repose examples, they are not getting shown when switching between the examples.
Now is the Question if this is intended or a bug.
If it is intended, why is there a way to reference schemas for different examples, if they are not getting respected.

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

1 participant