OpenAPITools / OpenAPITools/openapi-generator
[BUG][JavaSpring] Not wanted automatic inserted tags if there're ones in OpenAPI definition
Nobody has claimed this yet.
- 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)?
- 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
From the openapi definition (see below) when I open it in the online editor https://editor.swagger.io/ I get the following swagger-ui page. Only the tags present in the definition appear.
When I use the JavaSpring generator with the same openapi definition, the generated java interface contains @Tag annotation on the generated interface deduced from endpoint path, with automatic generated description value.
And the swagger-ui page display it in addition to the one already present in the definition.
I don't want the generated tag because I define mine directly in the definition.
I don't found an option (in the documentation nor in the api.mustashe) to avoid this generation.
openapi-generator version
v5.4.0
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: API example
version: "1.0.0"
description: "OpenAPI definition to illustrate the issue xxx"
tags:
- name: authentication
description: "All API concerning authentification."
paths:
/auth/login:
get:
tags:
- authentication
summary: API for login
operationId: authLogin
security: []
parameters: []
responses:
'200':
description: "OK"
content:
text/html:
schema:
type: string
'401':
description: "Unauthorized"
content:
text/html:
schema:
type: string
Generation Details
The genererated interface contains :
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "auth", description = "the auth API")
public interface AuthApi {
[...]
/**
* GET /auth/login : API for login
*
*/
@Operation(
operationId = "authLogin",
summary = "API for login",
tags = { "authentication" },
[...]
Steps to reproduce
Clear
Related issues/PRs
Clear
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the JavaSpring generator and its api.mustache template, then compare the generated interface's inferred @Tag with the OpenAPI definition's declared tags. Reproduce the example using the supplied YAML and confirm that generation no longer adds an unwanted tag when the definition already provides one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100