swagger-api / swagger-api/swagger-codegen

[JavaSpringBoot] Delegate Pattern - codegen generates invalid code

Open
#9,537 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Error in code generation:

The delegate class won't compile because the string in the default implementation is not escaped and terminated correctly:

error.java

if corrected manually it works:

working.java

json config file:
"delegatePattern": "true", "library": "spring-boot"

Swagger-codegen version

error occurs since 3.0.9 - 3.0.8 works without an issue

OpenAPI Version used: 3.0.2

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

Compare the linked error.java and working.java examples, then reproduce generation with delegatePattern enabled, library set to spring-boot, and OpenAPI 3.0.2 using versions 3.0.8 and 3.0.9. Trace the Spring Boot delegate template or generator path that produces the default implementation and confirm that the generated delegate compiles without manual edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend, tooling
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.