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

Regression after version 1.6.9 spring.webflux.base-path repeats on page reload #1818

Closed
vladgon opened this issue Aug 26, 2022 · 5 comments
Closed
Labels
duplicate This issue or pull request already exists

Comments

@vladgon
Copy link

vladgon commented Aug 26, 2022

**When using spring.webflux.base-path, the prefix multiply on each page reload **

  • This issue appears when server is explicitly set e.g. localhost and spring.webflux.base-path is set. This is a regression still not fixed in 1.6.11, works fine in 1.6.9
    tested with Springboot version 2.7.3

To Reproduce
Steps to reproduce the behavior:

  • Set the spring.webflux.base-path and reload the page, the operation path grows with each reload
@bnasslahsen
Copy link
Contributor

@vladgon,

Shoud be same root cause as #1820

@bnasslahsen bnasslahsen added the duplicate This issue or pull request already exists label Aug 30, 2022
@vladgon
Copy link
Author

vladgon commented Aug 30, 2022

in this case the operation path grows on each refresh e.g.
prefix/op/get
prefix/prefix/op/get
prefix/prefix/prefix/op/get

@bnasslahsen
Copy link
Contributor

@vladgon,

Not reproducible.
Are you able to Provide a Minimal, Reproducible Example - with HelloController that reproduces the problem ?

@bnasslahsen bnasslahsen added invalid This doesn't seem right and removed duplicate This issue or pull request already exists labels Aug 30, 2022
vladgon pushed a commit to vladgon/SpringDoc that referenced this issue Aug 30, 2022
@vladgon
Copy link
Author

vladgon commented Aug 30, 2022

The issue is in OpenApiCustomiser is invoked on every page refresh after version 1.6.9 and before was invoked on startup only once.

Please see sample code in https://github.com/vladgon/SpringDoc

@Bean
OpenApiCustomiser openApiCustomiser(@Value("${spring.webflux.base-path}") String base) {
 return openApi -> openApi.setPaths(openApi.getPaths()
                                               .entrySet()
                                               .stream()
                                               .reduce(new Paths(),
                                                       (paths, item) -> paths.addPathItem(
                                                               java.nio.file.Paths.get(base, item.getKey())
                                                                                  .toString(),
                                                               item.getValue()),
                                                       (paths, paths2) -> paths));
 }

@bnasslahsen
Copy link
Contributor

@vladgon,

Good that you have added the sample.
It's confirmed that it's the same root cause: OpenApiCustomiser...
So it's duplicate of #1820.

Don't hesitate to test it with the latest SNAPSHOT and provide your feedback.

@bnasslahsen bnasslahsen added duplicate This issue or pull request already exists and removed invalid This doesn't seem right labels Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants