Skip to content

Commit e7c2d4d

Browse files
committed
issue-20804: Add nullability annotations to Java generated clients
Motivation: Be able to use generated clients in code checked by tools like NullAway.
1 parent daf3d64 commit e7c2d4d

File tree

214 files changed

+4422
-4331
lines changed

Some content is hidden

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

214 files changed

+4422
-4331
lines changed

samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/BodyApi.java

+18-18
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public File testBinaryGif(Map<String, String> additionalHeaders) throws ApiExcep
118118
* @return String
119119
* @throws ApiException if fails to make API call
120120
*/
121-
public String testBodyApplicationOctetstreamBinary(File body) throws ApiException {
121+
public String testBodyApplicationOctetstreamBinary(@javax.annotation.Nullable File body) throws ApiException {
122122
return this.testBodyApplicationOctetstreamBinary(body, Collections.emptyMap());
123123
}
124124

@@ -131,7 +131,7 @@ public String testBodyApplicationOctetstreamBinary(File body) throws ApiExceptio
131131
* @return String
132132
* @throws ApiException if fails to make API call
133133
*/
134-
public String testBodyApplicationOctetstreamBinary(File body, Map<String, String> additionalHeaders) throws ApiException {
134+
public String testBodyApplicationOctetstreamBinary(@javax.annotation.Nullable File body, Map<String, String> additionalHeaders) throws ApiException {
135135
Object localVarPostBody = body;
136136

137137
// create path and map variables
@@ -187,7 +187,7 @@ public String testBodyApplicationOctetstreamBinary(File body, Map<String, String
187187
* @return String
188188
* @throws ApiException if fails to make API call
189189
*/
190-
public String testBodyMultipartFormdataArrayOfBinary(List<File> files) throws ApiException {
190+
public String testBodyMultipartFormdataArrayOfBinary(@javax.annotation.Nonnull List<File> files) throws ApiException {
191191
return this.testBodyMultipartFormdataArrayOfBinary(files, Collections.emptyMap());
192192
}
193193

@@ -200,7 +200,7 @@ public String testBodyMultipartFormdataArrayOfBinary(List<File> files) throws Ap
200200
* @return String
201201
* @throws ApiException if fails to make API call
202202
*/
203-
public String testBodyMultipartFormdataArrayOfBinary(List<File> files, Map<String, String> additionalHeaders) throws ApiException {
203+
public String testBodyMultipartFormdataArrayOfBinary(@javax.annotation.Nonnull List<File> files, Map<String, String> additionalHeaders) throws ApiException {
204204
Object localVarPostBody = null;
205205

206206
// verify the required parameter 'files' is set
@@ -263,7 +263,7 @@ public String testBodyMultipartFormdataArrayOfBinary(List<File> files, Map<Strin
263263
* @return String
264264
* @throws ApiException if fails to make API call
265265
*/
266-
public String testBodyMultipartFormdataSingleBinary(File myFile) throws ApiException {
266+
public String testBodyMultipartFormdataSingleBinary(@javax.annotation.Nullable File myFile) throws ApiException {
267267
return this.testBodyMultipartFormdataSingleBinary(myFile, Collections.emptyMap());
268268
}
269269

@@ -276,7 +276,7 @@ public String testBodyMultipartFormdataSingleBinary(File myFile) throws ApiExcep
276276
* @return String
277277
* @throws ApiException if fails to make API call
278278
*/
279-
public String testBodyMultipartFormdataSingleBinary(File myFile, Map<String, String> additionalHeaders) throws ApiException {
279+
public String testBodyMultipartFormdataSingleBinary(@javax.annotation.Nullable File myFile, Map<String, String> additionalHeaders) throws ApiException {
280280
Object localVarPostBody = null;
281281

282282
// create path and map variables
@@ -334,7 +334,7 @@ public String testBodyMultipartFormdataSingleBinary(File myFile, Map<String, Str
334334
* @return Pet
335335
* @throws ApiException if fails to make API call
336336
*/
337-
public Pet testEchoBodyAllOfPet(Pet pet) throws ApiException {
337+
public Pet testEchoBodyAllOfPet(@javax.annotation.Nullable Pet pet) throws ApiException {
338338
return this.testEchoBodyAllOfPet(pet, Collections.emptyMap());
339339
}
340340

@@ -347,7 +347,7 @@ public Pet testEchoBodyAllOfPet(Pet pet) throws ApiException {
347347
* @return Pet
348348
* @throws ApiException if fails to make API call
349349
*/
350-
public Pet testEchoBodyAllOfPet(Pet pet, Map<String, String> additionalHeaders) throws ApiException {
350+
public Pet testEchoBodyAllOfPet(@javax.annotation.Nullable Pet pet, Map<String, String> additionalHeaders) throws ApiException {
351351
Object localVarPostBody = pet;
352352

353353
// create path and map variables
@@ -403,7 +403,7 @@ public Pet testEchoBodyAllOfPet(Pet pet, Map<String, String> additionalHeaders)
403403
* @return String
404404
* @throws ApiException if fails to make API call
405405
*/
406-
public String testEchoBodyFreeFormObjectResponseString(Object body) throws ApiException {
406+
public String testEchoBodyFreeFormObjectResponseString(@javax.annotation.Nullable Object body) throws ApiException {
407407
return this.testEchoBodyFreeFormObjectResponseString(body, Collections.emptyMap());
408408
}
409409

@@ -416,7 +416,7 @@ public String testEchoBodyFreeFormObjectResponseString(Object body) throws ApiEx
416416
* @return String
417417
* @throws ApiException if fails to make API call
418418
*/
419-
public String testEchoBodyFreeFormObjectResponseString(Object body, Map<String, String> additionalHeaders) throws ApiException {
419+
public String testEchoBodyFreeFormObjectResponseString(@javax.annotation.Nullable Object body, Map<String, String> additionalHeaders) throws ApiException {
420420
Object localVarPostBody = body;
421421

422422
// create path and map variables
@@ -472,7 +472,7 @@ public String testEchoBodyFreeFormObjectResponseString(Object body, Map<String,
472472
* @return Pet
473473
* @throws ApiException if fails to make API call
474474
*/
475-
public Pet testEchoBodyPet(Pet pet) throws ApiException {
475+
public Pet testEchoBodyPet(@javax.annotation.Nullable Pet pet) throws ApiException {
476476
return this.testEchoBodyPet(pet, Collections.emptyMap());
477477
}
478478

@@ -485,7 +485,7 @@ public Pet testEchoBodyPet(Pet pet) throws ApiException {
485485
* @return Pet
486486
* @throws ApiException if fails to make API call
487487
*/
488-
public Pet testEchoBodyPet(Pet pet, Map<String, String> additionalHeaders) throws ApiException {
488+
public Pet testEchoBodyPet(@javax.annotation.Nullable Pet pet, Map<String, String> additionalHeaders) throws ApiException {
489489
Object localVarPostBody = pet;
490490

491491
// create path and map variables
@@ -541,7 +541,7 @@ public Pet testEchoBodyPet(Pet pet, Map<String, String> additionalHeaders) throw
541541
* @return String
542542
* @throws ApiException if fails to make API call
543543
*/
544-
public String testEchoBodyPetResponseString(Pet pet) throws ApiException {
544+
public String testEchoBodyPetResponseString(@javax.annotation.Nullable Pet pet) throws ApiException {
545545
return this.testEchoBodyPetResponseString(pet, Collections.emptyMap());
546546
}
547547

@@ -554,7 +554,7 @@ public String testEchoBodyPetResponseString(Pet pet) throws ApiException {
554554
* @return String
555555
* @throws ApiException if fails to make API call
556556
*/
557-
public String testEchoBodyPetResponseString(Pet pet, Map<String, String> additionalHeaders) throws ApiException {
557+
public String testEchoBodyPetResponseString(@javax.annotation.Nullable Pet pet, Map<String, String> additionalHeaders) throws ApiException {
558558
Object localVarPostBody = pet;
559559

560560
// create path and map variables
@@ -610,7 +610,7 @@ public String testEchoBodyPetResponseString(Pet pet, Map<String, String> additio
610610
* @return StringEnumRef
611611
* @throws ApiException if fails to make API call
612612
*/
613-
public StringEnumRef testEchoBodyStringEnum(String body) throws ApiException {
613+
public StringEnumRef testEchoBodyStringEnum(@javax.annotation.Nullable String body) throws ApiException {
614614
return this.testEchoBodyStringEnum(body, Collections.emptyMap());
615615
}
616616

@@ -623,7 +623,7 @@ public StringEnumRef testEchoBodyStringEnum(String body) throws ApiException {
623623
* @return StringEnumRef
624624
* @throws ApiException if fails to make API call
625625
*/
626-
public StringEnumRef testEchoBodyStringEnum(String body, Map<String, String> additionalHeaders) throws ApiException {
626+
public StringEnumRef testEchoBodyStringEnum(@javax.annotation.Nullable String body, Map<String, String> additionalHeaders) throws ApiException {
627627
Object localVarPostBody = body;
628628

629629
// create path and map variables
@@ -679,7 +679,7 @@ public StringEnumRef testEchoBodyStringEnum(String body, Map<String, String> add
679679
* @return String
680680
* @throws ApiException if fails to make API call
681681
*/
682-
public String testEchoBodyTagResponseString(Tag tag) throws ApiException {
682+
public String testEchoBodyTagResponseString(@javax.annotation.Nullable Tag tag) throws ApiException {
683683
return this.testEchoBodyTagResponseString(tag, Collections.emptyMap());
684684
}
685685

@@ -692,7 +692,7 @@ public String testEchoBodyTagResponseString(Tag tag) throws ApiException {
692692
* @return String
693693
* @throws ApiException if fails to make API call
694694
*/
695-
public String testEchoBodyTagResponseString(Tag tag, Map<String, String> additionalHeaders) throws ApiException {
695+
public String testEchoBodyTagResponseString(@javax.annotation.Nullable Tag tag, Map<String, String> additionalHeaders) throws ApiException {
696696
Object localVarPostBody = tag;
697697

698698
// create path and map variables

samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/FormApi.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public FormApi(ApiClient apiClient) {
5050
* @return String
5151
* @throws ApiException if fails to make API call
5252
*/
53-
public String testFormIntegerBooleanString(Integer integerForm, Boolean booleanForm, String stringForm) throws ApiException {
53+
public String testFormIntegerBooleanString(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm) throws ApiException {
5454
return this.testFormIntegerBooleanString(integerForm, booleanForm, stringForm, Collections.emptyMap());
5555
}
5656

@@ -65,7 +65,7 @@ public String testFormIntegerBooleanString(Integer integerForm, Boolean booleanF
6565
* @return String
6666
* @throws ApiException if fails to make API call
6767
*/
68-
public String testFormIntegerBooleanString(Integer integerForm, Boolean booleanForm, String stringForm, Map<String, String> additionalHeaders) throws ApiException {
68+
public String testFormIntegerBooleanString(@javax.annotation.Nullable Integer integerForm, @javax.annotation.Nullable Boolean booleanForm, @javax.annotation.Nullable String stringForm, Map<String, String> additionalHeaders) throws ApiException {
6969
Object localVarPostBody = null;
7070

7171
// create path and map variables
@@ -127,7 +127,7 @@ public String testFormIntegerBooleanString(Integer integerForm, Boolean booleanF
127127
* @return String
128128
* @throws ApiException if fails to make API call
129129
*/
130-
public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marker) throws ApiException {
130+
public String testFormObjectMultipart(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker) throws ApiException {
131131
return this.testFormObjectMultipart(marker, Collections.emptyMap());
132132
}
133133

@@ -140,7 +140,7 @@ public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marke
140140
* @return String
141141
* @throws ApiException if fails to make API call
142142
*/
143-
public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marker, Map<String, String> additionalHeaders) throws ApiException {
143+
public String testFormObjectMultipart(@javax.annotation.Nonnull TestFormObjectMultipartRequestMarker marker, Map<String, String> additionalHeaders) throws ApiException {
144144
Object localVarPostBody = null;
145145

146146
// verify the required parameter 'marker' is set
@@ -208,7 +208,7 @@ public String testFormObjectMultipart(TestFormObjectMultipartRequestMarker marke
208208
* @return String
209209
* @throws ApiException if fails to make API call
210210
*/
211-
public String testFormOneof(String form1, Integer form2, String form3, Boolean form4, Long id, String name) throws ApiException {
211+
public String testFormOneof(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name) throws ApiException {
212212
return this.testFormOneof(form1, form2, form3, form4, id, name, Collections.emptyMap());
213213
}
214214

@@ -226,7 +226,7 @@ public String testFormOneof(String form1, Integer form2, String form3, Boolean f
226226
* @return String
227227
* @throws ApiException if fails to make API call
228228
*/
229-
public String testFormOneof(String form1, Integer form2, String form3, Boolean form4, Long id, String name, Map<String, String> additionalHeaders) throws ApiException {
229+
public String testFormOneof(@javax.annotation.Nullable String form1, @javax.annotation.Nullable Integer form2, @javax.annotation.Nullable String form3, @javax.annotation.Nullable Boolean form4, @javax.annotation.Nullable Long id, @javax.annotation.Nullable String name, Map<String, String> additionalHeaders) throws ApiException {
230230
Object localVarPostBody = null;
231231

232232
// create path and map variables

samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/HeaderApi.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public HeaderApi(ApiClient apiClient) {
5252
* @return String
5353
* @throws ApiException if fails to make API call
5454
*/
55-
public String testHeaderIntegerBooleanStringEnums(Integer integerHeader, Boolean booleanHeader, String stringHeader, String enumNonrefStringHeader, StringEnumRef enumRefStringHeader) throws ApiException {
55+
public String testHeaderIntegerBooleanStringEnums(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader) throws ApiException {
5656
return this.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader, Collections.emptyMap());
5757
}
5858

@@ -69,7 +69,7 @@ public String testHeaderIntegerBooleanStringEnums(Integer integerHeader, Boolean
6969
* @return String
7070
* @throws ApiException if fails to make API call
7171
*/
72-
public String testHeaderIntegerBooleanStringEnums(Integer integerHeader, Boolean booleanHeader, String stringHeader, String enumNonrefStringHeader, StringEnumRef enumRefStringHeader, Map<String, String> additionalHeaders) throws ApiException {
72+
public String testHeaderIntegerBooleanStringEnums(@javax.annotation.Nullable Integer integerHeader, @javax.annotation.Nullable Boolean booleanHeader, @javax.annotation.Nullable String stringHeader, @javax.annotation.Nullable String enumNonrefStringHeader, @javax.annotation.Nullable StringEnumRef enumRefStringHeader, Map<String, String> additionalHeaders) throws ApiException {
7373
Object localVarPostBody = null;
7474

7575
// create path and map variables

samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/api/PathApi.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public PathApi(ApiClient apiClient) {
5151
* @return String
5252
* @throws ApiException if fails to make API call
5353
*/
54-
public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(String pathString, Integer pathInteger, String enumNonrefStringPath, StringEnumRef enumRefStringPath) throws ApiException {
54+
public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath) throws ApiException {
5555
return this.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath, Collections.emptyMap());
5656
}
5757

@@ -67,7 +67,7 @@ public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnu
6767
* @return String
6868
* @throws ApiException if fails to make API call
6969
*/
70-
public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(String pathString, Integer pathInteger, String enumNonrefStringPath, StringEnumRef enumRefStringPath, Map<String, String> additionalHeaders) throws ApiException {
70+
public String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(@javax.annotation.Nonnull String pathString, @javax.annotation.Nonnull Integer pathInteger, @javax.annotation.Nonnull String enumNonrefStringPath, @javax.annotation.Nonnull StringEnumRef enumRefStringPath, Map<String, String> additionalHeaders) throws ApiException {
7171
Object localVarPostBody = null;
7272

7373
// verify the required parameter 'pathString' is set

0 commit comments

Comments
 (0)