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

swagger-ui-react since version 5.17.0 does not support yaml string as a valid data type for propery 'spec' #9915

Closed
michaelXenit opened this issue May 6, 2024 · 3 comments

Comments

@michaelXenit
Copy link

michaelXenit commented May 6, 2024

Q&A (please complete the following information)

  • OS: Ubuntu 22.04
  • Browser: Chrome
  • Version: 117.0.5938.132 (Official Build) (64-bit)
  • Method of installation: yarn
  • Swagger/OpenAPI version: OpenAPI 3.0

Swagger-UI configuration options:

<SwaggerUI
        spec={spec}
        tryItOutEnabled={false}
        supportedSubmitMethods={[]}
    />;

Data example:

`
openapi: "3.0.2"
info:
  description: "description"
  version: "0.0.1-SNAPSHOT"
  title: "DcmApiApplication"
tags:
- name: "case"
paths:
  /cases:
    get:
      tags:
      - "case"
      operationId: "get-cases"
      summary: "Retrieve case list"
      parameters:
      - name: "name"
        in: "query"
        required: false
        schema:
          type: "string"
      - name: "description"
        in: "query"
        required: false
        schema:
          type: "string"
      - name: "page"
        in: "query"
        required: false
        schema:
          type: "integer"
      - name: "size"
        in: "query"
        required: false
        schema:
          type: "integer"
      - name: "sort"
        in: "query"
        required: false
        schema:
          type: "string"
      responses:
        "200":
          description: "OK"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/caseCollection"
    post:
      tags:
      - "case"
      operationId: "create-case"
      summary: "Create a new case"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/casePostBody"
      responses:
        "201":
          description: "The case has been created"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/caseResponse"
        "400":
          description: "The case can not be created due to a problem with the submitted\
            \ data"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/problemDetailDiscriminator"
        "409":
          description: "The case can not be created due to a unique attribute already\
            \ existing with that value"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/problemDetailDiscriminator"`

Describe the bug you're encountering

If you pass data in yaml string format for property spec, the panel shows an error. If the data is in JavaScript object format, everything works as expected.

Screenshots

Screenshot from 2024-05-06 16-45-25

@michaelXenit michaelXenit changed the title swagger-ui-react since version 15.17.0 does not support yaml string as a valid data type for propery 'spec' swagger-ui-react since version 5.17.0 does not support yaml string as a valid data type for propery 'spec' May 6, 2024
@char0n
Copy link
Member

char0n commented May 7, 2024

Here is the hooks where the regression probably is:

@char0n
Copy link
Member

char0n commented May 7, 2024

}, [url, spec])
vs
}, [system, url, spec])

@glowcloud
Copy link
Contributor

Addressed in #9918

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