Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8776
Closed
Open
Issue created Feb 20, 2021 by Administrator@rootContributor2 of 6 checklist items completed2/6 checklist items

[BUG] [spring] [server] 5.0.1 unused imports in generated interfaces

Created by: lfischer

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

https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml

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.

Assignee
Assign to
Time tracking