Skip to content

Commit 3346fd0

Browse files
committed
update samples, docs
1 parent bf93e8e commit 3346fd0

208 files changed

Lines changed: 1026 additions & 1024 deletions

File tree

Some content is hidden

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

bin/configs/spring-boot-x-implements-skip.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ additionalProperties:
1212
xImplementsSkip: [ com.custompackage.InterfaceToSkip ]
1313
schemaImplements:
1414
Foo: [ com.custompackage.WithBar, com.custompackage.WithDefaultMethod ]
15-
Animal: com.custompackage.WithColor
15+
Animal: com.custompackage.WithColor

docs/generators/java-camel.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2020
| ------ | ----------- | ------ | ------- |
2121
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
2222
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
23+
|additionalNotNullAnnotations|Add @NotNull to path variables (required by default) and requestBody.| |false|
2324
|additionalOneOfTypeAnnotations|Additional annotations for oneOf interfaces(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
2425
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
2526
|annotationLibrary|Select the complementary documentation annotation library.|<dl><dt>**none**</dt><dd>Do not annotate Model and Api with complementary annotations.</dd><dt>**swagger1**</dt><dd>Annotate Model and Api using the Swagger Annotations 1.x library.</dd><dt>**swagger2**</dt><dd>Annotate Model and Api using the Swagger Annotations 2.x library.</dd></dl>|swagger2|

docs/generators/spring.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2020
| ------ | ----------- | ------ | ------- |
2121
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
2222
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
23+
|additionalNotNullAnnotations|Add @NotNull to path variables (required by default) and requestBody.| |false|
2324
|additionalOneOfTypeAnnotations|Additional annotations for oneOf interfaces(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
2425
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
2526
|annotationLibrary|Select the complementary documentation annotation library.|<dl><dt>**none**</dt><dd>Do not annotate Model and Api with complementary annotations.</dd><dt>**swagger1**</dt><dd>Annotate Model and Api using the Swagger Annotations 1.x library.</dd><dt>**swagger2**</dt><dd>Annotate Model and Api using the Swagger Annotations 2.x library.</dd></dl>|swagger2|
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{^useOptional}}{{#required}}@NotNull {{/required}}{{>beanValidationCore}}{{/useOptional}}{{#useOptional}}{{#required}}{{>beanValidationCore}}{{/required}}{{/useOptional}}
1+
{{^useOptional}}{{#additionalNotNullAnnotations}}{{#required}}@NotNull {{/required}}{{/additionalNotNullAnnotations}}{{>beanValidationCore}}{{/useOptional}}{{#useOptional}}{{#required}}{{>beanValidationCore}}{{/required}}{{/useOptional}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{! PathParam is always required }}@NotNull {{>beanValidationCore}}
1+
{{! PathParam is always required }}{{#additionalNotNullAnnotations}}@NotNull {{/additionalNotNullAnnotations}}{{>beanValidationCore}}

samples/client/petstore/spring-cloud-date-time/src/main/java/org/openapitools/api/DefaultApi.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public interface DefaultApi {
5050
value = DefaultApi.PATH_GET
5151
)
5252
ResponseEntity<Void> get(
53-
@NotNull @ApiParam(value = "A date path parameter", required = true, defaultValue = "1972-01-01") @PathVariable("date") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date,
53+
@ApiParam(value = "A date path parameter", required = true, defaultValue = "1972-01-01") @PathVariable("date") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date,
5454
@NotNull @ApiParam(value = "A date-time query parameter", required = true, defaultValue = "1973-12-19T03:39:57-08:00") @Valid @RequestParam(value = "dateTime", required = true, defaultValue = "1973-12-19T03:39:57-08:00") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime dateTime,
5555
@NotNull @ApiParam(value = "A date header parameter", required = true, defaultValue = "1974-01-01") @RequestHeader(value = "X-Order-Date", required = true, defaultValue = "1974-01-01") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate xOrderDate,
5656
@ApiParam(value = "A date cookie parameter", defaultValue = "1975-01-01") @CookieValue(name = "loginDate", required = false, defaultValue = "1975-01-01") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate loginDate
@@ -80,7 +80,7 @@ ResponseEntity<Void> get(
8080
consumes = "application/x-www-form-urlencoded"
8181
)
8282
ResponseEntity<Void> updatePetWithForm(
83-
@NotNull @ApiParam(value = "A date path parameter", required = true, defaultValue = "1970-01-01") @PathVariable("date") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date,
83+
@ApiParam(value = "A date path parameter", required = true, defaultValue = "1970-01-01") @PathVariable("date") @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate date,
8484
@ApiParam(value = "Updated last visit timestamp", defaultValue = "1971-12-19T03:39:57-08:00") @Valid @RequestParam(value = "visitDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) OffsetDateTime visitDate
8585
);
8686

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/api/PetApi.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public interface PetApi {
6363
consumes = "application/json"
6464
)
6565
ResponseEntity<Void> addPet(
66-
@Parameter(name = "Pet", description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid @RequestBody Pet pet
66+
@Parameter(name = "Pet", description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet
6767
);
6868

6969

@@ -93,7 +93,7 @@ ResponseEntity<Void> addPet(
9393
value = PetApi.PATH_DELETE_PET
9494
)
9595
ResponseEntity<Void> deletePet(
96-
@NotNull @Parameter(name = "petId", description = "Pet id to delete", required = true, in = ParameterIn.PATH) @PathVariable("petId") Long petId,
96+
@Parameter(name = "petId", description = "Pet id to delete", required = true, in = ParameterIn.PATH) @PathVariable("petId") Long petId,
9797
@Parameter(name = "api_key", description = "", in = ParameterIn.HEADER) @RequestHeader(value = "api_key", required = false) @Nullable String apiKey
9898
);
9999

@@ -204,7 +204,7 @@ ResponseEntity<List<Pet>> findPetsByTags(
204204
produces = { "application/json", "application/xml" }
205205
)
206206
ResponseEntity<Pet> getPetById(
207-
@NotNull @Parameter(name = "petId", deprecated = true, description = "ID of pet to return", required = true, in = ParameterIn.PATH) @PathVariable("petId") @Deprecated Long petId
207+
@Parameter(name = "petId", deprecated = true, description = "ID of pet to return", required = true, in = ParameterIn.PATH) @PathVariable("petId") @Deprecated Long petId
208208
);
209209

210210

@@ -238,7 +238,7 @@ ResponseEntity<Pet> getPetById(
238238
consumes = "application/json"
239239
)
240240
ResponseEntity<Void> updatePet(
241-
@Parameter(name = "Pet", description = "Pet object that needs to be added to the store", required = true) @NotNull @Valid @RequestBody Pet pet
241+
@Parameter(name = "Pet", description = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet
242242
);
243243

244244

@@ -270,7 +270,7 @@ ResponseEntity<Void> updatePet(
270270
consumes = "application/x-www-form-urlencoded"
271271
)
272272
ResponseEntity<Void> updatePetWithForm(
273-
@NotNull @Parameter(name = "petId", description = "ID of pet that needs to be updated", required = true, in = ParameterIn.PATH) @PathVariable("petId") Long petId,
273+
@Parameter(name = "petId", description = "ID of pet that needs to be updated", required = true, in = ParameterIn.PATH) @PathVariable("petId") Long petId,
274274
@Parameter(name = "name", description = "Updated name of the pet") @Valid @RequestParam(value = "name", required = false) String name,
275275
@Parameter(name = "status", description = "Updated status of the pet") @Valid @RequestParam(value = "status", required = false) String status
276276
);
@@ -307,7 +307,7 @@ ResponseEntity<Void> updatePetWithForm(
307307
consumes = "multipart/form-data"
308308
)
309309
ResponseEntity<ModelApiResponse> uploadFile(
310-
@NotNull @Parameter(name = "petId", description = "ID of pet to update", required = true, in = ParameterIn.PATH) @PathVariable("petId") Long petId,
310+
@Parameter(name = "petId", description = "ID of pet to update", required = true, in = ParameterIn.PATH) @PathVariable("petId") Long petId,
311311
@Parameter(name = "additionalMetadata", description = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata,
312312
@Parameter(name = "file", description = "file to upload") @RequestPart(value = "file", required = false) MultipartFile file
313313
);

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/api/StoreApi.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public interface StoreApi {
6060
value = StoreApi.PATH_DELETE_ORDER
6161
)
6262
ResponseEntity<Void> deleteOrder(
63-
@NotNull @Parameter(name = "orderId", description = "ID of the order that needs to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("orderId") String orderId
63+
@Parameter(name = "orderId", description = "ID of the order that needs to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("orderId") String orderId
6464
);
6565

6666

@@ -125,7 +125,7 @@ ResponseEntity<Map<String, Integer>> getInventory(
125125
produces = { "application/json", "application/xml" }
126126
)
127127
ResponseEntity<Order> getOrderById(
128-
@NotNull @Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId
128+
@Min(value = 1L) @Max(value = 5L) @Parameter(name = "orderId", description = "ID of pet that needs to be fetched", required = true, in = ParameterIn.PATH) @PathVariable("orderId") Long orderId
129129
);
130130

131131

@@ -158,7 +158,7 @@ ResponseEntity<Order> getOrderById(
158158
consumes = "application/json"
159159
)
160160
ResponseEntity<Order> placeOrder(
161-
@Parameter(name = "Order", description = "order placed for purchasing the pet", required = true) @NotNull @Valid @RequestBody Order order
161+
@Parameter(name = "Order", description = "order placed for purchasing the pet", required = true) @Valid @RequestBody Order order
162162
);
163163

164164
}

samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/api/UserApi.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public interface UserApi {
6262
consumes = "application/json"
6363
)
6464
ResponseEntity<Void> createUser(
65-
@Parameter(name = "User", description = "Created user object", required = true) @NotNull @Valid @RequestBody User user
65+
@Parameter(name = "User", description = "Created user object", required = true) @Valid @RequestBody User user
6666
);
6767

6868

@@ -92,7 +92,7 @@ ResponseEntity<Void> createUser(
9292
consumes = "application/json"
9393
)
9494
ResponseEntity<Void> createUsersWithArrayInput(
95-
@Parameter(name = "User", description = "List of user object", required = true) @NotNull @Valid @RequestBody List<@Valid User> user
95+
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
9696
);
9797

9898

@@ -122,7 +122,7 @@ ResponseEntity<Void> createUsersWithArrayInput(
122122
consumes = "application/json"
123123
)
124124
ResponseEntity<Void> createUsersWithListInput(
125-
@Parameter(name = "User", description = "List of user object", required = true) @NotNull @Valid @RequestBody List<@Valid User> user
125+
@Parameter(name = "User", description = "List of user object", required = true) @Valid @RequestBody List<@Valid User> user
126126
);
127127

128128

@@ -153,7 +153,7 @@ ResponseEntity<Void> createUsersWithListInput(
153153
value = UserApi.PATH_DELETE_USER
154154
)
155155
ResponseEntity<Void> deleteUser(
156-
@NotNull @Parameter(name = "username", description = "The name that needs to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("username") String username
156+
@Parameter(name = "username", description = "The name that needs to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("username") String username
157157
);
158158

159159

@@ -187,7 +187,7 @@ ResponseEntity<Void> deleteUser(
187187
produces = { "application/json", "application/xml" }
188188
)
189189
ResponseEntity<User> getUserByName(
190-
@NotNull @Parameter(name = "username", description = "The name that needs to be fetched. Use user1 for testing.", required = true, in = ParameterIn.PATH) @PathVariable("username") String username
190+
@Parameter(name = "username", description = "The name that needs to be fetched. Use user1 for testing.", required = true, in = ParameterIn.PATH) @PathVariable("username") String username
191191
);
192192

193193

@@ -282,8 +282,8 @@ ResponseEntity<Void> logoutUser(
282282
consumes = "application/json"
283283
)
284284
ResponseEntity<Void> updateUser(
285-
@NotNull @Parameter(name = "username", description = "name that need to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("username") String username,
286-
@Parameter(name = "User", description = "Updated user object", required = true) @NotNull @Valid @RequestBody User user
285+
@Parameter(name = "username", description = "name that need to be deleted", required = true, in = ParameterIn.PATH) @PathVariable("username") String username,
286+
@Parameter(name = "User", description = "Updated user object", required = true) @Valid @RequestBody User user
287287
);
288288

289289
}

samples/client/petstore/spring-cloud-feign-without-url/src/main/java/org/openapitools/api/PetApi.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public interface PetApi {
5959
consumes = "application/json"
6060
)
6161
ResponseEntity<Pet> addPet(
62-
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid @RequestBody Pet pet
62+
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet
6363
);
6464

6565

@@ -92,7 +92,7 @@ ResponseEntity<Pet> addPet(
9292
value = PetApi.PATH_DELETE_PET
9393
)
9494
ResponseEntity<Void> deletePet(
95-
@NotNull @ApiParam(value = "Pet id to delete", required = true) @PathVariable("petId") Long petId,
95+
@ApiParam(value = "Pet id to delete", required = true) @PathVariable("petId") Long petId,
9696
@ApiParam(value = "") @RequestHeader(value = "api_key", required = false) @Nullable String apiKey
9797
);
9898

@@ -202,7 +202,7 @@ ResponseEntity<List<Pet>> findPetsByTags(
202202
produces = { "application/json", "application/xml" }
203203
)
204204
ResponseEntity<Pet> getPetById(
205-
@NotNull @ApiParam(value = "ID of pet to return", required = true) @PathVariable("petId") Long petId
205+
@ApiParam(value = "ID of pet to return", required = true) @PathVariable("petId") Long petId
206206
);
207207

208208

@@ -245,7 +245,7 @@ ResponseEntity<Pet> getPetById(
245245
consumes = "application/json"
246246
)
247247
ResponseEntity<Pet> updatePet(
248-
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @NotNull @Valid @RequestBody Pet pet
248+
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @Valid @RequestBody Pet pet
249249
);
250250

251251

@@ -280,7 +280,7 @@ ResponseEntity<Pet> updatePet(
280280
consumes = "application/x-www-form-urlencoded"
281281
)
282282
ResponseEntity<Void> updatePetWithForm(
283-
@NotNull @ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId,
283+
@ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId,
284284
@ApiParam(value = "Updated name of the pet") @Valid @RequestParam(value = "name", required = false) String name,
285285
@ApiParam(value = "Updated status of the pet") @Valid @RequestParam(value = "status", required = false) String status
286286
);
@@ -319,7 +319,7 @@ ResponseEntity<Void> updatePetWithForm(
319319
consumes = "multipart/form-data"
320320
)
321321
ResponseEntity<ModelApiResponse> uploadFile(
322-
@NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,
322+
@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,
323323
@ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata,
324324
@ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) MultipartFile file
325325
);

0 commit comments

Comments
 (0)