Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unused JsonNullable imports #16931

Open
4 of 5 tasks
Haarolean opened this issue Oct 28, 2023 · 1 comment
Open
4 of 5 tasks

[BUG] Unused JsonNullable imports #16931

Haarolean opened this issue Oct 28, 2023 · 1 comment

Comments

@Haarolean
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • [] Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

An import import org.openapitools.jackson.nullable.JsonNullable; is being added to DTOs despite they're never used.
It's solvable by adding <openApiNullable>false</openApiNullable> config property but I believe the import shouldn't be there if it's unused.

openapi-generator version

7.0.1. Might be a regression of #2901

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

#2901

Suggest a fix
@wing328
Copy link
Member

wing328 commented Oct 29, 2023

It's solvable by adding false config property but I believe the import shouldn't be there if it's unused.

@Haarolean right. Do you mind contributing a PR to remove the import when openApiNullableis is disabled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants