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

springdoc-openapi v2(swagger) request object query encoding issue #10113

Open
aiden-sim opened this issue Aug 30, 2024 · 2 comments
Open

springdoc-openapi v2(swagger) request object query encoding issue #10113

aiden-sim opened this issue Aug 30, 2024 · 2 comments

Comments

@aiden-sim
Copy link

aiden-sim commented Aug 30, 2024

After migrating from springdoc-openapi v1 to v2, we started experiencing issues with requests using a query param DTO.
Previously, requests were structured as standard query parameters, but now they are being URL-encoded, leading to errors.

Here is an example of a swagger request object query:

{
  "searchType": "ACCOUNT_ID",
  "searchKeywords": [
    "12345"
  ],
  "types": [
    "NORMAL",
    "WITHDRAW"
  ]
}

With springdoc-openapi v1, the request URL looked like this:

http://localhost:8080/search?searchType=ACCOUNT_ID&searchKeywords=12345&types=NORMAL&types=WITHDRAW

However, after upgrading to springdoc-openapi v2, the request URL changed to the following (with the query parameters URL-encoded):

http://localhost:8080/search?searchType=ACCOUNT_ID&searchKeywords=%5B%2212345%22%5D&types=%5B%22NORMAL%22%2C%22WITHDRAW%22%5D

Decoded, it looks like:

http://localhost:8080/search?searchType=ACCOUNT_ID&searchKeywords=["12345"]&types=["NORMAL","WITHDRAW"]

Although the requests work fine when using curl, it seems to be an issue with the new version of springdoc-openapi v2(swagger).
It doesn't appear to be a application problem.

How should we address this?

I am using org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0

@RomaIvanovOfficial
Copy link

We have same problem

@RomaIvanovOfficial
Copy link

Set @ParameterObject in method for DTO class

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

No branches or pull requests

2 participants