1

I am writing a reactive application using webflux with springdoc-openapi(v 1.4.3). Below is the router class

@Configuration
public class FacilitiesRouter {
  @RouterOperation(path = "/facilities", produces = {
      MediaType.APPLICATION_JSON_VALUE},
      beanClass = FacilitiesHandler.class, method = RequestMethod.GET, beanMethod = "getFacility",
      operation = @Operation(operationId = "getFacility", summary = "Get facilities1 by key",
          description = "Retrieves one or more facilities1 based on provided keys .",responses = {
          @ApiResponse(responseCode = "200", description = "successful operation",
              content = @Content(schema = @Schema(implementation = FacilitiesResponse.class)))
      },
          parameters = {
              @Parameter(in =  ParameterIn.QUERY, name = "id",required = true)
      }
      ))
  @Bean
  public RouterFunction<ServerResponse> route(FacilitiesHandler handler) {
    return RouterFunctions.route(GET("/facilities"), handler::getFacility);
  }
  

}

Dependency used are

<dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-webflux-core</artifactId>
            <version>1.4.3</version>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-webflux-ui</artifactId>
            <version>1.4.3</version>
        </dependency>

What I am trying is that: parameter "id" which is Query parameter should follow REGEX [a-zA-Z0-9]{5,15}. So that from swagger if anyone is passing id which does not follow this regex it gives some warning kind of things.

I explored all the suggestions coming in @parameters . It does not have any methods to achieve it. can anyone help me know how to achieve it.

Abdullah Imran
  • 259
  • 3
  • 13

0 Answers0