swagger-api / swagger-parser

Swagger Spec to Java POJOs
http://swagger.io
Apache License 2.0
774 stars 526 forks source link

V2 converter depends on javax not jakarta packages #1981

Open dsyer opened 9 months ago

dsyer commented 9 months ago

If you try to use the converter in a modern Jakarta-packaged application you get problems with duplicate classes in swagger-core and swagger-annotations. The workaround is to exclude them and depend explicitly on the jakarta-based versions, e.g:

        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-core-jakarta</artifactId>
            <version>2.2.9</version>
        </dependency>
        <dependency>
            <groupId>io.swagger.parser.v3</groupId>
            <artifactId>swagger-parser-v2-converter</artifactId>
            <version>2.1.16</version>
            <exclusions>
                <exclusion>
                    <groupId>io.swagger.core.v3</groupId>
                    <artifactId>swagger-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.swagger.core.v3</groupId>
                    <artifactId>swagger-models</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

This is kind of annoying, even though it's a problem that is created by the core libraries. It seems we need to have a "-jakarta" version of the converter library too?

davsclaus commented 4 months ago

Yes we hit that too with Apache Camel. We have to so many exclusions as you say etc. And we can only do this for our own maven modules. But our end user of Camel may bring in their own set, such as jackson-databind that bring in old swagger JARs and whatelse.