Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using OpenAPI 3.1 Causes Swagger-UI to Break #2037

Closed
jblacker opened this issue Jan 12, 2023 · 1 comment
Closed

Using OpenAPI 3.1 Causes Swagger-UI to Break #2037

jblacker opened this issue Jan 12, 2023 · 1 comment
Labels
invalid This doesn't seem right

Comments

@jblacker
Copy link

Describe the bug

Using the v2.x branch of SpringDoc-OpenAPI with Spring Boot 3.0 and Webflux with the Kotlin language and setting the open-api version to 3.1 causes the Swagger-UI to break by displaying the following error message:

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)."

Setting the value of springdoc.api-docs.version back to OPENAPI_3_0 resolves the issue, but obviously utilizes the OpenAPI 3.0 version of the spec instead of 3.1.

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using? 3.0.0
  • What modules and versions of springdoc-openapi are you using? org.springdoc:springdoc-openapi-starter-common & org.springdoc:springdoc-openapi-starter-webflux-ui both on version 2.0.1
  • What is the actual and the expected result using OpenAPI Description (yml or json)? JSON
  • Provide with a sample code (HelloController) or Test that reproduces the problem

Using the configuration specified above simply set springdoc.api-docs.version=OPENAPI_3_1 in the application.properties file (or application.yml, I've tested in both ways)

Expected behavior

  • A clear and concise description of what you expected to happen. The SwaggerUI is expected to be displayed with the info specified in the OpenAPI JSON file.
  • What is the expected result using OpenAPI Description (yml or json)? JSON -- The actual OpenAPI json file generates without an issue.

Screenshots
If applicable, add screenshots to help explain your problem.
With OpenAPI version property set to 3.1
image

After resetting property back to 3.0
image

Additional context

Full application spec:

  • Kotlin 1.7 targeting JVM
  • Spring Boot 3.0.0
  • Kotlin Spring Plugin
  • Gradle build w/ Kotlin DSL
  • Spring Boot Modules: actuator, data-jdbc, security, validation, webflux, log4j2
  • Here's my import of the libraries:
implementation(platform("org.springdoc:springdoc-openapi:2.0.2"))
implementation("org.springdoc:springdoc-openapi-starter-common")
implementation("org.springdoc:springdoc-openapi-starter-webflux-ui")
@bnasslahsen bnasslahsen added the invalid This doesn't seem right label Feb 5, 2023
@bnasslahsen
Copy link
Contributor

@jblacker,

This is swagger-ui enhancement and not springdoc-openapi.
see swagger-api/swagger-ui#5891

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants