Open
Description
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
Generated API interfaces contain the following unused imports, which introduce unnecessary dependencies:
import org.springframework.data.domain.Pageable;
import springfox.documentation.annotations.ApiIgnore;
openapi-generator version
5.0.1
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
file "springboot-options.json"
{
"basePackage":"io.swagger",
"configPackage":"io.swagger.config",
"parentGroupId":"org.springframework.boot",
"parentArtifactId":"spring-boot-starter-parent",
"parentVersion":"2.4.3",
"serverPort":9230,
"dateLibrary":"java8"
}
command line
java -jar ./openapi-generator-cli-5.0.1.jar generate -g spring -i petstore.yaml -o server\springboot\openapi -c springboot-options.json
Example: imports within generated file UserApi
package org.openapitools.api;
import java.util.List;
import org.openapitools.model.User;
import io.swagger.annotations.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
Related issues/PRs
Suggest a fix
Remove imports of springfox.documentation.annotations.ApiIgnore
and data.domain.Pageable
within the api interfaces, as they are not used and not needed.