Cheetah
Cheetah

Reputation: 14379

Custom OpenApi documentation with Spring Boot

I have followed this documentation to integrate an OpenAPI/swagger document with Spring WebFlux: https://www.baeldung.com/spring-rest-openapi-documentation

I'd like to generate a custom OpenApi document at runtime.

I have attempted to serve a custom @RestController on the appropriate path, but Spring complains that there is already a mapping for the path.

Are there any configuration options for this?

Upvotes: 2

Views: 2070

Answers (1)

Cheetah
Cheetah

Reputation: 14379

It would appear I was trying too hard. It was as simple as putting a OpenAPI bean into the context:

@Configuration
public class OpenApiConfig {

  @Bean
  public OpenAPI openAPI() {
    // build open api...
  }

}

Upvotes: 3

Related Questions