question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for addPathPrefix with Webflux swagger-ui

See original GitHub issue

Describe the Feature When we use WebFluxConfigurer to set base-path, it’s unable to access http://server:port/context-path/swagger-ui.html. We can access to http://server:port/context-path/v3/api-doc though. image image

WebfluxConfigurer

@Configuration
@EnableWebFlux
class WebFluxConfiguration : WebFluxConfigurer {

    override fun configurePathMatching(configurer: PathMatchConfigurer) {
        configurer.addPathPrefix("/api/v1") { true }
    }
}

In this case, context-path should be replaced with /api/v1, so we should see swagger-ui at http://server:port/api/v1/swagger-ui.html.

image

It seems like that context-path is not loaded when generating the url of springdoc-config, because we can access to http://server:port/api/v1/v3/api-docs/swagger-config. image

To Reproduce Steps to reproduce the behavior:

  • What version of spring-boot you are using? Running with Spring Boot v2.4.0, Spring v5.3.1

  • What modules and versions of springdoc-openapi are you using? Using springdoc-openapi-webflux-ui v1.5.2 with springdoc-openapi-kotlin v.1.5.2

  • Provide with a sample code (HelloController) or Test that reproduces the problem I put a sample code to set context-path by WebFluxConfigurer above. so please refer that.

Expected behavior We should be able to access swagger-ui.html

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bnasslahsencommented, Feb 24, 2021

@shota-hizawa-reazon,

The support is now added. You can test it using the latest snapshot.

1reaction
bnasslahsencommented, Feb 16, 2021

@shota-hizawa-reazon,

This seems a different problem, as you are setting the path prefix using addPathPrefix. This one is not supported yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

404 error with swagger-ui and spring webflux - Stack Overflow
Found it! I have to register a webflux resource handler for swagger-ui like this. import org.springframework.context.annotation.
Read more >
springdoc-openapi v1.5.5 release notes (2021-02-28) | LibHunt
#1050 - Add support for addPathPrefix with Webflux swagger-ui. #1059 - Support per method security requirement in RepositoryRestResource.
Read more >
Spring Webflux Swagger UI and Open API 3 API specifications
The main requirement is generating the Open API 3 specifications for the spring boot webflux based APIs and exposing the same using the...
Read more >
Spring WebFlux OpenAPI 3 | JavaTechie - YouTube
In this tutorial we will understand How to generate swagger documents for spring WebFlux functional style programming models using OpenAPI 3 ...
Read more >
Bump springdoc-openapi-ui from 1.5.4 to 1.5.6 (!194 ... - GitLab
Added. #1050 - Add support for addPathPrefix with Webflux swagger-ui. #1059 - Support per method security requirement in RepositoryRestResource. ... Fixed. #1068 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found