Skip to content

Optional route params not recognised #2369

Open
@Akxe

Description

@Akxe

openapi-typescript version

6.8.0

Node.js version

all

OS + version

all

Description

api-docs.minimal-reproduction.json

The route /api/carrier/photo/{carrierId}/fromOrders/{orderId} has required: false in the parameter description.

Relevant part of the file above

"/api/carrier/photo/{carrierId}/fromOrders/{orderId}": {
    "get": {
        "parameters": [
            {
                "name": "carrierId",
                "in": "path",
                "required": true
            },
            {
                "name": "orderId",
                "in": "path",
                "required": false,
                "allowEmptyValue": true
            }
        ]
    }
},

Reproduction

Run the file in the link above.

Expected result

The parameters.path should result in { carrierId: string, orderId?: string }

Required

  • My OpenAPI schema is valid and passes the Redocly validator (npx @redocly/cli@latest lint)

Extra

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi-tsRelevant to the openapi-typescript library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions