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"

Open
#11,136 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

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
  1. Have a yaml file with a description field greater the 65kb
  2. Scan with codegen - java -jar swagger-codegen-cli.jar generate -i swagger.json -l java
  3. 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

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/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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.