Skip to content

Add support for addPathPrefix with Webflux swagger-ui #1050

Closed
@shota-hizawa-reazon

Description

@shota-hizawa-reazon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions