Skip to content

Commit a8e0b7a

Browse files
algolia-botFluf22
andcommitted
fix(clients): validate empty string for required string parameters (generated)
algolia/api-clients-automation#6338 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
1 parent c94d879 commit a8e0b7a

12 files changed

Lines changed: 374 additions & 0 deletions

algoliasearch/src/main/java/com/algolia/api/AbtestingClient.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ public CompletableFuture<Object> customDeleteAsync(
284284
@Nullable RequestOptions requestOptions
285285
) throws AlgoliaRuntimeException {
286286
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customDelete`.");
287+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customDelete`.");
287288

288289
HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("DELETE").addQueryParameters(parameters).build();
289290
return executeAsync(request, requestOptions, new TypeReference<Object>() {});
@@ -304,6 +305,7 @@ public CompletableFuture<Response> customDeleteWithHTTPInfoAsync(
304305
@Nullable RequestOptions requestOptions
305306
) throws AlgoliaRuntimeException {
306307
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customDelete`.");
308+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customDelete`.");
307309

308310
HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("DELETE").addQueryParameters(parameters).build();
309311
return executeAsync(request, requestOptions, new TypeReference<Response>() {});
@@ -487,6 +489,7 @@ public CompletableFuture<Object> customGetAsync(
487489
@Nullable RequestOptions requestOptions
488490
) throws AlgoliaRuntimeException {
489491
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customGet`.");
492+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customGet`.");
490493

491494
HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("GET").addQueryParameters(parameters).build();
492495
return executeAsync(request, requestOptions, new TypeReference<Object>() {});
@@ -507,6 +510,7 @@ public CompletableFuture<Response> customGetWithHTTPInfoAsync(
507510
@Nullable RequestOptions requestOptions
508511
) throws AlgoliaRuntimeException {
509512
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customGet`.");
513+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customGet`.");
510514

511515
HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("GET").addQueryParameters(parameters).build();
512516
return executeAsync(request, requestOptions, new TypeReference<Response>() {});
@@ -700,6 +704,7 @@ public CompletableFuture<Object> customPostAsync(
700704
@Nullable RequestOptions requestOptions
701705
) throws AlgoliaRuntimeException {
702706
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPost`.");
707+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customPost`.");
703708

704709
HttpRequest request = HttpRequest.builder()
705710
.setPathEncoded("/{path}", path)
@@ -727,6 +732,7 @@ public CompletableFuture<Response> customPostWithHTTPInfoAsync(
727732
@Nullable RequestOptions requestOptions
728733
) throws AlgoliaRuntimeException {
729734
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPost`.");
735+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customPost`.");
730736

731737
HttpRequest request = HttpRequest.builder()
732738
.setPathEncoded("/{path}", path)
@@ -928,6 +934,7 @@ public CompletableFuture<Object> customPutAsync(
928934
@Nullable RequestOptions requestOptions
929935
) throws AlgoliaRuntimeException {
930936
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPut`.");
937+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customPut`.");
931938

932939
HttpRequest request = HttpRequest.builder()
933940
.setPathEncoded("/{path}", path)
@@ -955,6 +962,7 @@ public CompletableFuture<Response> customPutWithHTTPInfoAsync(
955962
@Nullable RequestOptions requestOptions
956963
) throws AlgoliaRuntimeException {
957964
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPut`.");
965+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customPut`.");
958966

959967
HttpRequest request = HttpRequest.builder()
960968
.setPathEncoded("/{path}", path)

algoliasearch/src/main/java/com/algolia/api/AbtestingV3Client.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ public CompletableFuture<Object> customDeleteAsync(
284284
@Nullable RequestOptions requestOptions
285285
) throws AlgoliaRuntimeException {
286286
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customDelete`.");
287+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customDelete`.");
287288

288289
HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("DELETE").addQueryParameters(parameters).build();
289290
return executeAsync(request, requestOptions, new TypeReference<Object>() {});
@@ -304,6 +305,7 @@ public CompletableFuture<Response> customDeleteWithHTTPInfoAsync(
304305
@Nullable RequestOptions requestOptions
305306
) throws AlgoliaRuntimeException {
306307
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customDelete`.");
308+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customDelete`.");
307309

308310
HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("DELETE").addQueryParameters(parameters).build();
309311
return executeAsync(request, requestOptions, new TypeReference<Response>() {});
@@ -487,6 +489,7 @@ public CompletableFuture<Object> customGetAsync(
487489
@Nullable RequestOptions requestOptions
488490
) throws AlgoliaRuntimeException {
489491
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customGet`.");
492+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customGet`.");
490493

491494
HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("GET").addQueryParameters(parameters).build();
492495
return executeAsync(request, requestOptions, new TypeReference<Object>() {});
@@ -507,6 +510,7 @@ public CompletableFuture<Response> customGetWithHTTPInfoAsync(
507510
@Nullable RequestOptions requestOptions
508511
) throws AlgoliaRuntimeException {
509512
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customGet`.");
513+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customGet`.");
510514

511515
HttpRequest request = HttpRequest.builder().setPathEncoded("/{path}", path).setMethod("GET").addQueryParameters(parameters).build();
512516
return executeAsync(request, requestOptions, new TypeReference<Response>() {});
@@ -700,6 +704,7 @@ public CompletableFuture<Object> customPostAsync(
700704
@Nullable RequestOptions requestOptions
701705
) throws AlgoliaRuntimeException {
702706
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPost`.");
707+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customPost`.");
703708

704709
HttpRequest request = HttpRequest.builder()
705710
.setPathEncoded("/{path}", path)
@@ -727,6 +732,7 @@ public CompletableFuture<Response> customPostWithHTTPInfoAsync(
727732
@Nullable RequestOptions requestOptions
728733
) throws AlgoliaRuntimeException {
729734
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPost`.");
735+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customPost`.");
730736

731737
HttpRequest request = HttpRequest.builder()
732738
.setPathEncoded("/{path}", path)
@@ -928,6 +934,7 @@ public CompletableFuture<Object> customPutAsync(
928934
@Nullable RequestOptions requestOptions
929935
) throws AlgoliaRuntimeException {
930936
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPut`.");
937+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customPut`.");
931938

932939
HttpRequest request = HttpRequest.builder()
933940
.setPathEncoded("/{path}", path)
@@ -955,6 +962,7 @@ public CompletableFuture<Response> customPutWithHTTPInfoAsync(
955962
@Nullable RequestOptions requestOptions
956963
) throws AlgoliaRuntimeException {
957964
Parameters.requireNonNull(path, "Parameter `path` is required when calling `customPut`.");
965+
Parameters.requireNonEmpty(path, "Parameter `path` is required when calling `customPut`.");
958966

959967
HttpRequest request = HttpRequest.builder()
960968
.setPathEncoded("/{path}", path)

0 commit comments

Comments
 (0)