I am migrating my project from swagger to springdoc openapi and seeing the following error when I use swagger-ui/index.html endpoint.
enter image description here
My POM file:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
Configurations:
@Bean
public GroupedOpenApi api() {
return GroupedOpenApi.builder().group("Test")
.packagesToScan("com.test")
.pathsToMatch("/api.*").build();
}
@Bean
public OpenAPI channelApiInfo() {
Contact contact = new Contact();
contact.setName("TestAPIs");
contact.setEmail("test.com");
return new OpenAPI()
.info(new Info().title("Test Service")
.description("This is a test service.")
.contact(contact));
}
Endpoint config:
@Operation(summary = "Test API", description = "This is a test api")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Success"),
@ApiResponse(responseCode = "400", description = "ID is invalid")})
public @ResponseBody ResponseEntity<Resource> getId(
@Parameter(description = IdDesc, required = true) @PathVariable final String id) {
//Implementation
}
New contributor