OpenAPITools / OpenAPITools/openapi-generator
[REQ] Feature Request Description
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
Currently it is possible to add annotations to fields via the x-field-extra-annotation attribute to a mode in the jaxrs-jersey generator
For example, when the following is added to a model:
x-field-extra-annotation: "@JsonDeserialize(using = LocalDateTimeDeserializer.class),
\n @JsonSerialize(using = LocalDateTimeSerializer.class),
\n @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = \"yyyy-MM-dd HH:mm:ss\")"
Two issues I have with this:
- New line escape sequence format must be explicitly applied so that multiple annotations appear on separate lines (see example above), otherwise the annotations are all on the one line.
- There is currently no way to specify the accompanying imports for the specified annotations.
Describe the solution you'd like
It would be nice to be able to
- Specify accompanying imports for the extra annotations.
- Have the list of imports appear on separate lines without having to add formatting.
Describe alternatives you've considered
To solve the issue with the annotations appearing on the same line I've had to add newline escape sequences plus 2 spaces so as to alight and format the annotations correctly.
For the imports, the only solution is to open the file and manually add the imports. I have found nothing in the generator documentation that might hint at a solution for this.
Additional context
Right now, I can see no other way than to edit the file(s) after generation, in order to bring in the additional imports which, in the end, mangles the idempotency of generated code.
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 by locating the jaxrs-jersey generator handling for x-field-extra-annotation and read the related generator documentation or tests. The work is complete when extra annotations can specify their imports and generated annotations and imports are formatted on separate lines without manual edits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100