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

[BUG] adding optional path paramater duplciates the endpoint in swagger #2787

Closed
VictoriqueMoe opened this issue Aug 18, 2024 · 3 comments
Closed
Assignees
Labels

Comments

@VictoriqueMoe
Copy link

VictoriqueMoe commented Aug 18, 2024

Describe the bug

If you create an endpoint with an optional path param (E.g: @Put("/:bucketToken?")) it will duplicate the endpoint. but one of those entries has the bucketToken and one does not.

image
image
image

you can see in the 2nd image the path param is there but maked as "required", what i expect is there to only be one endpoint with the path param not required (optional)

To Reproduce

  1. Create an endpoint with a optional path param
  2. look at the swagger ui

Expected behavior

there should be ONE endpoint with the path param maked as not required

Code snippets

@Put("/:bucketToken?")
    public async addEntry(
        @PathParams("bucketToken")
        bucketToken?: string,
    ): Promise<unknown> {}

Repository URL example

https://github.com/waifuvault/WaifuVault

OS

Windows 11

Node version

v20.15.0

Library version

v7.79.4

Additional context

No response

@Romakita
Copy link
Collaborator

Hello @VictoriqueMoe
Isn't a bug. OAS 3 and swagger 2 doesn't allow to have path without required: true. Look the screenshot:

Capture d’écran 2024-08-19 à 09 39 15

You can play with the swagger editor to reproduce the error message: https://editor.swagger.io/

You have no choices to accept to have two routes ^^

See you
Romain

Copy link

🎉 Are you happy?

If you appreciated the support, know that it is free and is carried out on personal time ;)

A support, even a little bit makes a difference for me and continues to bring you answers!

github opencollective

@VictoriqueMoe
Copy link
Author

I see. my bad, i did not realise this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants