I am getting the error - "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 I paste the generated json from /api-docs to editor.swagger.io. I have some observations.
localhost:8080/v3/api-docs/ yields -
"{\"openapi\":\"3.0.1\", "\info\":{ ----------------
This json gives the mentioned error in editor.swagger.io.On manually removing the initial double quotes and escape character i.e.
{"openapi":"3.0.1", "info":{ ----------------
the error goes away i.e. UI is rendered without any issue.My project springboot version is 2.2.13.RELEASE, springdoc-openapi-ui version is 1.5.8, jackson-databind version is 2.10.5.1
OpenAPI config class -
@Configuration
public class Config1 {
@Bean
public GroupedOpenApi publicApi() {
return GroupedOpenApi.builder()
.group("user")
.pathsToMatch("/v1/**")
.build();
}
@Bean
public OpenAPI customOpenAPI() {
return new OpenAPI()
.info(new Info().title("title1").description("test").version("1.0.0"));
}
Please let me know if any further information is required from my end. Any inputs regarding the issue will be helpful. Thank you.