forked from ExpediaGroup/graphql-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Implement shared response types for GraphQL client generator #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
devin-ai-integration
wants to merge
10
commits into
master
Choose a base branch
from
devin/1758753881-shared-response-types
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9616d18
Implement shared response types for GraphQL client generator
devin-ai-integration[bot] 7292a06
Implement usage-based detection for shared response types
devin-ai-integration[bot] cf6c379
Extend single-operation reuse logic to work across multiple operations
devin-ai-integration[bot] 7cbbc38
Fix import statements and remove redundant null check in GraphQLClien…
devin-ai-integration[bot] cdd87b6
Optimize shared response types implementation by removing expensive t…
devin-ai-integration[bot] 6dcc92b
Clean up code by inlining boolean check and removing unused function
devin-ai-integration[bot] fad11ba
Fix cross_operation_reuse test by creating separate test class for sh…
devin-ai-integration[bot] c396247
Simplify shared response types test structure and integrate useShared…
devin-ai-integration[bot] de3b69d
Rename test directory to cross_operation_reuse_types and update condi…
devin-ai-integration[bot] 3df2b3c
Remove unnecessary filter logic from GraphQLTestUtils.kt
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
33 changes: 33 additions & 0 deletions
33
...n-client-generator/src/test/data/generator/cross_operation_reuse_types/Operation1.graphql
This file contains hidden or 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,33 @@ | ||
| query Operation1 { | ||
| first: complexObjectQuery { | ||
| id | ||
| name | ||
| } | ||
| second: complexObjectQuery { | ||
| id | ||
| name | ||
| details { | ||
| id | ||
| value | ||
| } | ||
| } | ||
| third: complexObjectQuery { | ||
| id | ||
| name | ||
| details { | ||
| id | ||
| } | ||
| } | ||
| fourth: complexObjectQuery { | ||
| id | ||
| name | ||
| } | ||
| fifth: complexObjectQuery { | ||
| id | ||
| name | ||
| details { | ||
| id | ||
| value | ||
| } | ||
| } | ||
| } |
51 changes: 51 additions & 0 deletions
51
...kotlin-client-generator/src/test/data/generator/cross_operation_reuse_types/Operation1.kt
This file contains hidden or 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,51 @@ | ||
| package com.expediagroup.graphql.generated | ||
|
|
||
| import com.expediagroup.graphql.client.Generated | ||
| import com.expediagroup.graphql.client.types.GraphQLClientRequest | ||
| import com.expediagroup.graphql.generated.responses.ComplexObject | ||
| import com.expediagroup.graphql.generated.responses.ComplexObject2 | ||
| import com.expediagroup.graphql.generated.responses.ComplexObject3 | ||
| import com.fasterxml.jackson.`annotation`.JsonProperty | ||
| import kotlin.String | ||
| import kotlin.reflect.KClass | ||
|
|
||
| public const val OPERATION1: String = | ||
| "query Operation1 {\n first: complexObjectQuery {\n id\n name\n }\n second: complexObjectQuery {\n id\n name\n details {\n id\n value\n }\n }\n third: complexObjectQuery {\n id\n name\n details {\n id\n }\n }\n fourth: complexObjectQuery {\n id\n name\n }\n fifth: complexObjectQuery {\n id\n name\n details {\n id\n value\n }\n }\n}" | ||
|
|
||
| @Generated | ||
| public class Operation1 : GraphQLClientRequest<Operation1.Result> { | ||
| override val query: String = OPERATION1 | ||
|
|
||
| override val operationName: String = "Operation1" | ||
|
|
||
| override fun responseType(): KClass<Operation1.Result> = Operation1.Result::class | ||
|
|
||
| @Generated | ||
| public data class Result( | ||
| /** | ||
| * Query returning an object that references another object | ||
| */ | ||
| @get:JsonProperty(value = "first") | ||
| public val first: ComplexObject, | ||
| /** | ||
| * Query returning an object that references another object | ||
| */ | ||
| @get:JsonProperty(value = "second") | ||
| public val second: ComplexObject2, | ||
| /** | ||
| * Query returning an object that references another object | ||
| */ | ||
| @get:JsonProperty(value = "third") | ||
| public val third: ComplexObject3, | ||
| /** | ||
| * Query returning an object that references another object | ||
| */ | ||
| @get:JsonProperty(value = "fourth") | ||
| public val fourth: ComplexObject, | ||
| /** | ||
| * Query returning an object that references another object | ||
| */ | ||
| @get:JsonProperty(value = "fifth") | ||
| public val fifth: ComplexObject2, | ||
| ) | ||
| } |
33 changes: 33 additions & 0 deletions
33
...n-client-generator/src/test/data/generator/cross_operation_reuse_types/Operation2.graphql
This file contains hidden or 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,33 @@ | ||
| query Operation2 { | ||
| first: complexObjectQuery { | ||
| id | ||
| name | ||
| } | ||
| second: complexObjectQuery { | ||
| id | ||
| name | ||
| details { | ||
| id | ||
| value | ||
| } | ||
| } | ||
| third: complexObjectQuery { | ||
| id | ||
| name | ||
| details { | ||
| id | ||
| } | ||
| } | ||
| fourth: complexObjectQuery { | ||
| id | ||
| name | ||
| } | ||
| fifth: complexObjectQuery { | ||
| id | ||
| name | ||
| details { | ||
| id | ||
| value | ||
| } | ||
| } | ||
| } |
51 changes: 51 additions & 0 deletions
51
...kotlin-client-generator/src/test/data/generator/cross_operation_reuse_types/Operation2.kt
This file contains hidden or 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,51 @@ | ||
| package com.expediagroup.graphql.generated | ||
|
|
||
| import com.expediagroup.graphql.client.Generated | ||
| import com.expediagroup.graphql.client.types.GraphQLClientRequest | ||
| import com.expediagroup.graphql.generated.responses.ComplexObject | ||
| import com.expediagroup.graphql.generated.responses.ComplexObject2 | ||
| import com.expediagroup.graphql.generated.responses.ComplexObject3 | ||
| import com.fasterxml.jackson.`annotation`.JsonProperty | ||
| import kotlin.String | ||
| import kotlin.reflect.KClass | ||
|
|
||
| public const val OPERATION2: String = | ||
| "query Operation2 {\n first: complexObjectQuery {\n id\n name\n }\n second: complexObjectQuery {\n id\n name\n details {\n id\n value\n }\n }\n third: complexObjectQuery {\n id\n name\n details {\n id\n }\n }\n fourth: complexObjectQuery {\n id\n name\n }\n fifth: complexObjectQuery {\n id\n name\n details {\n id\n value\n }\n }\n}" | ||
|
|
||
| @Generated | ||
| public class Operation2 : GraphQLClientRequest<Operation2.Result> { | ||
| override val query: String = OPERATION2 | ||
|
|
||
| override val operationName: String = "Operation2" | ||
|
|
||
| override fun responseType(): KClass<Operation2.Result> = Operation2.Result::class | ||
|
|
||
| @Generated | ||
| public data class Result( | ||
| /** | ||
| * Query returning an object that references another object | ||
| */ | ||
| @get:JsonProperty(value = "first") | ||
| public val first: ComplexObject, | ||
| /** | ||
| * Query returning an object that references another object | ||
| */ | ||
| @get:JsonProperty(value = "second") | ||
| public val second: ComplexObject2, | ||
| /** | ||
| * Query returning an object that references another object | ||
| */ | ||
| @get:JsonProperty(value = "third") | ||
| public val third: ComplexObject3, | ||
| /** | ||
| * Query returning an object that references another object | ||
| */ | ||
| @get:JsonProperty(value = "fourth") | ||
| public val fourth: ComplexObject, | ||
| /** | ||
| * Query returning an object that references another object | ||
| */ | ||
| @get:JsonProperty(value = "fifth") | ||
| public val fifth: ComplexObject2, | ||
| ) | ||
| } |
25 changes: 25 additions & 0 deletions
25
...-generator/src/test/data/generator/cross_operation_reuse_types/responses/ComplexObject.kt
This file contains hidden or 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,25 @@ | ||
| package com.expediagroup.graphql.generated.responses | ||
|
|
||
| import com.expediagroup.graphql.client.Generated | ||
| import com.fasterxml.jackson.`annotation`.JsonProperty | ||
| import kotlin.Int | ||
| import kotlin.String | ||
|
|
||
| /** | ||
| * Multi line description of a complex type. | ||
| * This is a second line of the paragraph. | ||
| * This is final line of the description. | ||
| */ | ||
| @Generated | ||
| public data class ComplexObject( | ||
| /** | ||
| * Some unique identifier | ||
| */ | ||
| @get:JsonProperty(value = "id") | ||
| public val id: Int, | ||
| /** | ||
| * Some object name | ||
| */ | ||
| @get:JsonProperty(value = "name") | ||
| public val name: String, | ||
| ) |
30 changes: 30 additions & 0 deletions
30
...generator/src/test/data/generator/cross_operation_reuse_types/responses/ComplexObject2.kt
This file contains hidden or 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,30 @@ | ||
| package com.expediagroup.graphql.generated.responses | ||
|
|
||
| import com.expediagroup.graphql.client.Generated | ||
| import com.fasterxml.jackson.`annotation`.JsonProperty | ||
| import kotlin.Int | ||
| import kotlin.String | ||
|
|
||
| /** | ||
| * Multi line description of a complex type. | ||
| * This is a second line of the paragraph. | ||
| * This is final line of the description. | ||
| */ | ||
| @Generated | ||
| public data class ComplexObject2( | ||
| /** | ||
| * Some unique identifier | ||
| */ | ||
| @get:JsonProperty(value = "id") | ||
| public val id: Int, | ||
| /** | ||
| * Some object name | ||
| */ | ||
| @get:JsonProperty(value = "name") | ||
| public val name: String, | ||
| /** | ||
| * Some additional details | ||
| */ | ||
| @get:JsonProperty(value = "details") | ||
| public val details: DetailsObject, | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
place these files in plugins/client/graphql-kotlin-client-generator/src/test/data/generator/cross_operation_reuse_types