Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQ] Improvment additionalModelTypeAnnotations #7032

Closed
UnleashSpirit opened this issue Jul 23, 2020 · 0 comments · Fixed by #8269
Closed

[REQ] Improvment additionalModelTypeAnnotations #7032

UnleashSpirit opened this issue Jul 23, 2020 · 0 comments · Fixed by #8269

Comments

@UnleashSpirit
Copy link
Contributor

UnleashSpirit commented Jul 23, 2020

Is your feature request related to a problem? Please describe.

Not really, there is a "workaround"
I need multiple model annotations but the additionalModelTypeAnnotations is not really clear
If you want multiple you need either to write all of them oneline or one by line which result in lot of useleff blank space (ok not a big deal)

Exemples

Using

<additionalModelTypeAnnotations>
	@lombok.Builder
	@lombok.NoArgsConstructor
	@lombok.AllArgsConstructor
</additionalModelTypeAnnotations>

Result in

									@lombok.Builder
									@lombok.NoArgsConstructor
									@lombok.AllArgsConstructor

public class xxxDTO   {

Yes there is a lots of spaces


Using

<additionalModelTypeAnnotations>@lombok.Builder @lombok.NoArgsConstructor @lombok.AllArgsConstructor</additionalModelTypeAnnotations>

Result in

@lombok.Builder @lombok.NoArgsConstructor @lombok.AllArgsConstructor

public class xxxDTO   {

Better but with long annotation like, @com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.ALWAYS) not really good

Describe the solution you'd like

Something like :

<additionalModelTypeAnnotations>
	<additionalModelTypeAnnotation>@lombok.Builder</additionalModelTypeAnnotation>
	<additionalModelTypeAnnotation>@lombok.NoArgsConstructor</additionalModelTypeAnnotation>
	<additionalModelTypeAnnotation>@lombok.AllArgsConstructor</additionalModelTypeAnnotation>
</additionalModelTypeAnnotations>

Hoping result

@lombok.Builder
@lombok.NoArgsConstructor
@lombok.AllArgsConstructor

public class xxxDTO   {

Describe alternatives you've considered

I try using comma but they are kept in generated sources so complitation fails
Multiple , only the last one is generated

Additional context

I used lombok exemple but it's more general
generatorName : spring

UnleashSpirit added a commit to UnleashSpirit/openapi-generator that referenced this issue Aug 17, 2021
Split by ';' and/or newline
Trim value

fix: OpenAPITools#7032

Run ./bin/generate-samples.sh to regenerate model files

Revert "Run ./bin/generate-samples.sh to regenerate model files"

This reverts commit da509c39f363da046fbd457e1ab67ef0f62f3561.

refector: remove unnecessary import

test: multiples tests for AdditionalModelTypeAnnotations

Add a getter to test the list

refactor: remove duplicate AdditionalModelTypeAnnotations

Without using Set to avoid any side effect somewhere, I use stream and
distinct to avoid duplicates

refactor: using Set instead of stream

Remove stream distinct for performance reason, use newHashSet
Keep AdditionalModelTypeAnnotations as List

doc: update info additionalModelTypeAnnotations

refactor: move doc in code for autogen

style: tab in java class

doc: run ensure-up-to-date

refactor: add imports lost in rebase

docs: regenerate docs

docs: update
wing328 pushed a commit that referenced this issue Aug 17, 2021
…8269)

* refactor: improve additionalModelTypeAnnotations generation

Split by ';' and/or newline
Trim value

fix: #7032

Run ./bin/generate-samples.sh to regenerate model files

Revert "Run ./bin/generate-samples.sh to regenerate model files"

This reverts commit da509c39f363da046fbd457e1ab67ef0f62f3561.

refector: remove unnecessary import

test: multiples tests for AdditionalModelTypeAnnotations

Add a getter to test the list

refactor: remove duplicate AdditionalModelTypeAnnotations

Without using Set to avoid any side effect somewhere, I use stream and
distinct to avoid duplicates

refactor: using Set instead of stream

Remove stream distinct for performance reason, use newHashSet
Keep AdditionalModelTypeAnnotations as List

doc: update info additionalModelTypeAnnotations

refactor: move doc in code for autogen

style: tab in java class

doc: run ensure-up-to-date

refactor: add imports lost in rebase

docs: regenerate docs

docs: update

* fix: docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant