Skip to content

Using OpenAPI 3.1 Causes Swagger-UI to Break #2037

@jblacker

Description

@jblacker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions