-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(java): Fix usage of cursor pagination causing endpoint return typ…
…e to be void (#5708) * fix(java): Fix usage of cursor pagination causing endpoint return type to be void * Add test case * Run seed against new test case * Allow objects with nonempty path to be used for cursor pagination * run seed * Add a utility to find the property type of the desired property within the request body * Add new test case just for deep cursor path * run new fixture * run the fixture * Refactor next page number offset pagination for easier overriding * Fix fixture * Add more test cases * Add test case as expected failure * test udpate * Handle different zero value possibilities for next snippet * Fix nits * Change test definition * Delete pagination gens * delete long snapshots * Delete all complex * Rerun pagination tests --------- Co-authored-by: Alberto <[email protected]> Co-authored-by: fern-support <115122769+fern-api[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ba4f306
commit 8b2b96e
Showing
111 changed files
with
12,034 additions
and
93 deletions.
There are no files selected for viewing
276 changes: 196 additions & 80 deletions
276
...va/sdk/src/main/java/com/fern/java/client/generators/endpoint/AbstractEndpointWriter.java
Large diffs are not rendered by default.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
.../sdk/src/main/java/com/fern/java/client/generators/endpoint/EnrichedCursorPathGetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.fern.java.client.generators.endpoint; | ||
|
||
import com.squareup.javapoet.CodeBlock; | ||
import com.squareup.javapoet.TypeName; | ||
import java.util.Optional; | ||
import org.immutables.value.Value; | ||
|
||
// TODO(ajgateno): This will be necessary until the required IR changes include more information about the path | ||
@Value.Immutable | ||
public interface EnrichedCursorPathGetter { | ||
|
||
EnrichedCursorPathItem pathItem(); | ||
|
||
CodeBlock getter(); | ||
|
||
TypeName typeName(); | ||
|
||
Optional<EnrichedCursorPathGetter> previous(); | ||
|
||
@Value.Default | ||
default boolean optional() { | ||
return false; | ||
} | ||
|
||
default String propertyName() { | ||
return pathItem().name().getCamelCase().getSafeName(); | ||
} | ||
|
||
static ImmutableEnrichedCursorPathGetter.Builder builder() { | ||
return ImmutableEnrichedCursorPathGetter.builder(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...va/sdk/src/main/java/com/fern/java/client/generators/endpoint/EnrichedCursorPathItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.fern.java.client.generators.endpoint; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
import com.fern.ir.model.commons.Name; | ||
import org.immutables.value.Value; | ||
|
||
// TODO(ajgateno): This will be necessary until the required IR changes include more information about the path | ||
@Value.Immutable | ||
@JsonSerialize(as = ImmutableEnrichedCursorPathItem.class) | ||
@JsonDeserialize(as = ImmutableEnrichedCursorPathItem.class) | ||
public interface EnrichedCursorPathItem { | ||
|
||
@JsonProperty("name") | ||
Name name(); | ||
|
||
@Value.Default | ||
@JsonProperty("optional") | ||
default boolean optional() { | ||
return false; | ||
} | ||
|
||
// TODO(ajgateno): Check for wrapped aliases and add a .value to getter if necessary | ||
@Value.Default | ||
@JsonProperty("alias") | ||
default boolean alias() { | ||
return false; | ||
} | ||
|
||
static ImmutableEnrichedCursorPathItem.Builder builder() { | ||
return ImmutableEnrichedCursorPathItem.builder(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
.../sdk/src/main/java/com/fern/java/client/generators/endpoint/EnrichedCursorPathSetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.fern.java.client.generators.endpoint; | ||
|
||
import com.squareup.javapoet.CodeBlock; | ||
import org.immutables.value.Value; | ||
|
||
// TODO(ajgateno): This will be necessary until the required IR changes include more information about the path | ||
@Value.Immutable | ||
public interface EnrichedCursorPathSetter { | ||
|
||
EnrichedCursorPathGetter getter(); | ||
|
||
CodeBlock setter(); | ||
|
||
static ImmutableEnrichedCursorPathSetter.Builder builder() { | ||
return ImmutableEnrichedCursorPathSetter.builder(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.