-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ExpediaGroup:master' into ktor-version-3
- Loading branch information
Showing
19 changed files
with
310 additions
and
63 deletions.
There are no files selected for viewing
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
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
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
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
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
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
25 changes: 25 additions & 0 deletions
25
...lient-generator/src/test/data/generator/union_same_selections/UnionSameSelections.graphql
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,25 @@ | ||
query UnionSameSelections { | ||
message1 { | ||
__typename | ||
... on ProductRatingLink { | ||
link { | ||
text | ||
} | ||
action { | ||
text | ||
} | ||
} | ||
... on EGDSPlainText { | ||
text | ||
} | ||
} | ||
message2 { | ||
__typename | ||
... on EGDSParagraph { | ||
text | ||
} | ||
... on EGDSPlainText { | ||
text | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...lin-client-generator/src/test/data/generator/union_same_selections/UnionSameSelections.kt
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,31 @@ | ||
package com.expediagroup.graphql.generated | ||
|
||
import com.expediagroup.graphql.client.Generated | ||
import com.expediagroup.graphql.client.types.GraphQLClientRequest | ||
import com.expediagroup.graphql.generated.unionsameselections.ProductRatingSupportingMessage | ||
import com.expediagroup.graphql.generated.unionsameselections.ProductSupportingMessage | ||
import com.fasterxml.jackson.`annotation`.JsonProperty | ||
import kotlin.String | ||
import kotlin.collections.List | ||
import kotlin.reflect.KClass | ||
|
||
public const val UNION_SAME_SELECTIONS: String = | ||
"query UnionSameSelections {\n message1 {\n __typename\n ... on ProductRatingLink {\n link {\n text\n }\n action {\n text\n }\n }\n ... on EGDSPlainText {\n text\n }\n }\n message2 {\n __typename\n ... on EGDSParagraph {\n text\n }\n ... on EGDSPlainText {\n text\n }\n }\n}" | ||
|
||
@Generated | ||
public class UnionSameSelections : GraphQLClientRequest<UnionSameSelections.Result> { | ||
override val query: String = UNION_SAME_SELECTIONS | ||
|
||
override val operationName: String = "UnionSameSelections" | ||
|
||
override fun responseType(): KClass<UnionSameSelections.Result> = | ||
UnionSameSelections.Result::class | ||
|
||
@Generated | ||
public data class Result( | ||
@get:JsonProperty(value = "message1") | ||
public val message1: List<ProductRatingSupportingMessage>, | ||
@get:JsonProperty(value = "message2") | ||
public val message2: List<ProductSupportingMessage>, | ||
) | ||
} |
11 changes: 11 additions & 0 deletions
11
...ta/generator/union_same_selections/unionsameselections/EGDSProductRatingShowTextAction.kt
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,11 @@ | ||
package com.expediagroup.graphql.generated.unionsameselections | ||
|
||
import com.expediagroup.graphql.client.Generated | ||
import com.fasterxml.jackson.`annotation`.JsonProperty | ||
import kotlin.String | ||
|
||
@Generated | ||
public data class EGDSProductRatingShowTextAction( | ||
@get:JsonProperty(value = "text") | ||
public val text: String, | ||
) |
11 changes: 11 additions & 0 deletions
11
...tor/src/test/data/generator/union_same_selections/unionsameselections/EGDSStandardLink.kt
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,11 @@ | ||
package com.expediagroup.graphql.generated.unionsameselections | ||
|
||
import com.expediagroup.graphql.client.Generated | ||
import com.fasterxml.jackson.`annotation`.JsonProperty | ||
import kotlin.String | ||
|
||
@Generated | ||
public data class EGDSStandardLink( | ||
@get:JsonProperty(value = "text") | ||
public val text: String, | ||
) |
44 changes: 44 additions & 0 deletions
44
...ata/generator/union_same_selections/unionsameselections/ProductRatingSupportingMessage.kt
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,44 @@ | ||
package com.expediagroup.graphql.generated.unionsameselections | ||
|
||
import com.expediagroup.graphql.client.Generated | ||
import com.fasterxml.jackson.`annotation`.JsonProperty | ||
import com.fasterxml.jackson.`annotation`.JsonSubTypes | ||
import com.fasterxml.jackson.`annotation`.JsonTypeInfo | ||
import com.fasterxml.jackson.`annotation`.JsonTypeInfo.As.PROPERTY | ||
import com.fasterxml.jackson.`annotation`.JsonTypeInfo.Id.NAME | ||
import kotlin.String | ||
|
||
@Generated | ||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.PROPERTY, | ||
property = "__typename", | ||
defaultImpl = DefaultProductRatingSupportingMessageImplementation::class, | ||
) | ||
@JsonSubTypes(value = [com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = | ||
ProductRatingLink::class, | ||
name="ProductRatingLink"),com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = | ||
EGDSPlainText::class, name="EGDSPlainText")]) | ||
public interface ProductRatingSupportingMessage | ||
|
||
@Generated | ||
public data class ProductRatingLink( | ||
@get:JsonProperty(value = "link") | ||
public val link: EGDSStandardLink, | ||
@get:JsonProperty(value = "action") | ||
public val action: EGDSProductRatingShowTextAction, | ||
) : ProductRatingSupportingMessage | ||
|
||
@Generated | ||
public data class EGDSPlainText( | ||
@get:JsonProperty(value = "text") | ||
public val text: String, | ||
) : ProductRatingSupportingMessage, | ||
ProductSupportingMessage | ||
|
||
/** | ||
* Fallback ProductRatingSupportingMessage implementation that will be used when unknown/unhandled | ||
* type is encountered. | ||
*/ | ||
@Generated | ||
public class DefaultProductRatingSupportingMessageImplementation() : ProductRatingSupportingMessage |
35 changes: 35 additions & 0 deletions
35
...test/data/generator/union_same_selections/unionsameselections/ProductSupportingMessage.kt
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,35 @@ | ||
package com.expediagroup.graphql.generated.unionsameselections | ||
|
||
import com.expediagroup.graphql.client.Generated | ||
import com.fasterxml.jackson.`annotation`.JsonProperty | ||
import com.fasterxml.jackson.`annotation`.JsonSubTypes | ||
import com.fasterxml.jackson.`annotation`.JsonTypeInfo | ||
import com.fasterxml.jackson.`annotation`.JsonTypeInfo.As.PROPERTY | ||
import com.fasterxml.jackson.`annotation`.JsonTypeInfo.Id.NAME | ||
import kotlin.String | ||
|
||
@Generated | ||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.PROPERTY, | ||
property = "__typename", | ||
defaultImpl = DefaultProductSupportingMessageImplementation::class, | ||
) | ||
@JsonSubTypes(value = [com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = | ||
EGDSParagraph::class, | ||
name="EGDSParagraph"),com.fasterxml.jackson.annotation.JsonSubTypes.Type(value = | ||
EGDSPlainText::class, name="EGDSPlainText")]) | ||
public interface ProductSupportingMessage | ||
|
||
@Generated | ||
public data class EGDSParagraph( | ||
@get:JsonProperty(value = "text") | ||
public val text: String, | ||
) : ProductSupportingMessage | ||
|
||
/** | ||
* Fallback ProductSupportingMessage implementation that will be used when unknown/unhandled type is | ||
* encountered. | ||
*/ | ||
@Generated | ||
public class DefaultProductSupportingMessageImplementation() : ProductSupportingMessage |
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
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
33 changes: 33 additions & 0 deletions
33
...lvm-metadata-generator/src/test/kotlin/MetadataCapturingDataFetcherFactoryProviderTest.kt
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,33 @@ | ||
import com.expediagroup.graphql.plugin.graalvm.MetadataCapturingDataFetcherFactoryProvider | ||
import com.expediagroup.graphql.plugin.graalvm.enums.EnumQuery | ||
import io.github.classgraph.ClassGraph | ||
import io.github.classgraph.ScanResult | ||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import kotlin.reflect.KFunction | ||
|
||
class MetadataCapturingDataFetcherFactoryProviderTest { | ||
|
||
private lateinit var scanResult: ScanResult | ||
private lateinit var provider: MetadataCapturingDataFetcherFactoryProvider | ||
|
||
@BeforeEach | ||
fun setup() { | ||
scanResult = ClassGraph().enableAllInfo().acceptPackages("com.expediagroup.graphql.plugin.graalvm").scan() | ||
provider = MetadataCapturingDataFetcherFactoryProvider(scanResult, listOf("com.expediagroup.graphql.plugin.graalvm")) | ||
|
||
val kClass = EnumQuery::class | ||
val kFunction = kClass.members.find { it.name == "enumArgQuery" } as KFunction<*> | ||
provider.functionDataFetcherFactory(null, kClass, kFunction) | ||
} | ||
|
||
@Test | ||
fun `reflectMetadata should not be empty`() { | ||
val metadata = provider.reflectMetadata() | ||
|
||
Assertions.assertNotNull(metadata) | ||
Assertions.assertTrue(metadata.isNotEmpty(), "Reflect metadata should not be empty") | ||
Assertions.assertEquals(listOf("com.expediagroup.graphql.plugin.graalvm"), provider.supportedPackages) | ||
} | ||
} |
Oops, something went wrong.