swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.61k stars 8.96k forks source link

Path param not supported with /api/name={name} on swagger-ui version >= 5.17.7 #10126

Closed praveeng-nair closed 2 months ago

praveeng-nair commented 2 months ago

Q&A

Content & configuration

Example Swagger/OpenAPI definition:

---
openapi: 3.1.0
info:
  title: "Swagger Spec"
  version: '1.0'
paths:
  /api/examples/name={name}:
    get:
      operationId: readByName
      summary: Gets by its name.
      parameters:
        - name: name
          description: Object name.
          in: path
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 50
      responses:
        200:
          description: The operation was successful.
          content:
            application/json:
              schema:
                allOf:
                  - description: A list of examples.
                    type: object
                    required:
                      - elements

Swagger-UI configuration options:

<dependency>
            <groupId>org.webjars</groupId>
            <artifactId>swagger-ui</artifactId>
            <version>5.17.7</version>
</dependency>

Describe the bug you're encountering

When trying to hit that API the path is not getting replaced by param. generated curl by swagger ui below

curl -X 'GET' \
  'http://localhost:8080/api/examples/name={name}' \
  -H 'accept: application/json'

Though the swagger specs comply with the structure but the replacement of path param is not working. it is working for maven versions below 5.17.6.

praveeng-nair commented 2 months ago

similar issue https://github.com/swagger-api/swagger-ui/issues/10078 hence closing