Fix #21921 by marking required path parameters as @NotNull (#21951)

This commit is contained in:
GregDThomas
2025-09-13 10:48:47 +01:00
committed by GitHub
parent 0edcc9d204
commit ec28d6261c
142 changed files with 402 additions and 402 deletions

View File

@@ -240,7 +240,7 @@ public interface FakeApi {
)
default ResponseEntity<ResponseObjectWithDifferentFieldNames> responseObjectDifferentNames(
@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId
@NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
@@ -715,7 +715,7 @@ public interface FakeApi {
)
default ResponseEntity<ModelApiResponse> uploadFileWithRequiredFile(
@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,
@NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,
@ApiParam(value = "file to upload", required = true) @RequestPart(value = "requiredFile", required = true) MultipartFile requiredFile,
@ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata
) {

View File

@@ -105,7 +105,7 @@ public interface PetApi {
)
default ResponseEntity<Void> deletePet(
@ApiParam(value = "Pet id to delete", required = true) @PathVariable("petId") Long petId,
@NotNull @ApiParam(value = "Pet id to delete", required = true) @PathVariable("petId") Long petId,
@ApiParam(value = "") @RequestHeader(value = "api_key", required = false) @Nullable String apiKey
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -257,7 +257,7 @@ public interface PetApi {
)
default ResponseEntity<Pet> getPetById(
@ApiParam(value = "ID of pet to return", required = true) @PathVariable("petId") Long petId
@NotNull @ApiParam(value = "ID of pet to return", required = true) @PathVariable("petId") Long petId
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
@@ -353,7 +353,7 @@ public interface PetApi {
)
default ResponseEntity<Void> updatePetWithForm(
@ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId,
@NotNull @ApiParam(value = "ID of pet that needs to be updated", required = true) @PathVariable("petId") Long petId,
@ApiParam(value = "Updated name of the pet") @Valid @RequestParam(value = "name", required = false) String name,
@ApiParam(value = "Updated status of the pet") @Valid @RequestParam(value = "status", required = false) String status
) {
@@ -396,7 +396,7 @@ public interface PetApi {
)
default ResponseEntity<ModelApiResponse> uploadFile(
@ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,
@NotNull @ApiParam(value = "ID of pet to update", required = true) @PathVariable("petId") Long petId,
@ApiParam(value = "Additional data to pass to server") @Valid @RequestParam(value = "additionalMetadata", required = false) String additionalMetadata,
@ApiParam(value = "file to upload") @RequestPart(value = "file", required = false) MultipartFile file
) {

View File

@@ -57,7 +57,7 @@ public interface StoreApi {
)
default ResponseEntity<Void> deleteOrder(
@ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathVariable("order_id") String orderId
@NotNull @ApiParam(value = "ID of the order that needs to be deleted", required = true) @PathVariable("order_id") String orderId
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -128,7 +128,7 @@ public interface StoreApi {
)
default ResponseEntity<Order> getOrderById(
@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId
@NotNull @Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required = true) @PathVariable("order_id") Long orderId
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {

View File

@@ -150,7 +150,7 @@ public interface UserApi {
)
default ResponseEntity<Void> deleteUser(
@ApiParam(value = "The name that needs to be deleted", required = true) @PathVariable("username") String username
@NotNull @ApiParam(value = "The name that needs to be deleted", required = true) @PathVariable("username") String username
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
@@ -186,7 +186,7 @@ public interface UserApi {
)
default ResponseEntity<User> getUserByName(
@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") String username
@NotNull @ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required = true) @PathVariable("username") String username
) {
getRequest().ifPresent(request -> {
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
@@ -299,7 +299,7 @@ public interface UserApi {
)
default ResponseEntity<Void> updateUser(
@ApiParam(value = "name that need to be deleted", required = true) @PathVariable("username") String username,
@NotNull @ApiParam(value = "name that need to be deleted", required = true) @PathVariable("username") String username,
@ApiParam(value = "Updated user object", required = true) @Valid @RequestBody User user
) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);