springdoc (swagger) : schema data type are not expanding by default

353 views Asked by At

I am using org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0 for api documentation.

In the schema section the datatypes information is not expanding by default (Yellow highlighted part in the image). I am required to expand the type information manually (light orange highlighted part in the image).

Can anyone comment on what additional configuration should be done so that the datatype information is visible/expanded by default.

enter image description here

my configuration of the open api is as below.

@Configuration
class SwaggerConfiguration {

  @Bean
  public OpenAPI openAPI() {
    return new OpenAPI()
        .info(
            new Info().title("Delta Gateway")
                .description("API service for delta-gateway to perform various operations over Products, Articles, Enrichment, Labels etc")
                .version("v0.0.1")
        )
        .externalDocs(
            new ExternalDocumentation()
                .description("ESL Gateway documentation")
                .url("https://docs.csnzoo.com/shared/abc/app/delta-gateway/")
        );
  }
}

My spring boot version is 3.1.3

1

There are 1 answers

0
cbot On BEST ANSWER

Below code worked -

@Configuration
class SwaggerConfiguration {

   private final SwaggerUiConfigParameters configParameters;
    
   public SwaggerConfiguration(SwaggerUiConfigParameters configParameters) {
        this.configParameters = configParameters;
        configureSwaggerUi();
   }

  public void configureSwaggerUi() {
        configParameters.setDefaultModelsExpandDepth(10);
  }

  @Bean
  public OpenAPI openAPI() {
    return new OpenAPI()
        .info(
            new Info().title("Delta Gateway")
                .description("API service for delta-gateway to perform various operations over Products, Articles, Enrichment, Labels etc")
                .version("v0.0.1")
        )
        .externalDocs(
            new ExternalDocumentation()
                .description("ESL Gateway documentation")
                .url("https://docs.csnzoo.com/shared/abc/app/delta-gateway/")
        );
  }
}