OpenAPITools / OpenAPITools/openapi-generator

Generated code shows list of controllers with -api-controller in swagger ui

Open
#6,819 0 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

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)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Swagger generated code shows list of controllers with -api-controller. The list has no functionality. The controllers have tags declared in yaml specification. It is possible not to show this list? I expect to see only the list of tags (not the controllers). The online swagger editor shows only the tags (not the list of controllers).

Related: https://stackoverflow.com/questions/50229661/how-to-remove-controller-list-from-swagger-ui

openapi-generator version

3.0.20

OpenAPI declaration file content or url

https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml

Command line used for generation

included with maven:

                    <configuration>
                        <!-- specify the swagger yaml -->
                        <inputSpec>${project.basedir}/src/main/resources/openapi.yml</inputSpec>
                        <!-- target to generate java client code -->
                        <language>spring</language>
                        <apiPackage>xxx.generated.server.api</apiPackage>
                        <modelPackage>xxx.generated.server.model</modelPackage>
                        <configOptions>
                            <delegatePattern>true</delegatePattern>
                        </configOptions>
                    </configuration>
Steps to reproduce

compile and run the generated code

Related issues/PRs

no

Suggest a fix

As in https://stackoverflow.com/questions/50229661/how-to-remove-controller-list-from-swagger-ui:

put @Api on the controller with relevant values fixes the issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated Spring server configuration in the Maven example and reproduce the issue using the linked OpenAPI petstore.yaml, then run the generated code and inspect its Swagger UI. Done means the UI shows the declared tags without the nonfunctional controller list ending in -api-controller.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring
Domain
api, backend, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.