swagger-api / swagger-api/swagger-codegen
[JAVA] POJO descriptions - "The type generates a string that requires more than 65535 bytes to encode in Utf8 format in the constant pool"
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
In our documentation there is a description that is over 65kb long. It scans fine however when generating the POJOs the strings in annotations can only be up to 65kb.
Swagger-codegen version
CLI 3.0.27
Swagger declaration file content or url
....
description: string greater than 65kb
...
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i swagger.json -l java
Steps to reproduce
- Have a yaml file with a description field greater the 65kb
- Scan with codegen - java -jar swagger-codegen-cli.jar generate -i swagger.json -l java
- Client won't compile because "The type generates a string that requires more than 65535 bytes to encode in Utf8 format in the constant pool" for the following annotation
@Schema(required = true, description = "")
Related issues/PRs
Didn't find any
Suggest a fix/enhancement
The description should maybe be truncated when referenced in annotations
https://github.com/swagger-api/swagger-codegen/blob/751e59df060b1c3ecf54921e104f2086dfa9f820/modules/swagger-codegen/src/main/resources/JavaInflector/pojo.mustache#L43
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 modules/swagger-codegen/src/main/resources/JavaInflector/pojo.mustache at the referenced annotation line, then reproduce the issue with the provided CLI command and an OpenAPI description longer than 65kb. Confirm that generated Java POJOs no longer fail the 65535-byte constant-pool limit while preserving the description behavior for shorter values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100