question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUESTION][JAVA] Is support for swagger UI 3.0 present?

See original GitHub issue
Description

Hello, I noticed that when I generate the code the generated Swagger UI Configuration class in OpenAPIDocumentationConfig.java has annotation @EnableSwagger2. And at the same time I couldn’t find how to remove this annotation since springfox which works with swagger 3.0 requires this annotation to be removed.

My question is swagger UI 3.0 supported, is there a configuration to switch this as the generator also generates the UI (please correct me if I am wrong) along with the clients for the API?

openapi-generator version

5.0.1

OpenAPI declaration file content or url

Its valid I just want the generated UI to be swagger 3.0 and not swagger 2.0

Command line used for generation

java -jar $SCRIPTDIR/openapi-generator-cli.jar generate --generator-name spring --config $SCRIPTDIR/config-spring.json --output ./model -i ./api.yaml

Steps to reproduce

N/A

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/5803 https://github.com/OpenAPITools/openapi-generator/issues/6108

Suggest a fix/enhancement

Not really familiar with the codebase of this project so I was not able to find how the OpenAPIDocumentationConfig.java is generated. But I suppose if a flag is added with the swagger ui version to the cli the file can be generated properly as per https://github.com/springfox/springfox/blob/master/README.md#spring-boot-applications

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
jojyccommented, Nov 17, 2021

Does anyone have any working solution for this issue? I am using Springboot 2.5.6 and OpenApi Generator 5.3.0

1reaction
DamasFouxcommented, Nov 22, 2021

Hey, Is there a solution to this problem? The generator generates code which uses RelativePathProvider and EnableSwagger2 and both are deprecated by new springfox versions.

we are using:

<plugin>
        <groupId>org.openapitools</groupId>
        <artifactId>openapi-generator-maven-plugin</artifactId>
        <version>5.3.0</version>
</plugin>

springfox dependency:

 <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-boot-starter</artifactId>
      <version>3.0.0</version>
    </dependency>
    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger-ui</artifactId>
      <version>3.0.0</version>
    </dependency>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Springfox swagger-ui 3.0.0 does not bring up ... - Stack Overflow
I tried upgrading to springfox-swagger-ui 3.0.0 but that does not even bring up the swagger-ui page. Is there any way to get the...
Read more >
Setting up Swagger 3 With Spring Boot - Medium
So let's jump right in to the simple steps: Adding dependencies. Add the 3rd version springfox-boot-starter and springfox-swagger-ui to pom.xml ...
Read more >
Springfox Reference Documentation - GitHub Pages
In this scenario, Springfox will not correctly generate and expose the Swagger UI endpoint ( /swagger-ui.html ) if @EnableWebMvc is present in ...
Read more >
OpenAPI 3 Library for spring-boot
This library supports: OpenAPI 3. Spring-boot (v1, v2 and v3). JSR-303, specifically for @NotNull, @Min, @Max, and @Size. Swagger-ui.
Read more >
Using OpenAPI and Swagger UI - Quarkus
Quarkus also supports alternative OpenAPI document paths if you prefer. openapi: 3.0.1 info: title: Static ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found