OpenAPITools / OpenAPITools/openapi-generator
Consider limiting message size for exceptions thrown from DefaultGenerator.processOperation
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
I was given a large 40 000 line spec with a few hundred operations, where a single operation had a query parameter with empty name. Naturally, the generator threw.
Trying to be helpful, the exception message contains the entire schema. For a 40 000 line spec, that schema is massive. It completely overruns my console, losing the actual error information in the process.
Suggestion: Put a limit on the schema length when constructing the exception message. Take the first 10000 chars of the schema or something. Or maybe reorder the message and put the schemas first such that when the message gets cut off, the short descriptors (operation name, tag, resource) remain available
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 at modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java around line 1603, where DefaultGenerator.processOperation constructs the exception message. Reproduce the failure with a large OpenAPI specification and an operation whose query parameter has an empty name. Done means the exception no longer overwhelms console output while retaining useful operation details such as the operation name, tag, or resource.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100