Closed
Description
Describe the bug
Swagger UI page complains about rendering the definition, shows error on page saying:
http://localhost:8080/swagger-ui/index.html
Unable to render this definition
The provided definition does not specify a valid version field.
Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0).
when running the Spring Boot Maven plugin:
$ mvn clean spring-boot:run
To Reproduce
Steps to reproduce the behavior:
- What version of spring-boot you are using?
Using Spring Boot 2.6:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.14</version>
<!-- # lookup parent from repository -->
<relativePath />
</parent>
- What modules and versions of springdoc-openapi are you using?
Using SpringDoc 1.6:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.15</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-security</artifactId>
<version>1.6.15</version>
</dependency>
- How are you running the application?
Run using the Spring Boot Maven plugin:
$ mvn clean spring-boot:run
Expected behavior
Swagger UI does not throw error
Additional context
Config:
springdoc:
writer-with-default-pretty-printer: true
api-docs:
enabled: true
version: "openapi_3_0"
swagger-ui:
enabled: true
operations-sorter: "method"
tags-sorter: "alpha"
display-request-duration: true
Using custom HTTP message converters:
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
messageConverters.add(new StringHttpMessageConverter());
messageConverters.add(new MappingJackson2HttpMessageConverter(JsonUtils.createObjectMapper()));
}
Unable to see JSON spec at:
http://localhost:8080/v3/api-docs
only shows some kind of Base64 output (not JSON)