Commit 74fe9a1
Adds @nullable annotation to Spring Boot generator (OpenAPITools#20345)
* Adds @nullable annotation to Spring Boot generator
* issue-14427: [REQ][spring] Null-Safety annotations
* issue-17382: [REQ] spring generator add Nullable annotations
Motivations:
* Have Spring Boot generator client properly annotated for nullability to be able to check code using them with tools like NullAway
* As it is related to Spring then the `org.springframework.lang.Nullable` annotation was chosen to avoid discussion which `@Nullable` one is true one
* `@NonNull` wasn't used as I didn't see much benefit of it. Anyhow, an empty constructor and/or setters allow to put a `null` value there
Modifications:
* Adds nullableAnnotation template to handle nullability annotation on vars
* Adjust pojo templates to use the nullability template
* Adapts tests
Modifications:
* Runs export_docs_generator.sh script to update samples
* samples update
* excludes Spring @nullable from java-camel
* ones with defaults shouldn't be annotated as @nullable
* updates samples
* adds AllArgConstructor generation tests
* adds container tests1 parent 1daab3a commit 74fe9a1
File tree
1,181 files changed
+4056
-2671
lines changed- modules/openapi-generator/src
- main
- java/org/openapitools/codegen/languages
- resources/JavaSpring
- test
- java/org/openapitools/codegen/java
- assertions
- spring
- resources/3_0
- samples
- client/petstore
- spring-cloud-date-time/src/main/java/org/openapitools/model
- spring-cloud-deprecated/src/main/java/org/openapitools/model
- spring-cloud-feign-without-url/src/main/java/org/openapitools/model
- spring-cloud-tags/src/main/java/org/openapitools/model
- spring-cloud/src/main/java/org/openapitools/model
- spring-http-interface-noResponseEntity/src/main/java/org/openapitools/model
- spring-http-interface-reactive-noResponseEntity/src/main/java/org/openapitools/model
- spring-http-interface-reactive/src/main/java/org/openapitools/model
- spring-http-interface/src/main/java/org/openapitools/model
- openapi3
- client/petstore
- spring-cloud-3-with-optional/src/main/java/org/openapitools/model
- spring-cloud-3/src/main/java/org/openapitools/model
- spring-cloud-async/src/main/java/org/openapitools/model
- spring-cloud-date-time/src/main/java/org/openapitools/model
- spring-cloud-http-basic/src/main/java/org/openapitools/model
- spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model
- spring-cloud-spring-pageable/src/main/java/org/openapitools/model
- spring-cloud/src/main/java/org/openapitools/model
- spring-stubs-skip-default-interface/src/main/java/org/openapitools/model
- spring-stubs/src/main/java/org/openapitools/model
- server/petstore
- spring-boot-oneof/src/main/java/org/openapitools/model
- spring-boot-springdoc/src/main/java/org/openapitools/model
- springboot-3/src/main/java/org/openapitools/model
- springboot-delegate/src/main/java/org/openapitools/model
- springboot-implicitHeaders/src/main/java/org/openapitools/model
- springboot-source/src/main/java/org/openapitools/model
- springboot/src/main/java/org/openapitools/model
- server/petstore
- spring-boot-defaultInterface-unhandledException/src/main/java/org/openapitools/model
- spring-boot-nullable-set/src/main/java/org/openapitools/model
- springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model
- springboot-beanvalidation/src/main/java/org/openapitools/model
- springboot-delegate-j8/src/main/java/org/openapitools/model
- springboot-delegate-no-response-entity/src/main/java/org/openapitools/model
- springboot-delegate/src/main/java/org/openapitools/model
- springboot-implicitHeaders-annotationLibrary/src/main/java/org/openapitools/model
- springboot-implicitHeaders/src/main/java/org/openapitools/model
- springboot-lombok-data/src/main/java/org/openapitools/model
- springboot-lombok-tostring/src/main/java/org/openapitools/model
- springboot-reactive-noResponseEntity/src/main/java/org/openapitools/model
- springboot-reactive/src/main/java/org/openapitools/model
- springboot-spring-pageable-delegatePattern-without-j8/src/main/java/org/openapitools/model
- springboot-spring-pageable-delegatePattern/src/main/java/org/openapitools/model
- springboot-spring-pageable-without-j8/src/main/java/org/openapitools/model
- springboot-spring-pageable/src/main/java/org/openapitools/model
- springboot-spring-provide-args/src/main/java/org/openapitools/model
- springboot-useoptional/src/main/java/org/openapitools/model
- springboot-virtualan/src/main/java/org/openapitools/virtualan/model
- springboot/src/main/java/org/openapitools/model
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
1,181 files changed
+4056
-2671
lines changedLines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
| 449 | + | |
449 | 450 | | |
450 | 451 | | |
451 | 452 | | |
| |||
952 | 953 | | |
953 | 954 | | |
954 | 955 | | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
955 | 961 | | |
956 | 962 | | |
957 | 963 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
33 | 47 | | |
Lines changed: 156 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4893 | 4893 | | |
4894 | 4894 | | |
4895 | 4895 | | |
4896 | | - | |
| 4896 | + | |
4897 | 4897 | | |
4898 | | - | |
| 4898 | + | |
4899 | 4899 | | |
4900 | | - | |
| 4900 | + | |
4901 | 4901 | | |
4902 | 4902 | | |
4903 | | - | |
| 4903 | + | |
4904 | 4904 | | |
4905 | 4905 | | |
4906 | 4906 | | |
| |||
5099 | 5099 | | |
5100 | 5100 | | |
5101 | 5101 | | |
| 5102 | + | |
| 5103 | + | |
| 5104 | + | |
| 5105 | + | |
| 5106 | + | |
| 5107 | + | |
| 5108 | + | |
| 5109 | + | |
| 5110 | + | |
| 5111 | + | |
| 5112 | + | |
| 5113 | + | |
| 5114 | + | |
| 5115 | + | |
| 5116 | + | |
| 5117 | + | |
| 5118 | + | |
| 5119 | + | |
| 5120 | + | |
| 5121 | + | |
| 5122 | + | |
| 5123 | + | |
| 5124 | + | |
| 5125 | + | |
| 5126 | + | |
| 5127 | + | |
| 5128 | + | |
| 5129 | + | |
| 5130 | + | |
| 5131 | + | |
| 5132 | + | |
| 5133 | + | |
| 5134 | + | |
| 5135 | + | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
| 5139 | + | |
| 5140 | + | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
| 5146 | + | |
| 5147 | + | |
| 5148 | + | |
| 5149 | + | |
| 5150 | + | |
| 5151 | + | |
| 5152 | + | |
| 5153 | + | |
| 5154 | + | |
| 5155 | + | |
| 5156 | + | |
| 5157 | + | |
| 5158 | + | |
| 5159 | + | |
| 5160 | + | |
| 5161 | + | |
| 5162 | + | |
| 5163 | + | |
| 5164 | + | |
| 5165 | + | |
| 5166 | + | |
| 5167 | + | |
| 5168 | + | |
| 5169 | + | |
| 5170 | + | |
| 5171 | + | |
| 5172 | + | |
| 5173 | + | |
| 5174 | + | |
| 5175 | + | |
| 5176 | + | |
| 5177 | + | |
| 5178 | + | |
| 5179 | + | |
| 5180 | + | |
| 5181 | + | |
| 5182 | + | |
| 5183 | + | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
| 5188 | + | |
| 5189 | + | |
| 5190 | + | |
| 5191 | + | |
| 5192 | + | |
| 5193 | + | |
| 5194 | + | |
| 5195 | + | |
| 5196 | + | |
| 5197 | + | |
| 5198 | + | |
| 5199 | + | |
| 5200 | + | |
| 5201 | + | |
| 5202 | + | |
| 5203 | + | |
| 5204 | + | |
| 5205 | + | |
| 5206 | + | |
| 5207 | + | |
| 5208 | + | |
| 5209 | + | |
| 5210 | + | |
| 5211 | + | |
| 5212 | + | |
| 5213 | + | |
| 5214 | + | |
| 5215 | + | |
| 5216 | + | |
| 5217 | + | |
| 5218 | + | |
| 5219 | + | |
| 5220 | + | |
| 5221 | + | |
| 5222 | + | |
| 5223 | + | |
| 5224 | + | |
| 5225 | + | |
| 5226 | + | |
| 5227 | + | |
| 5228 | + | |
| 5229 | + | |
| 5230 | + | |
| 5231 | + | |
| 5232 | + | |
| 5233 | + | |
| 5234 | + | |
| 5235 | + | |
| 5236 | + | |
| 5237 | + | |
| 5238 | + | |
| 5239 | + | |
| 5240 | + | |
| 5241 | + | |
| 5242 | + | |
| 5243 | + | |
| 5244 | + | |
| 5245 | + | |
| 5246 | + | |
| 5247 | + | |
| 5248 | + | |
| 5249 | + | |
| 5250 | + | |
| 5251 | + | |
| 5252 | + | |
| 5253 | + | |
5102 | 5254 | | |
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Category.java
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
30 | 31 | | |
31 | | - | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
| 31 | + | |
31 | 32 | | |
32 | | - | |
| 33 | + | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
0 commit comments