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

Only first path parameter is replaced in "Try it out" #9928

Closed
afdaniele opened this issue May 10, 2024 · 4 comments
Closed

Only first path parameter is replaced in "Try it out" #9928

afdaniele opened this issue May 10, 2024 · 4 comments

Comments

@afdaniele
Copy link

Q&A (please complete the following information)

  • OS: Linux (Ubuntu 22.04)
  • Browser: Chrome
  • Version: 124.0
  • Method of installation: dist assets
  • Swagger-UI version: 5.17.7
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Example Swagger/OpenAPI definition:

{
    "openapi": "3.0.3",
    "info": {
        "title": "My API",
        "version": "1.0",
        "description": "My API description"
    },
    "paths": {
      "/api/v1/docker/image/metadata/{registry}/{organization}/{repository}/{tag}/latest/": {
        "get": {
            "operationId": "docker/image/metadata/latest",
            "description": "Get the latest metadata of a docker image",
            "summary": "Get latest Image Metadata",
            "parameters": [
                {
                    "in": "path",
                    "name": "registry",
                    "schema": {
                        "type": "string"
                    },
                    "required": true
                },
                {
                    "in": "path",
                    "name": "organization",
                    "schema": {
                        "type": "string"
                    },
                    "required": true
                },
                {
                    "in": "path",
                    "name": "repository",
                    "schema": {
                        "type": "string"
                    },
                    "required": true
                },
                {
                    "in": "path",
                    "name": "tag",
                    "schema": {
                        "type": "string"
                    },
                    "required": true
                }
            ],
            "tags": [
                "Docker"
            ],
            "responses": {
                "200": {
                    "description": "No response body"
                }
            }
        }
      }
  }
}

Describe the bug you're encountering

The path defines 4 parameters, when the API endpoint is tested using the "Try it out" button, only the first parameter is replaced, the others are left as placeholders (see image below).

To reproduce...

Steps to reproduce the behavior:

  1. Point an instance of swagger-ui (default configuration and options) to the OpenAPI description above;
  2. Click on 'Try it out' for the only endpoint defined;
  3. Populate the 4 parameter values;
  4. Click on "Execute"
  5. See how only the first parameter is replaced with the given value;

Expected behavior

All parameters should be replaced in the endpoint's path.

Screenshots

image

@dfad1469
Copy link

dfad1469 commented May 11, 2024

I can confirm I am seeing this and rolling back to 5.17.6 restores it to working correctly.

@afdaniele
Copy link
Author

@dfad1469 Thanks.
I confirm that the problem is not present in v5.17.6.

image

@glowcloud
Copy link
Contributor

Addressed in #9927 with a swagger-client change: swagger-api/swagger-js#3511

@char0n
Copy link
Member

char0n commented May 13, 2024

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

4 participants