OpenAPITools / OpenAPITools/openapi-generator

[BUG][SPRING] Tag description generates interfaces that do not compile

Open
#12,657 0 comments 0 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)?
  • 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

Tags with description that contain a line break or quotes break the spring generator.

Details:
If you have a tag description with a line break or using quotes ("), it will break the generator due to this line

openapi-generator version

6.0.0

OpenAPI declaration file content or url

https://github.com/oscarfh/springgeneratorreproducer/blob/main/src/main/resources/openapi.yaml

Generation Details

run ./mvnw clean compile in the reproducer and see how the generated PetApi class does not compile. Or believe and see how the generated class does not compile due to the content of the tag description.

Steps to reproduce

1- Clone the reproducer
2- Run ./mvnw clean compile
3- See how it does not compile

Related issues/PRs
Suggest a fix

Undo this change

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 modules/openapi-generator/src/main/resources/JavaSpring/api.mustache and the linked OpenAPI declaration, then run ./mvnw clean compile in the springgeneratorreproducer. Compare the generated PetApi.java with the tag description containing a line break or quotes; done means the generated interface compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring
Domain
api, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.