OpenAPITools / OpenAPITools/openapi-generator
[REQ] Spring: Add option to disable creating toString()-Method
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Currently, the POJO always contains a toString()-Method containing all fields.
This can be a problem if the POJO is logged and contains sensitive data.
I suggest a configuration-parameter "excludeToString" so that the toString method is not generated anymore.
As Lombok is widely used it's often the preferred way to generate this method:
- Setting configuration
additionalModelTypeAnnotations = @lombok.ToString - Setting
x-field-extra-annotation: ""@lombok.ToString.Include"/ "@lombok.ToString.Exclude"in API.yaml
Of course I can customize the mustache template and use this but I think this feature might be useful for quite a lot of people.
I'd happily contribute this feature as PR.
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
The issue names the Spring generator and the excludeToString configuration parameter, but no files or tests. Start by tracing Spring model generation and configuration handling; done means the option suppresses toString generation while existing default behavior remains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- backend, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100