OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.35k stars 6.46k forks source link

[BUG] package io.swagger.v3.oas.annotations.media does not exist #16932

Open Haarolean opened 10 months ago

Haarolean commented 10 months ago

Bug Report Checklist

Description

Generating an example (pet store) with maven plugin produces the following exception: api/dto/ApiResponseDTO.java:[11,43] package io.swagger.v3.oas.annotations.media does not exist Additional (required, it seems?) dependencies for plugin are not listed in docs, so I believe it's a bug.

openapi-generator version

7.0.1 maven plugin

OpenAPI declaration file content or url

https://gist.github.com/Haarolean/8a9b07f74544c7e45d553ff33798ed8c (swagger petstore)

Generation Details

maven,

    <build>
        <plugins>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>7.0.1</version>
                <executions>
                    <execution>
                        <id>interfaces</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/src/main/resources/api.yaml</inputSpec>
                            <output>${project.build.directory}/generated-sources/api</output>
                            <generatorName>spring</generatorName>
                            <modelNameSuffix>DTO</modelNameSuffix>
                            <configOptions>
                                <modelPackage>lol.memelord.kapybro.api.dto</modelPackage>
                                <apiPackage>lol.memelord.kapybro.api.api</apiPackage>
                                <sourceFolder>test</sourceFolder>
                                <interfaceOnly>true</interfaceOnly>
                                <skipDefaultInterface>true</skipDefaultInterface>
                                <useBeanValidation>true</useBeanValidation>
                                <useTags>true</useTags>
                                <useSpringBoot3>true</useSpringBoot3>
                                <dateLibrary>java8</dateLibrary>
<!--                                <useOpenApiNullable>false</useOpenApiNullable>-->
<!--                                <openApiNullable>false</openApiNullable>-->
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
Steps to reproduce
  1. Build the spec
Related issues/PRs
Suggest a fix
wing328 commented 10 months ago

Additional (required, it seems?) dependencies for plugin are not listed in docs, so I believe it's a bug.

Does it work fine with the CLI instead?

aabdelli03 commented 6 months ago

@Haarolean i've got this issue when upgrading jdk11 to jdk17 with swagger-annotations version 1.6.9 How did you resolve this plllzzz

Haarolean commented 6 months ago

@aabdelli03 hey! I've fixed this by getting rid of OpenAPI 😄

aabdelli03 commented 6 months ago

@Haarolean oh i don't have that chance. I get this error only on jenkis but not in my local for all the generated classes from the swagger package io.swagger.v3.oas.annotations.media does not exist Does someone else resolved that problem pllz

gtsystem commented 2 months ago

Still happening in v7.7.0. Also it seems to be related to #11734

Zsupi commented 2 months ago

Could someone find a workaround or a fix for this issue?