From d1fba2d81241cccb036e9886889308248172c904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20J=2E=20Gate=C3=B1o?= <50761868+ajgateno@users.noreply.github.com> Date: Tue, 10 Dec 2024 21:24:46 -0500 Subject: [PATCH] fix(java): Don't generate pagination with nonempty path (#5385) * fix(java): Don't generate pagination with nonempty path * test run * changelog entry * Add streaming-parameter to expected failures * Format --------- Co-authored-by: Alberto --- .../endpoint/AbstractEndpointWriter.java | 8 +++ generators/java/sdk/versions.yml | 7 ++ .../.gradle/8.11.1/checksums/checksums.lock | Bin 17 -> 17 bytes .../8.11.1/checksums/md5-checksums.bin | Bin 20947 -> 20947 bytes .../8.11.1/checksums/sha1-checksums.bin | Bin 23627 -> 23627 bytes .../executionHistory/executionHistory.bin | Bin 29880 -> 29880 bytes .../executionHistory/executionHistory.lock | Bin 17 -> 17 bytes .../.gradle/8.11.1/fileHashes/fileHashes.bin | Bin 21347 -> 21347 bytes .../.gradle/8.11.1/fileHashes/fileHashes.lock | Bin 17 -> 17 bytes .../buildOutputCleanup.lock | Bin 17 -> 17 bytes .../buildOutputCleanup/cache.properties | 2 +- .../main/java/com/seed/object/types/Type.java | 24 +++---- .../resources/users/UsersClient.java | 61 ++++++++++++------ seed/java-sdk/seed.yml | 3 +- 14 files changed, 71 insertions(+), 34 deletions(-) diff --git a/generators/java/sdk/src/main/java/com/fern/java/client/generators/endpoint/AbstractEndpointWriter.java b/generators/java/sdk/src/main/java/com/fern/java/client/generators/endpoint/AbstractEndpointWriter.java index b49374d732d..f2d886660ce 100644 --- a/generators/java/sdk/src/main/java/com/fern/java/client/generators/endpoint/AbstractEndpointWriter.java +++ b/generators/java/sdk/src/main/java/com/fern/java/client/generators/endpoint/AbstractEndpointWriter.java @@ -713,6 +713,10 @@ public JsonResponseBodyWithProperty _visitUnknown(Object unknownType) { httpEndpoint.getPagination().get().visit(new Visitor() { @Override public Void visitCursor(CursorPagination cursor) { + if (cursor.getPage().getPropertyPath().isPresent() + && !cursor.getPage().getPropertyPath().get().isEmpty()) { + return null; + } SnippetAndResultType nextSnippet = getNestedPropertySnippet( cursor.getNext().getPropertyPath(), cursor.getNext().getProperty(), @@ -797,6 +801,10 @@ public String _visitUnknown(Object o) { @Override public Void visitOffset(OffsetPagination offset) { + if (offset.getPage().getPropertyPath().isPresent() + && !offset.getPage().getPropertyPath().get().isEmpty()) { + return null; + } com.fern.ir.model.types.TypeReference pageType = offset.getPage() .getProperty() .visit(new RequestPropertyValue.Visitor() { diff --git a/generators/java/sdk/versions.yml b/generators/java/sdk/versions.yml index 28c6e8cb271..fc086bfc704 100644 --- a/generators/java/sdk/versions.yml +++ b/generators/java/sdk/versions.yml @@ -1,3 +1,10 @@ +- changelogEntry: + - summary: | + Don't generate pagination with nonempty path. Fixes pagination seed tests breaking. + type: fix + createdAt: '2024-12-10' + irVersion: 53 + version: 2.6.0 - changelogEntry: - summary: | Bump IR version to latest (v53) diff --git a/seed/java-sdk/inline-types/.gradle/8.11.1/checksums/checksums.lock b/seed/java-sdk/inline-types/.gradle/8.11.1/checksums/checksums.lock index dae511e5f67aa114bf1315840a63242278033d8c..fdf295b46653d9e9d17c9ec0e134bffbda646973 100644 GIT binary patch literal 17 UcmZSHI(5UtnO5fyGeE!`078=m-~a#s literal 17 UcmZP;y5c1I*rx6*0|d+g04#C@M*si- diff --git a/seed/java-sdk/inline-types/.gradle/8.11.1/checksums/md5-checksums.bin b/seed/java-sdk/inline-types/.gradle/8.11.1/checksums/md5-checksums.bin index 4b9c4fc3ee757ebfbd0bb8c0fdca515057e9f70b..ad4008f3424c0aa947d7f82e3903f065e65a4581 100644 GIT binary patch delta 791 zcmXw$T}V@59L75LS2l?mx( z%4td{=yE!wDzeV7DPG1~dU%Wl=Uu50y|P~puGhY==KkBCBbjR(_!nPAQFcgUn4ylP z?tDA)uH*i=v?3h!6KupGXX?|Rq0wW@?b$goHLU0)erXaJ;xlO-ctpZPU#z=wKKJ5j z`gm)t=_snCTk1nslV8dr-!y2_X3^j}Z;JWR>x#%5>$#!eEBpHq>$J!vPM2m};|DgC z((+C8MST>Smodhn`I{^COs(gCeIzL z(x!nJYw`}_R*d!UQ}Bj^H;7*x_B*jB&PFG4NOA~m#q~HV4_y`Io1dX2!PX3agqmP( z_$-DJ1oLrL9@&l`+>hK4{<(e(b3b|+Meaw|up}Ul#*@6^4}tq5>`$Y$q*;g5ldqq4uyPLrZ-B0W6Xl_y7O^ delta 787 zcmXwzUr1A77{)y-!?jjgqn-0@QZX20u~A?bg;10%PBA{k*_ zjGzYzkybXyi;$wAm}IL=wz6H+@Ir!SMIc0kbP*9_eSg}yIlu3Ff6w#1<*ZcBN)LNw zQ!tM{*)EMEA$OWWF3i$H9E9kocBzVa>fEk7 zU-!RgznPJK2uEv&mDrU7_36ry8wWq{O}rCRJ%JA5m0A!d9+UbWw@4>3EOl2&UwLr% z)S>OdRn4f9erXN*9A3$Xv}4#5@S@Rq+@vjFz}ck?)^kbUBir0H%WIJfu0Ec3W_GQ` zdDV|WzlTCt#<+lGEO0O`qUtA5RT~`}6`W9+XZ!?I&jt#=M3;FJ8dW!)9BqSFCGcs? zj~+&^#{B4Mq&0#HZ;8tIEyANB+PKN7!9!go;-2_&fq(TV>{6rWTPj`h;Vp1fsr69&sjzJx_j6bV$bHnP(#d}nM5)~ zPztj0nHs(ce~0kf%1Cj4b{5mzf3|{(039u1){xr=pMcFs2xN7%B3l6bsnH?lfgwzw4~ogk&N9g9g!(1T*I!PauSmZ^8JE+lYfM<&?oHW=@g-aMSJk7M)EqrsF{yqNyw0bHV diff --git a/seed/java-sdk/inline-types/.gradle/8.11.1/checksums/sha1-checksums.bin b/seed/java-sdk/inline-types/.gradle/8.11.1/checksums/sha1-checksums.bin index 98bf60bac5e524e1258e51404e9aecdd066b64ce..4851dd30290ee6087d3eb92063a7e7d0ad87d924 100644 GIT binary patch delta 3222 zcmZYBdr;KZ6$fxvKrqTf39|eMunU6-8z62f1%v{FJodfIvMl>Z9aO3`pb~9>_*l?j zYk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OKIVoO6;d@X%nxUq}tKCk$rQBj~F9s)9R%_^YVSg zbn)mtc4xs|O~WXa0`|NF4woGZ+SxX5@_nno`e7|d^O8IR*3NYx*3CS1)=6L%YrY!m zVlc}f--vZ9n3WC`+Y4q*%GYE)4Q3t4*J6DIX1&ihX8i$XsTb(6_O1t+7geCcx)99j zE-+$U17;m6&}ZEXW_>GAV!Z-p$rh@zJ_57c3q4qWfLT)t?OD4vfK0hjXv{ht%n~TF z<=P5j88zrKE}DEIQ*m-dkr3+%uw;Lc8tX+cYgdsv>q9W>8IbiJ%n~ZrWo_69GR~z~ Tm9-zt$}8T^Iv32+D(M3N*>2&E delta 480 zcmaLO&nv@m9LMn{Z{#!%oa9HgMaImpq%~?~wc(;@rHmTO_WAzW50itGr4+Rs; zyvM}!+Bl;yKUHxv+9c|1NZZtP{0umcGrhy=xfJ*~eR6N}1)5ff1W=r&3p{_i*3`l0 z3AQY4ZkfYsr)|WnXKeCAPwMB`)Y_1<=EjsW6I zk>r2%Vaq4LeIGLZHE=A__xL8&+qJjYOk+k(U^s?;+13x`gaz2Bmv3=qH$05qipQUCw| diff --git a/seed/java-sdk/inline-types/.gradle/8.11.1/fileHashes/fileHashes.bin b/seed/java-sdk/inline-types/.gradle/8.11.1/fileHashes/fileHashes.bin index 2d4c9100523ff19a6282bf23c98714b2d02e3b6d..bbd15b8a1172f6c8bfbd0c430beb851f90cb828a 100644 GIT binary patch delta 550 zcmXxhPbkA-90qX11v{{*)k+S_LFy-mBwoOU4>4&wcNpY~qfPw)FYZ+&~qSwlH%IF2~$3(@{MOgc4%z7-^i zW!w=J{0ah#=yvHD;}OC{5g^V`a%o0&bzURO@Qi7n878+`&!3>vEyYue6Z?o0Y1|Nd z_$0Pr^GG;}0FlBHv5q3Kg9?#H+n|JZ;U&^osGbyv9NvjdScW8=hl@yIj=07lae)`& z5-r0LE@40r+QJMGMvideiLj%|tA|5=IEWZx#5^)Y0uO?qU5#u-yRTIhf^X>c>CIpq zQNn}`Vixy=2Y-UG5A^sY>_CKg#2R5!V_Wg+mq#1$!_zBtjYwe%6T|@$L|FCvd?b<(HY0Ufp delta 550 zcmXBRKS)AR6bA5&hMo&dzbs;<2x4)S5E5Wr0&9F?LqL&hc&CH;Y7wE zM*@$8(@p#mG98$0S|`x{fSaI30ge#vZDKzH>TwqxT^1Wo0Yi2{>#G9B?QBprVTI7j zVUN)4#Vt>gX!0Zu<18yHVJvghu*>1X6`>VIjU$7RIaY2R!9i&5V4EiqTyk8aOi-Sn zpQmyfHiA;Z7D0VMiX(+Q#|;J-Sozxv3q!CIf}fxiaZdP>@y0QOJ_qYG@|Y&Heee=g zBjOw-JQE6jZDj*Sox|Ed)r2W0o0RofC%iWhBNWX@6C?qDglrX)E>uNbdtbZ7e+H`a A4gdfE diff --git a/seed/java-sdk/inline-types/.gradle/8.11.1/fileHashes/fileHashes.lock b/seed/java-sdk/inline-types/.gradle/8.11.1/fileHashes/fileHashes.lock index 25669923fb909dd0154eaef3bb8722d361e95fe0..37a9fe5e6515d7118a44988d078222c09b818430 100644 GIT binary patch literal 17 UcmZQh>AG8EzohmQ0|eLt05>%RvH$=8 literal 17 UcmZQx?l|?$HXde81_-bP04;q3m;e9( diff --git a/seed/java-sdk/inline-types/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/seed/java-sdk/inline-types/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 34443a1529d5c226ac2b66953ba42c9c6694edc4..f328a64f6d08980cc4ccabcfdfd7c341ca78b7c7 100644 GIT binary patch literal 17 UcmZS1y|&2rbt4Bq0|W>I05RMH%m4rY literal 17 UcmZR+^(FSlaVD$Z3=kj;077yFH~;_u diff --git a/seed/java-sdk/inline-types/.gradle/buildOutputCleanup/cache.properties b/seed/java-sdk/inline-types/.gradle/buildOutputCleanup/cache.properties index 6d982fc7ace..955c0ec1aaf 100644 --- a/seed/java-sdk/inline-types/.gradle/buildOutputCleanup/cache.properties +++ b/seed/java-sdk/inline-types/.gradle/buildOutputCleanup/cache.properties @@ -1,2 +1,2 @@ -#Wed Dec 04 20:59:06 UTC 2024 +#Wed Dec 11 01:50:27 UTC 2024 gradle.version=8.11.1 diff --git a/seed/java-sdk/object/src/main/java/com/seed/object/types/Type.java b/seed/java-sdk/object/src/main/java/com/seed/object/types/Type.java index f4776e60540..6ce8b968349 100644 --- a/seed/java-sdk/object/src/main/java/com/seed/object/types/Type.java +++ b/seed/java-sdk/object/src/main/java/com/seed/object/types/Type.java @@ -65,11 +65,11 @@ public final class Type { private final Name nineteen; - private final int twenty; + private final long twenty; private final long twentyone; - private final double twentytwo; + private final float twentytwo; private final BigInteger twentythree; @@ -94,9 +94,9 @@ private Type( List> sixteen, List> seventeen, Name nineteen, - int twenty, + long twenty, long twentyone, - double twentytwo, + float twentytwo, BigInteger twentythree, Map additionalProperties) { this.one = one; @@ -220,7 +220,7 @@ public Name getNineteen() { } @JsonProperty("twenty") - public int getTwenty() { + public long getTwenty() { return twenty; } @@ -230,7 +230,7 @@ public long getTwentyone() { } @JsonProperty("twentytwo") - public double getTwentytwo() { + public float getTwentytwo() { return twentytwo; } @@ -358,7 +358,7 @@ public interface NineteenStage { } public interface TwentyStage { - TwentyoneStage twenty(int twenty); + TwentyoneStage twenty(long twenty); } public interface TwentyoneStage { @@ -366,7 +366,7 @@ public interface TwentyoneStage { } public interface TwentytwoStage { - TwentythreeStage twentytwo(double twentytwo); + TwentythreeStage twentytwo(float twentytwo); } public interface TwentythreeStage { @@ -457,11 +457,11 @@ public static final class Builder private Name nineteen; - private int twenty; + private long twenty; private long twentyone; - private double twentytwo; + private float twentytwo; private BigInteger twentythree; @@ -590,7 +590,7 @@ public TwentyStage nineteen(@NotNull Name nineteen) { @java.lang.Override @JsonSetter("twenty") - public TwentyoneStage twenty(int twenty) { + public TwentyoneStage twenty(long twenty) { this.twenty = twenty; return this; } @@ -604,7 +604,7 @@ public TwentytwoStage twentyone(long twentyone) { @java.lang.Override @JsonSetter("twentytwo") - public TwentythreeStage twentytwo(double twentytwo) { + public TwentythreeStage twentytwo(float twentytwo) { this.twentytwo = twentytwo; return this; } diff --git a/seed/java-sdk/pagination/src/main/java/com/seed/pagination/resources/users/UsersClient.java b/seed/java-sdk/pagination/src/main/java/com/seed/pagination/resources/users/UsersClient.java index 52737640676..2a8316689cd 100644 --- a/seed/java-sdk/pagination/src/main/java/com/seed/pagination/resources/users/UsersClient.java +++ b/seed/java-sdk/pagination/src/main/java/com/seed/pagination/resources/users/UsersClient.java @@ -111,16 +111,16 @@ public SyncPagingIterable listWithCursorPagination( } } - public ListUsersPaginationResponse listWithBodyCursorPagination() { - return listWithBodyCursorPagination( + public void listWithBodyCursorPagination() { + listWithBodyCursorPagination( ListUsersBodyCursorPaginationRequest.builder().build()); } - public ListUsersPaginationResponse listWithBodyCursorPagination(ListUsersBodyCursorPaginationRequest request) { - return listWithBodyCursorPagination(request, null); + public void listWithBodyCursorPagination(ListUsersBodyCursorPaginationRequest request) { + listWithBodyCursorPagination(request, null); } - public ListUsersPaginationResponse listWithBodyCursorPagination( + public void listWithBodyCursorPagination( ListUsersBodyCursorPaginationRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -146,7 +146,8 @@ public ListUsersPaginationResponse listWithBodyCursorPagination( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListUsersPaginationResponse.class); + ListUsersPaginationResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListUsersPaginationResponse.class); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; throw new SeedPaginationApiException( @@ -219,16 +220,16 @@ public SyncPagingIterable listWithOffsetPagination( } } - public ListUsersPaginationResponse listWithBodyOffsetPagination() { - return listWithBodyOffsetPagination( + public void listWithBodyOffsetPagination() { + listWithBodyOffsetPagination( ListUsersBodyOffsetPaginationRequest.builder().build()); } - public ListUsersPaginationResponse listWithBodyOffsetPagination(ListUsersBodyOffsetPaginationRequest request) { - return listWithBodyOffsetPagination(request, null); + public void listWithBodyOffsetPagination(ListUsersBodyOffsetPaginationRequest request) { + listWithBodyOffsetPagination(request, null); } - public ListUsersPaginationResponse listWithBodyOffsetPagination( + public void listWithBodyOffsetPagination( ListUsersBodyOffsetPaginationRequest request, RequestOptions requestOptions) { HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -254,7 +255,8 @@ public ListUsersPaginationResponse listWithBodyOffsetPagination( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListUsersPaginationResponse.class); + ListUsersPaginationResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListUsersPaginationResponse.class); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; throw new SeedPaginationApiException( @@ -266,16 +268,16 @@ public ListUsersPaginationResponse listWithBodyOffsetPagination( } } - public ListUsersPaginationResponse listWithOffsetStepPagination() { + public SyncPagingIterable listWithOffsetStepPagination() { return listWithOffsetStepPagination( ListUsersOffsetStepPaginationRequest.builder().build()); } - public ListUsersPaginationResponse listWithOffsetStepPagination(ListUsersOffsetStepPaginationRequest request) { + public SyncPagingIterable listWithOffsetStepPagination(ListUsersOffsetStepPaginationRequest request) { return listWithOffsetStepPagination(request, null); } - public ListUsersPaginationResponse listWithOffsetStepPagination( + public SyncPagingIterable listWithOffsetStepPagination( ListUsersOffsetStepPaginationRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -302,7 +304,16 @@ public ListUsersPaginationResponse listWithOffsetStepPagination( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListUsersPaginationResponse.class); + ListUsersPaginationResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListUsersPaginationResponse.class); + int newPageNumber = request.getPage().map(page -> page + 1).orElse(1); + ListUsersOffsetStepPaginationRequest nextRequest = ListUsersOffsetStepPaginationRequest.builder() + .from(request) + .page(newPageNumber) + .build(); + List result = parsedResponse.getData(); + return new SyncPagingIterable<>( + true, result, () -> listWithOffsetStepPagination(nextRequest, requestOptions)); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; throw new SeedPaginationApiException( @@ -314,17 +325,17 @@ public ListUsersPaginationResponse listWithOffsetStepPagination( } } - public ListUsersPaginationResponse listWithOffsetPaginationHasNextPage() { + public SyncPagingIterable listWithOffsetPaginationHasNextPage() { return listWithOffsetPaginationHasNextPage( ListWithOffsetPaginationHasNextPageRequest.builder().build()); } - public ListUsersPaginationResponse listWithOffsetPaginationHasNextPage( + public SyncPagingIterable listWithOffsetPaginationHasNextPage( ListWithOffsetPaginationHasNextPageRequest request) { return listWithOffsetPaginationHasNextPage(request, null); } - public ListUsersPaginationResponse listWithOffsetPaginationHasNextPage( + public SyncPagingIterable listWithOffsetPaginationHasNextPage( ListWithOffsetPaginationHasNextPageRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) .newBuilder() @@ -351,7 +362,17 @@ public ListUsersPaginationResponse listWithOffsetPaginationHasNextPage( try (Response response = client.newCall(okhttpRequest).execute()) { ResponseBody responseBody = response.body(); if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListUsersPaginationResponse.class); + ListUsersPaginationResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListUsersPaginationResponse.class); + int newPageNumber = request.getPage().map(page -> page + 1).orElse(1); + ListWithOffsetPaginationHasNextPageRequest nextRequest = + ListWithOffsetPaginationHasNextPageRequest.builder() + .from(request) + .page(newPageNumber) + .build(); + List result = parsedResponse.getData(); + return new SyncPagingIterable<>( + true, result, () -> listWithOffsetPaginationHasNextPage(nextRequest, requestOptions)); } String responseBodyString = responseBody != null ? responseBody.string() : "{}"; throw new SeedPaginationApiException( diff --git a/seed/java-sdk/seed.yml b/seed/java-sdk/seed.yml index 39440d985c5..d020c8f2daa 100644 --- a/seed/java-sdk/seed.yml +++ b/seed/java-sdk/seed.yml @@ -1,4 +1,4 @@ -irVersion: v46 +irVersion: v53 displayName: Java SDK changelogLocation: ../../generators/java/sdk/versions.yml image: fernapi/fern-java-sdk @@ -100,3 +100,4 @@ allowedFailures: - query-parameters - trace - unions + - streaming-parameter