Skip to content

Path parameters are not rendered correctly #648

@StefanFW

Description

@StefanFW

Hi,

we faced an issue where the path parameters of our specifications are not rendered correctly sometimes.
After a while of researching we find out, that rapidoc won't interpret the references in the parameter sections after the first usage.

Example api specification json
{
  "openapi": "3.0.0",
  "info": {
    "title": "test",
    "description": "This is an example",
    "version": "1.0.0"
  },
  "paths": {
    "/twoPathParams/{param1}/{param2}": {
      "get": {
        "description": "a sample description",
        "parameters": [
          {
            "$ref": "#/components/parameters/param1"
          },
          {
            "$ref": "#/components/parameters/param2"
          }
        ],
        "responses": {
          "200": {
            "description": "get exampleResponse"
          }
        }
      },
      "delete": {
        "parameters": [
          {
            "$ref": "#/components/parameters/param1"
          },
          {
            "$ref": "#/components/parameters/param2"
          }
        ],
        "responses": {
          "200": {
            "description": "delete exampleResponse"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "param1": {
        "description": "param1 sample description",
        "name": "param1",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/param"
        }
      },
      "param2": {
        "description": "param2 sample description",
        "name": "param2",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/param"
        }
      }
    },
    "schemas": {
      "param": {
        "allOf": [
          {
            "pattern": "^[a-z0-9.~_-]+$"
          },
          {
            "maxLength": 256
          },
          {
            "type": "string",
            "example": "example-example",
            "description": "example description"
          }
        ]
      }
    }
  }
}

This specification contains two endpoints (GET and DELETE) of /twoPathParams/{param1}/{param2} with the two params param1 and param2.
Both endpoints references the same params.

If I open this specification json in the rapidoc Docker container with

docker run --rm -ti -p 8080:80 mrin9/rapidoc:v9.1.4

rapidoc renders the first usage of the params correctly

Screenshot 2022-02-01 at 12 03 28

but not the second usage of the params

Screenshot 2022-02-01 at 12 03 36

Could you please check this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions