Skip to content

Commit 88de21d

Browse files
wilxjohnyherangi
andauthored
fix: normalize Java annotation vendor extension lists (#24171)
* support x-class-extra-annotation annotation lists in java codegen * follow existing pattern for dealing with extensions that support single and multiple values * extract logic to normalizeVendorExtensionWithStringList * refactor: share vendor extension list normalization * fix: normalize java annotation vendor extensions * test: cover java annotation extension lists * docs: clarify annotation vendor extension values * docs: add vendor extension normalization javadocs --------- Co-authored-by: Johny Herangi <johnyherangi@gmail.com>
1 parent abe6607 commit 88de21d

62 files changed

Lines changed: 306 additions & 96 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/generators/groovy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
8282
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
8383
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
8484
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
85-
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
86-
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
85+
|x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null
86+
|x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null
8787

8888

8989
## IMPORT MAPPING

docs/generators/java-camel.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
143143
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
144144
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
145145
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
146-
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
147-
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
148-
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
146+
|x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null
147+
|x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null
148+
|x-operation-extra-annotation|Custom annotation(s) to be added to operation; accepts a string or list of strings|OPERATION|null
149149
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object. Only applies when `library=spring-boot`; ignored for client libraries (spring-cloud, spring-declarative-http-interface).|OPERATION|false
150150
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
151151
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null

docs/generators/java-dubbo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
9595
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
9696
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
9797
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
98-
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
99-
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
98+
|x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null
99+
|x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null
100100

101101

102102
## IMPORT MAPPING

docs/generators/java-helidon-client.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
8181
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
8282
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
8383
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
84-
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
85-
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
84+
|x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null
85+
|x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null
8686
|x-webclient-blocking|Specifies if method for specific operation should be blocking or non-blocking(ex: return `Mono<T>/Flux<T>` or `return T/List<T>/Set<T>` & execute `.block()` inside generated method)|OPERATION|false
8787

8888

docs/generators/java-helidon-server.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
8484
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
8585
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
8686
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
87-
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
88-
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
87+
|x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null
88+
|x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null
8989

9090

9191
## IMPORT MAPPING

docs/generators/java-inflector.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
8484
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
8585
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
8686
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
87-
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
88-
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
87+
|x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null
88+
|x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null
8989

9090

9191
## IMPORT MAPPING

docs/generators/java-micronaut-client.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
105105
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
106106
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
107107
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
108-
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
109-
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
108+
|x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null
109+
|x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null
110110

111111

112112
## IMPORT MAPPING

docs/generators/java-micronaut-server.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
104104
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
105105
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
106106
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
107-
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
108-
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
107+
|x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null
108+
|x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null
109109

110110

111111
## IMPORT MAPPING

docs/generators/java-microprofile.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
127127
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
128128
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
129129
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
130-
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
131-
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
130+
|x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null
131+
|x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null
132132
|x-webclient-blocking|Specifies if method for specific operation should be blocking or non-blocking(ex: return `Mono<T>/Flux<T>` or `return T/List<T>/Set<T>` & execute `.block()` inside generated method)|OPERATION|false
133133

134134

docs/generators/java-msf4j.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
9090
|x-tags|Specify multiple swagger tags for operation|OPERATION|null
9191
|x-accepts|Specify custom value for 'Accept' header for operation|OPERATION|null
9292
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
93-
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
94-
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
93+
|x-class-extra-annotation|Custom annotation(s) to be added to model; accepts a string or list of strings|MODEL|null
94+
|x-field-extra-annotation|Custom annotation(s) to be added to property; accepts a string or list of strings|FIELD, OPERATION_PARAMETER|null
9595

9696

9797
## IMPORT MAPPING

0 commit comments

Comments
 (0)