Forum Discussion

星小梦's avatar
星小梦
Occasional Contributor
5 years ago

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

  • frantuma's avatar
    frantuma
    5 years ago

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

  • 星小梦's avatar
    星小梦
    Occasional Contributor

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

  • 星小梦's avatar
    星小梦
    Occasional Contributor

    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]

  • 星小梦's avatar
    星小梦
    Occasional Contributor

    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?

    • frantuma's avatar
      frantuma
      Staff

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