cancel
Showing results for 
Search instead for 
Did you mean: 

Why does SpringOpenApi3.0 still need io.swagger.models dependency?

SOLVED
Highlighted
Occasional Contributor

Why does SpringOpenApi3.0 still need io.swagger.models dependency?

Project current dependencies

io\swagger\core\v3\swagger-models\2.1.2\swagger-models-2.1.2.pom

io\swagger\core\v3\swagger-annotations\2.1.2\swagger-annotations-2.1.2.pom

 

Use OpenApi3.0 annotations, do you still need

io/swagger/models/Swagger: Is the 1.5.X version of the dependency package?

In the Maven warehouse (https://mvnrepository.com/artifact/io.swagger/swagger-models), you can see that it is migrated to the new warehouse location

 

Note: This artifact was moved to:

io.swagger.core.v3 » swagger-models

 

 

So, I want to ask io\swagger\core\v3\swagger-models\2.1.2 Is the dependency package not the migration optimized version of io.swagger:swagger-models: 1.6.2? Why rely on the predecessor of models? swagger -annotation problem is the same

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Staff

Re: Why does SpringOpenApi3.0 still need io.swagger.models dependency?

Your question seems to be related to an external project (springfox); please report this issue/question there

View solution in original post

4 REPLIES 4
Highlighted
Occasional Contributor

Re: Why does SpringOpenApi3.0 still need io.swagger.models dependency?

星小梦_0-1602469463508.png

So, why does the 2.1.5 version need to depend on the 1.6.2 version?

Highlighted
Occasional Contributor

Re: Why does SpringOpenApi3.0 still need io.swagger.models dependency?

This is my swagger related dependency

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<artifactId>swagger-models</artifactId>
<groupId>io.swagger</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-common</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>

Exception information

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'openApiControllerWebMvc' defined in URL [jar:file:/E:/Develop/Maven/Repository/io/springfox/springfox-oas/3.0.0/springfox-oas-3.0.0.jar!/springfox/documentation/oas/web/OpenApiControllerWebMvc.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jsonSerializer' defined in springfox.documentation.spring.web.SpringfoxWebConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.spring.web.json.JsonSerializer]: Factory method 'jsonSerializer' threw exception; nested exception is java.lang.NoClassDefFoundError: io/swagger/models/Swagger
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:797) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:227) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1356) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1203) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556) ~[spring-beans-5.2.8.RELEASE.jar:5.2.8.RELEASE]

Highlighted
Occasional Contributor

Re: Why does SpringOpenApi3.0 still need io.swagger.models dependency?

Why is the annotation @Schema of swagger2.0 (OpenApi3.0 specification) added to the model data field, no description information is output, and it cannot be hidden, and other annotations have attributes that do not work? This is because swagger2.0 is not perfect? Currently in the testing and development stage?

Highlighted
Staff

Re: Why does SpringOpenApi3.0 still need io.swagger.models dependency?

Your question seems to be related to an external project (springfox); please report this issue/question there

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors