Openapi-generator: [BUG] Spring generator uses old Swagger dependency

Created on 23 Oct 2019  路  5Comments  路  Source: OpenAPITools/openapi-generator

Description

I'm using openapi-generator-maven-plugin 4.1.3 and the spring generator uses an old swagger dependency.

expected:

        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>2.0.10</version>
        </dependency>

actual:

        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>1.5.23</version>
        </dependency>

And the generated code uses import io.swagger.annotations.*
instead of import io.swagger.v3.oas.annotations.*

Bug

Most helpful comment

Any idea on when this will be fixed?

Currently, generating code from an OAP3 spec leaves you no other option than to expose a Swagger 2 spec.

All 5 comments

@dkirrane yes, we've not yet updated the annotation with io.swagger.v3.oas.annotations

Is that something you can help us with a PR?

Would you want to still have the possibility to generate 'old' code, or do you want to replace it with the newer version?
Additionally, springfox isn't really maintained anymore, so a transistion to e. g. springdoc would make sense.

My take is to replace it with the newer version. If users want the older version, they can use an old version of OpenAPI Generator for that.

Any idea on when this will be fixed?

Currently, generating code from an OAP3 spec leaves you no other option than to expose a Swagger 2 spec.

Currently, generating code from an OAP3 spec leaves you no other option than to expose a Swagger 2 spec.

This is not due to the annotations. You can perfectly generate an OAS3 from old swagger annotations. The fact that a Swagger2 spec is exposed comes from the lib used to generate it (probably springfox v2 ?). You can upgrade to Springfox v3 which supports generating OAS3 specs.

Was this page helpful?
0 / 5 - 0 ratings