From 60879c5a6888693698ff33c326fcd5cc9aa9ac5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Salay?= <11751660+SalyczeQ@users.noreply.github.com> Date: Wed, 12 Jun 2024 22:55:22 -0600 Subject: [PATCH] feat(client): update jackson client generation to always annotate all fields (#1976) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### :pencil: Description Update Jackson client generation logic to always annotate all fields with @get:JsonProperty. This is a workaround to Jackson limitations due to its reliance on reflections to find getters/setters following JavaBean naming conventions. Simple mutation: ``` graphql mutation CreateIssuedInvoice($input: IssuedInvoiceInput!) { CreateIssuedInvoice(IssuedInvoice: $input) { ID Stav CisloDokladu } } ``` Genarated before change: ```kotlin public const val CREATE_ISSUED_INVOICE: String = "mutation CreateIssuedInvoice(${'$'}input: IssuedInvoiceInput!) {\n CreateIssuedInvoice(IssuedInvoice: ${'$'}input) {\n ID\n Stav\n CisloDokladu\n }\n}" @Generated public class CreateIssuedInvoice( override val variables: CreateIssuedInvoice.Variables, ) : GraphQLClientRequest { override val query: String = CREATE_ISSUED_INVOICE override val operationName: String = "CreateIssuedInvoice" override fun responseType(): KClass = CreateIssuedInvoice.Result::class @Generated public data class Variables( @get:JsonProperty(value = "input") public val input: IssuedInvoiceInput, ) /** * Dotazy pro zápis, editaci a mazání S5 objektů */ @Generated public data class Result( /** * Faktura vydaná (zápis) */ public val CreateIssuedInvoice: IssuedInvoice? = null, ) } ``` Genareted after change: ```kotlin public const val CREATE_ISSUED_INVOICE: String = "mutation CreateIssuedInvoice(${'$'}input: IssuedInvoiceInput!) {\n CreateIssuedInvoice(IssuedInvoice: ${'$'}input) {\n ID\n Stav\n CisloDokladu\n }\n}" @Generated public class CreateIssuedInvoice( override val variables: CreateIssuedInvoice.Variables, ) : GraphQLClientRequest { override val query: String = CREATE_ISSUED_INVOICE override val operationName: String = "CreateIssuedInvoice" override fun responseType(): KClass = CreateIssuedInvoice.Result::class @Generated public data class Variables( @get:JsonProperty(value = "input") public val input: IssuedInvoiceInput, ) /** * Dotazy pro zápis, editaci a mazání S5 objektů */ @Generated public data class Result( /** * Faktura vydaná (zápis) */ @get:JsonProperty("CreateIssuedInvoice") public val CreateIssuedInvoice: IssuedInvoice? = null, ) } ``` data class IssuedInvoice **before** change: ```kotlin @Generated public data class IssuedInvoice( /** * ID */ @JsonSerialize(converter = UUIDToAnyConverter::class) @JsonDeserialize(converter = AnyToUUIDConverter::class) public val ID: UUID? = null, /** * Stav */ public val Stav: Int? = null, /** * Číslo dokladu */ public val CisloDokladu: String? = null, ) ``` data class IssuedInvoice **after** change: ```kotlin @Generated public data class IssuedInvoice( /** * ID */ @JsonSerialize(converter = UUIDToAnyConverter::class) @JsonDeserialize(converter = AnyToUUIDConverter::class) @get:JsonProperty("ID") public val ID: UUID? = null, /** * Stav */ @get:JsonProperty("Stav") public val Stav: Int? = null, /** * Číslo dokladu */ @get:JsonProperty("CisloDokladu") public val CisloDokladu: String? = null, ) ``` ### :link: Related Issues https://kotlinlang.slack.com/archives/CQLNT7B29/p1717655752084109 --- .../client/generator/types/generatePropertySpecs.kt | 12 ++++++++++++ .../src/test/data/generator/alias/AliasQuery.kt | 3 +++ .../data/generator/alias_nested/AliasNestedQuery.kt | 3 +++ .../alias_nested/aliasnestedquery/ComplexObject.kt | 2 ++ .../alias_nested/aliasnestedquery/ComplexObject2.kt | 2 ++ .../generator/documentation/DocumentationQuery.kt | 2 ++ .../documentation/documentationquery/DocObject.kt | 2 ++ .../IncludeSkipDirectivesQuery.kt | 2 ++ .../includeskipdirectivesquery/ScalarWrapper.kt | 2 ++ .../input_hard_coded/HardCodedInputQuery.kt | 2 ++ .../data/generator/input_lists/InputListQuery.kt | 1 + .../SelfReferencingInputQuery.kt | 1 + .../DifferentSelectionSetQuery.kt | 3 +++ .../differentselectionsetquery/BasicInterface.kt | 11 +++++++++++ .../differentselectionsetquery/BasicInterface2.kt | 7 +++++++ .../DifferentSelectionSetQuery.kt | 3 +++ .../differentselectionsetquery/BasicInterface.kt | 7 +++++++ .../differentselectionsetquery/BasicInterface2.kt | 9 +++++++++ .../InterfaceMissingTypeSelection.kt | 2 ++ .../interfacemissingtypeselection/BasicInterface.kt | 8 ++++++++ .../InterfaceWithNamedFragmentsQuery.kt | 2 ++ .../BasicInterface.kt | 11 +++++++++++ .../test/data/generator/mutation/SimpleMutation.kt | 1 + .../generator/mutation/simplemutation/BasicObject.kt | 3 +++ .../DifferentSelectionsQuery.kt | 3 +++ .../differentselectionsquery/ComplexObject.kt | 3 +++ .../differentselectionsquery/ComplexObject2.kt | 4 ++++ .../differentselectionsquery/DetailsObject.kt | 3 +++ .../DifferentSubselectionQuery.kt | 3 +++ .../differentsubselectionquery/ComplexObject.kt | 4 ++++ .../differentsubselectionquery/ComplexObject2.kt | 4 ++++ .../differentsubselectionquery/DetailsObject.kt | 4 ++++ .../differentsubselectionquery/DetailsObject2.kt | 3 +++ .../src/test/data/generator/object_list/ListQuery.kt | 2 ++ .../generator/object_list/listquery/BasicObject.kt | 3 +++ .../ObjectWithNamedFragmentQuery.kt | 2 ++ .../objectwithnamedfragmentquery/ComplexObject.kt | 4 ++++ .../objectwithnamedfragmentquery/DetailsObject.kt | 2 ++ .../generator/object_self_reference/NestedQuery.kt | 2 ++ .../nestedquery/NestedObject.kt | 4 ++++ .../nestedquery/NestedObject2.kt | 3 +++ .../nestedquery/NestedObject3.kt | 4 ++++ .../nestedquery/NestedObject4.kt | 3 +++ .../operation_name_missing/AnonymousQuery.kt | 2 ++ .../anonymousquery/ScalarWrapper.kt | 2 ++ .../operation_name_unchanged/MiXEDcaSEQuery.kt | 2 ++ .../mixedcasequery/ScalarWrapper.kt | 2 ++ .../reuse_list_types/ReusedListTypesQuery.kt | 8 ++++++++ .../reusedlisttypesquery/BasicObject.kt | 3 +++ .../reusedlisttypesquery/BasicObject2.kt | 2 ++ .../reusedlisttypesquery/BasicObject3.kt | 2 ++ .../reusedlisttypesquery/ComplexObject.kt | 4 ++++ .../reusedlisttypesquery/ComplexObject2.kt | 4 ++++ .../reusedlisttypesquery/ComplexObject3.kt | 3 +++ .../data/generator/reuse_types/ReusedTypesQuery.kt | 6 ++++++ .../reuse_types/reusedtypesquery/ComplexObject.kt | 3 +++ .../reuse_types/reusedtypesquery/ComplexObject2.kt | 4 ++++ .../reuse_types/reusedtypesquery/ComplexObject3.kt | 4 ++++ .../reuse_types/reusedtypesquery/DetailsObject.kt | 3 +++ .../reuse_types/reusedtypesquery/DetailsObject2.kt | 2 ++ .../generator/scalar_typealias/ScalarAliasQuery.kt | 2 ++ .../scalaraliasquery/ScalarWrapper.kt | 3 +++ .../DifferentSelectionSetQuery.kt | 3 +++ .../differentselectionsetquery/BasicUnion.kt | 3 +++ .../differentselectionsetquery/BasicUnion2.kt | 3 +++ .../DifferentSelectionSetQuery.kt | 3 +++ .../differentselectionsetquery/BasicUnion.kt | 6 ++++++ .../differentselectionsetquery/ComplexObject2.kt | 4 ++++ .../differentselectionsetquery/DetailsObject.kt | 2 ++ .../union_missing_types/UnionMissingTypeSelection.kt | 2 ++ .../unionmissingtypeselection/BasicUnion.kt | 3 +++ .../UnionQueryWithNamedFragments.kt | 2 ++ .../unionquerywithnamedfragments/BasicUnion.kt | 6 ++++++ .../custom_scalar_input/CustomScalarInputQuery.kt | 1 + .../data/jackson/custom_scalars/CustomScalarQuery.kt | 2 ++ .../customscalarquery/ScalarWrapper.kt | 5 +++++ .../src/test/data/jackson/enums/EnumQuery.kt | 3 +++ .../interface/InterfaceWithInlineFragmentsQuery.kt | 2 ++ .../BasicInterface.kt | 11 +++++++++++ .../test/data/jackson/object/ComplexObjectQuery.kt | 2 ++ .../object/complexobjectquery/ComplexObject.kt | 5 +++++ .../object/complexobjectquery/DetailsObject.kt | 4 ++++ .../jackson/union/UnionQueryWithInlineFragments.kt | 2 ++ .../unionquerywithinlinefragments/BasicUnion.kt | 6 ++++++ .../test/data/jackson/variables/JacksonInputQuery.kt | 1 + 85 files changed, 303 insertions(+) diff --git a/plugins/client/graphql-kotlin-client-generator/src/main/kotlin/com/expediagroup/graphql/plugin/client/generator/types/generatePropertySpecs.kt b/plugins/client/graphql-kotlin-client-generator/src/main/kotlin/com/expediagroup/graphql/plugin/client/generator/types/generatePropertySpecs.kt index 4d9c14251c..c3436e6fd3 100755 --- a/plugins/client/graphql-kotlin-client-generator/src/main/kotlin/com/expediagroup/graphql/plugin/client/generator/types/generatePropertySpecs.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/main/kotlin/com/expediagroup/graphql/plugin/client/generator/types/generatePropertySpecs.kt @@ -17,10 +17,12 @@ package com.expediagroup.graphql.plugin.client.generator.types import com.expediagroup.graphql.plugin.client.generator.GraphQLClientGeneratorContext +import com.expediagroup.graphql.plugin.client.generator.GraphQLSerializer import com.expediagroup.graphql.plugin.client.generator.ScalarConverterInfo import com.expediagroup.graphql.plugin.client.generator.exceptions.DeprecatedFieldsSelectedException import com.expediagroup.graphql.plugin.client.generator.exceptions.InvalidSelectionSetException import com.expediagroup.graphql.plugin.client.generator.exceptions.MissingArgumentException +import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.squareup.kotlinpoet.AnnotationSpec @@ -96,6 +98,16 @@ internal fun generatePropertySpecs( fieldDefinition.description?.content?.let { kdoc -> propertySpecBuilder.addKdoc("%L", kdoc) } + if (context.serializer == GraphQLSerializer.JACKSON) { + // always add @get:JsonProperty annotation as a workaround to Jackson limitations + // related to JavaBean naming conventions + propertySpecBuilder.addAnnotation( + AnnotationSpec.builder(JsonProperty::class) + .useSiteTarget(AnnotationSpec.UseSiteTarget.GET) + .addMember("value = \"$fieldName\"") + .build() + ) + } propertySpecBuilder.build() } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias/AliasQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias/AliasQuery.kt index f0e43a2a03..42a41042fa 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias/AliasQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias/AliasQuery.kt @@ -2,6 +2,7 @@ package com.expediagroup.graphql.generated import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Boolean import kotlin.String import kotlin.reflect.KClass @@ -22,10 +23,12 @@ public class AliasQuery : GraphQLClientRequest { /** * Query that accepts some input arguments */ + @get:JsonProperty(value = "first") public val first: Boolean, /** * Query that accepts some input arguments */ + @get:JsonProperty(value = "second") public val second: Boolean, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/AliasNestedQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/AliasNestedQuery.kt index d9e996b495..ad5bb69e93 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/AliasNestedQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/AliasNestedQuery.kt @@ -4,6 +4,7 @@ import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.aliasnestedquery.ComplexObject import com.expediagroup.graphql.generated.aliasnestedquery.ComplexObject2 +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -23,10 +24,12 @@ public class AliasNestedQuery : GraphQLClientRequest { /** * 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, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/aliasnestedquery/ComplexObject.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/aliasnestedquery/ComplexObject.kt index 67384da863..9cb2770c0f 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/aliasnestedquery/ComplexObject.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/aliasnestedquery/ComplexObject.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.aliasnestedquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String /** @@ -13,5 +14,6 @@ public data class ComplexObject( /** * Some object name */ + @get:JsonProperty(value = "nameA") public val nameA: String, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/aliasnestedquery/ComplexObject2.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/aliasnestedquery/ComplexObject2.kt index 3dac9e25b2..b0d2a28f76 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/aliasnestedquery/ComplexObject2.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/alias_nested/aliasnestedquery/ComplexObject2.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.aliasnestedquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String /** @@ -13,5 +14,6 @@ public data class ComplexObject2( /** * Some object name */ + @get:JsonProperty(value = "nameB") public val nameB: String, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/documentation/DocumentationQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/documentation/DocumentationQuery.kt index 65614f59be..921dcfc2f8 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/documentation/DocumentationQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/documentation/DocumentationQuery.kt @@ -3,6 +3,7 @@ package com.expediagroup.graphql.generated import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.documentationquery.DocObject +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -22,6 +23,7 @@ public class DocumentationQuery : GraphQLClientRequest { /** * Query returning list of simple objects */ + @get:JsonProperty(value = "listQuery") public val listQuery: List, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_list/listquery/BasicObject.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_list/listquery/BasicObject.kt index 6df0a9fbed..ef91f2c75a 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_list/listquery/BasicObject.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_list/listquery/BasicObject.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.listquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String @@ -9,9 +10,11 @@ import kotlin.String */ @Generated public data class BasicObject( + @get:JsonProperty(value = "id") public val id: Int, /** * Object name */ + @get:JsonProperty(value = "name") public val name: String, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/ObjectWithNamedFragmentQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/ObjectWithNamedFragmentQuery.kt index db57859b2b..3c51e22ef6 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/ObjectWithNamedFragmentQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/ObjectWithNamedFragmentQuery.kt @@ -3,6 +3,7 @@ package com.expediagroup.graphql.generated import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.objectwithnamedfragmentquery.ComplexObject +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -24,6 +25,7 @@ public class ObjectWithNamedFragmentQuery : /** * Query returning an object that references another object */ + @get:JsonProperty(value = "complexObjectQuery") public val complexObjectQuery: ComplexObject, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/objectwithnamedfragmentquery/ComplexObject.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/objectwithnamedfragmentquery/ComplexObject.kt index 273c559dc9..ed20d6f8f3 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/objectwithnamedfragmentquery/ComplexObject.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/objectwithnamedfragmentquery/ComplexObject.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.objectwithnamedfragmentquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String @@ -14,13 +15,16 @@ 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, /** * Some additional details */ + @get:JsonProperty(value = "details") public val details: DetailsObject, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/objectwithnamedfragmentquery/DetailsObject.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/objectwithnamedfragmentquery/DetailsObject.kt index 566f257681..a9f40fe324 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/objectwithnamedfragmentquery/DetailsObject.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_named_fragments/objectwithnamedfragmentquery/DetailsObject.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.objectwithnamedfragmentquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String /** @@ -11,5 +12,6 @@ public data class DetailsObject( /** * Actual detail value */ + @get:JsonProperty(value = "value") public val `value`: String, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/NestedQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/NestedQuery.kt index 43e7888fca..701acc8e86 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/NestedQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/NestedQuery.kt @@ -3,6 +3,7 @@ package com.expediagroup.graphql.generated import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.nestedquery.NestedObject +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -22,6 +23,7 @@ public class NestedQuery : GraphQLClientRequest { /** * Query returning object referencing itself */ + @get:JsonProperty(value = "nestedObjectQuery") public val nestedObjectQuery: NestedObject, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject.kt index af566c4215..02675cf684 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.nestedquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String import kotlin.collections.List @@ -13,13 +14,16 @@ public data class NestedObject( /** * Unique identifier */ + @get:JsonProperty(value = "id") public val id: Int, /** * Name of the object */ + @get:JsonProperty(value = "name") public val name: String, /** * Children elements */ + @get:JsonProperty(value = "children") public val children: List, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject2.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject2.kt index afef1b3389..d38eff8b7a 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject2.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject2.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.nestedquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.collections.List @@ -12,9 +13,11 @@ public data class NestedObject2( /** * Name of the object */ + @get:JsonProperty(value = "name") public val name: String, /** * Children elements */ + @get:JsonProperty(value = "children") public val children: List, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject3.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject3.kt index dd87c34255..b8a9cc92ac 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject3.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject3.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.nestedquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String import kotlin.collections.List @@ -13,13 +14,16 @@ public data class NestedObject3( /** * Unique identifier */ + @get:JsonProperty(value = "id") public val id: Int, /** * Name of the object */ + @get:JsonProperty(value = "name") public val name: String, /** * Children elements */ + @get:JsonProperty(value = "children") public val children: List, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject4.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject4.kt index 6c91dd103b..ea2f379db5 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject4.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/object_self_reference/nestedquery/NestedObject4.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.nestedquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String @@ -12,9 +13,11 @@ public data class NestedObject4( /** * Unique identifier */ + @get:JsonProperty(value = "id") public val id: Int, /** * Name of the object */ + @get:JsonProperty(value = "name") public val name: String, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_missing/AnonymousQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_missing/AnonymousQuery.kt index 5d4c479c22..40c1e724f7 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_missing/AnonymousQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_missing/AnonymousQuery.kt @@ -3,6 +3,7 @@ package com.expediagroup.graphql.generated import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.anonymousquery.ScalarWrapper +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -19,6 +20,7 @@ public class AnonymousQuery : GraphQLClientRequest { /** * Query that returns wrapper object with all supported scalar types */ + @get:JsonProperty(value = "scalarQuery") public val scalarQuery: ScalarWrapper, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_missing/anonymousquery/ScalarWrapper.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_missing/anonymousquery/ScalarWrapper.kt index 2cea6fac4b..719e5936a8 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_missing/anonymousquery/ScalarWrapper.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_missing/anonymousquery/ScalarWrapper.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.anonymousquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String /** @@ -11,5 +12,6 @@ public data class ScalarWrapper( /** * UTF-8 character sequence */ + @get:JsonProperty(value = "name") public val name: String, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_unchanged/MiXEDcaSEQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_unchanged/MiXEDcaSEQuery.kt index c984ddb904..4a003e6075 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_unchanged/MiXEDcaSEQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_unchanged/MiXEDcaSEQuery.kt @@ -3,6 +3,7 @@ package com.expediagroup.graphql.generated import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.mixedcasequery.ScalarWrapper +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -22,6 +23,7 @@ public class MiXEDcaSEQuery : GraphQLClientRequest { /** * Query that returns wrapper object with all supported scalar types */ + @get:JsonProperty(value = "scalarQuery") public val scalarQuery: ScalarWrapper, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_unchanged/mixedcasequery/ScalarWrapper.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_unchanged/mixedcasequery/ScalarWrapper.kt index 522113980e..f478b3a271 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_unchanged/mixedcasequery/ScalarWrapper.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/operation_name_unchanged/mixedcasequery/ScalarWrapper.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.mixedcasequery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String /** @@ -11,5 +12,6 @@ public data class ScalarWrapper( /** * UTF-8 character sequence */ + @get:JsonProperty(value = "name") public val name: String, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/ReusedListTypesQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/ReusedListTypesQuery.kt index 67372c0cf6..6c2ffabfce 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/ReusedListTypesQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/ReusedListTypesQuery.kt @@ -7,6 +7,7 @@ import com.expediagroup.graphql.generated.reusedlisttypesquery.BasicObject2 import com.expediagroup.graphql.generated.reusedlisttypesquery.ComplexObject import com.expediagroup.graphql.generated.reusedlisttypesquery.ComplexObject2 import com.expediagroup.graphql.generated.reusedlisttypesquery.ComplexObject3 +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.collections.List import kotlin.reflect.KClass @@ -28,30 +29,37 @@ public class ReusedListTypesQuery : GraphQLClientRequest, /** * Query returning list of simple objects */ + @get:JsonProperty(value = "second") public val second: List, /** * Query returning list of simple objects */ + @get:JsonProperty(value = "third") public val third: List, /** * Query returning an object that references another object */ + @get:JsonProperty(value = "firstComplex") public val firstComplex: ComplexObject, /** * Query returning an object that references another object */ + @get:JsonProperty(value = "secondComplex") public val secondComplex: ComplexObject, /** * Query returning an object that references another object */ + @get:JsonProperty(value = "thirdComplex") public val thirdComplex: ComplexObject2, /** * Query returning an object that references another object */ + @get:JsonProperty(value = "fourthComplex") public val fourthComplex: ComplexObject3, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject.kt index bf0da701f3..7d987700cc 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedlisttypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String @@ -9,9 +10,11 @@ import kotlin.String */ @Generated public data class BasicObject( + @get:JsonProperty(value = "id") public val id: Int, /** * Object name */ + @get:JsonProperty(value = "name") public val name: String, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject2.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject2.kt index 0b69f401cb..235b95669c 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject2.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject2.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedlisttypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String /** @@ -11,5 +12,6 @@ public data class BasicObject2( /** * Object name */ + @get:JsonProperty(value = "name") public val name: String, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject3.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject3.kt index 23ba0109af..2780ffe6e8 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject3.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/BasicObject3.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedlisttypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int /** @@ -8,5 +9,6 @@ import kotlin.Int */ @Generated public data class BasicObject3( + @get:JsonProperty(value = "id") public val id: Int, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject.kt index 3784aba835..105b19e702 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedlisttypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String import kotlin.collections.List @@ -15,13 +16,16 @@ 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, /** * List of objects */ + @get:JsonProperty(value = "basicList") public val basicList: List, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject2.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject2.kt index b345f8e72b..1e3ef6bee9 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject2.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject2.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedlisttypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String import kotlin.collections.List @@ -15,13 +16,16 @@ 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, /** * List of objects */ + @get:JsonProperty(value = "basicList") public val basicList: List, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject3.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject3.kt index b30e439772..f9cadbfb51 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject3.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_list_types/reusedlisttypesquery/ComplexObject3.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedlisttypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.collections.List @@ -14,9 +15,11 @@ public data class ComplexObject3( /** * Some unique identifier */ + @get:JsonProperty(value = "id") public val id: Int, /** * List of objects */ + @get:JsonProperty(value = "basicList") public val basicList: List, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/ReusedTypesQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/ReusedTypesQuery.kt index 4afd457d91..248b064f39 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/ReusedTypesQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/ReusedTypesQuery.kt @@ -5,6 +5,7 @@ import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.reusedtypesquery.ComplexObject import com.expediagroup.graphql.generated.reusedtypesquery.ComplexObject2 import com.expediagroup.graphql.generated.reusedtypesquery.ComplexObject3 +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -24,22 +25,27 @@ public class ReusedTypesQuery : GraphQLClientRequest { /** * 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, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject.kt index 193aad8b3f..d92ba850a8 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedtypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String @@ -14,9 +15,11 @@ 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, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject2.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject2.kt index 7e85a94e6c..54547494b7 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject2.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject2.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedtypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String @@ -14,13 +15,16 @@ 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, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject3.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject3.kt index 8108e48abf..237a9bccd0 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject3.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/ComplexObject3.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedtypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String @@ -14,13 +15,16 @@ public data class ComplexObject3( /** * 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: DetailsObject2, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/DetailsObject.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/DetailsObject.kt index cf8aec0896..ab59499c0a 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/DetailsObject.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/DetailsObject.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedtypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int import kotlin.String @@ -12,9 +13,11 @@ public data class DetailsObject( /** * Unique identifier */ + @get:JsonProperty(value = "id") public val id: Int, /** * Actual detail value */ + @get:JsonProperty(value = "value") public val `value`: String, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/DetailsObject2.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/DetailsObject2.kt index f128ddd27c..bdcd7a904d 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/DetailsObject2.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/reuse_types/reusedtypesquery/DetailsObject2.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.reusedtypesquery import com.expediagroup.graphql.client.Generated +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.Int /** @@ -11,5 +12,6 @@ public data class DetailsObject2( /** * Unique identifier */ + @get:JsonProperty(value = "id") public val id: Int, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/scalar_typealias/ScalarAliasQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/scalar_typealias/ScalarAliasQuery.kt index ab729f30a0..ca6a91430b 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/scalar_typealias/ScalarAliasQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/scalar_typealias/ScalarAliasQuery.kt @@ -3,6 +3,7 @@ package com.expediagroup.graphql.generated import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.scalaraliasquery.ScalarWrapper +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -22,6 +23,7 @@ public class ScalarAliasQuery : GraphQLClientRequest { /** * Query that returns wrapper object with all supported scalar types */ + @get:JsonProperty(value = "scalarQuery") public val scalarQuery: ScalarWrapper, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/scalar_typealias/scalaraliasquery/ScalarWrapper.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/scalar_typealias/scalaraliasquery/ScalarWrapper.kt index a4f60b7da8..976cfa051c 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/scalar_typealias/scalaraliasquery/ScalarWrapper.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/scalar_typealias/scalaraliasquery/ScalarWrapper.kt @@ -3,6 +3,7 @@ package com.expediagroup.graphql.generated.scalaraliasquery import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.generated.ID import com.expediagroup.graphql.generated.UUID +import com.fasterxml.jackson.`annotation`.JsonProperty /** * Wrapper that holds all supported scalar types @@ -12,9 +13,11 @@ public data class ScalarWrapper( /** * ID represents unique identifier that is not intended to be human readable */ + @get:JsonProperty(value = "id") public val id: ID, /** * Custom scalar of UUID */ + @get:JsonProperty(value = "custom") public val custom: UUID? = null, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/union_diff_selection_set/DifferentSelectionSetQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/union_diff_selection_set/DifferentSelectionSetQuery.kt index 9deedd1b20..1f0288c9f9 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/union_diff_selection_set/DifferentSelectionSetQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/generator/union_diff_selection_set/DifferentSelectionSetQuery.kt @@ -4,6 +4,7 @@ import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.differentselectionsetquery.BasicUnion import com.expediagroup.graphql.generated.differentselectionsetquery.BasicUnion2 +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -24,10 +25,12 @@ public class DifferentSelectionSetQuery : GraphQLClientRequest /** * Query that returns wrapper object with all supported scalar types */ + @get:JsonProperty(value = "scalarQuery") public val scalarQuery: ScalarWrapper, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/custom_scalars/customscalarquery/ScalarWrapper.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/custom_scalars/customscalarquery/ScalarWrapper.kt index 914d4bacab..ef74a2b602 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/custom_scalars/customscalarquery/ScalarWrapper.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/custom_scalars/customscalarquery/ScalarWrapper.kt @@ -5,6 +5,7 @@ import com.expediagroup.graphql.generated.scalars.AnyToULocaleConverter import com.expediagroup.graphql.generated.scalars.AnyToUUIDConverter import com.expediagroup.graphql.generated.scalars.ULocaleToAnyConverter import com.expediagroup.graphql.generated.scalars.UUIDToAnyConverter +import com.fasterxml.jackson.`annotation`.JsonProperty import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonSerialize import com.ibm.icu.util.ULocale @@ -21,23 +22,27 @@ public data class ScalarWrapper( */ @JsonSerialize(converter = UUIDToAnyConverter::class) @JsonDeserialize(converter = AnyToUUIDConverter::class) + @get:JsonProperty(value = "custom") public val custom: UUID? = null, /** * List of custom scalar UUIDs */ @JsonSerialize(contentConverter = UUIDToAnyConverter::class) @JsonDeserialize(contentConverter = AnyToUUIDConverter::class) + @get:JsonProperty(value = "customList") public val customList: List? = null, /** * Custom scalar of Locale */ @JsonSerialize(converter = ULocaleToAnyConverter::class) @JsonDeserialize(converter = AnyToULocaleConverter::class) + @get:JsonProperty(value = "locale") public val locale: ULocale, /** * List of custom scalar Locales */ @JsonSerialize(contentConverter = ULocaleToAnyConverter::class) @JsonDeserialize(contentConverter = AnyToULocaleConverter::class) + @get:JsonProperty(value = "listLocale") public val listLocale: List, ) diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/enums/EnumQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/enums/EnumQuery.kt index bbccd9a952..89e3bdfdbe 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/enums/EnumQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/enums/EnumQuery.kt @@ -4,6 +4,7 @@ import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.enums.CustomEnum import com.expediagroup.graphql.generated.enums.OtherEnum +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -22,10 +23,12 @@ public class EnumQuery : GraphQLClientRequest { /** * Query that returns enum value */ + @get:JsonProperty(value = "enumQuery") public val enumQuery: CustomEnum = CustomEnum.__UNKNOWN_VALUE, /** * Query that returns other enum value */ + @get:JsonProperty(value = "otherEnumQuery") public val otherEnumQuery: OtherEnum = OtherEnum.__UNKNOWN_VALUE, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/interface/InterfaceWithInlineFragmentsQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/interface/InterfaceWithInlineFragmentsQuery.kt index 2edd92213b..1aa9ff15b7 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/interface/InterfaceWithInlineFragmentsQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/interface/InterfaceWithInlineFragmentsQuery.kt @@ -3,6 +3,7 @@ package com.expediagroup.graphql.generated import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.interfacewithinlinefragmentsquery.BasicInterface +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -24,6 +25,7 @@ public class InterfaceWithInlineFragmentsQuery : /** * Query returning an interface */ + @get:JsonProperty(value = "interfaceQuery") public val interfaceQuery: BasicInterface, ) } diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/interface/interfacewithinlinefragmentsquery/BasicInterface.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/interface/interfacewithinlinefragmentsquery/BasicInterface.kt index 1ef2044fd4..672d3ea836 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/interface/interfacewithinlinefragmentsquery/BasicInterface.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/interface/interfacewithinlinefragmentsquery/BasicInterface.kt @@ -1,6 +1,7 @@ package com.expediagroup.graphql.generated.interfacewithinlinefragmentsquery 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 @@ -27,11 +28,13 @@ public interface BasicInterface { /** * Unique identifier of an interface */ + @get:JsonProperty(value = "id") public val id: Int /** * Name field */ + @get:JsonProperty(value = "name") public val name: String } @@ -43,14 +46,17 @@ public data class FirstInterfaceImplementation( /** * Unique identifier of the first implementation */ + @get:JsonProperty(value = "id") override val id: Int, /** * Name of the first implementation */ + @get:JsonProperty(value = "name") override val name: String, /** * Custom field integer value */ + @get:JsonProperty(value = "intValue") public val intValue: Int, ) : BasicInterface @@ -62,14 +68,17 @@ public data class SecondInterfaceImplementation( /** * Unique identifier of the second implementation */ + @get:JsonProperty(value = "id") override val id: Int, /** * Name of the second implementation */ + @get:JsonProperty(value = "name") override val name: String, /** * Custom field float value */ + @get:JsonProperty(value = "floatValue") public val floatValue: Double, ) : BasicInterface @@ -82,9 +91,11 @@ public data class DefaultBasicInterfaceImplementation( /** * Unique identifier of an interface */ + @get:JsonProperty(value = "id") override val id: Int, /** * Name field */ + @get:JsonProperty(value = "name") override val name: String, ) : BasicInterface diff --git a/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/object/ComplexObjectQuery.kt b/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/object/ComplexObjectQuery.kt index 40cc814893..f7978f15b7 100644 --- a/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/object/ComplexObjectQuery.kt +++ b/plugins/client/graphql-kotlin-client-generator/src/test/data/jackson/object/ComplexObjectQuery.kt @@ -3,6 +3,7 @@ package com.expediagroup.graphql.generated import com.expediagroup.graphql.client.Generated import com.expediagroup.graphql.client.types.GraphQLClientRequest import com.expediagroup.graphql.generated.complexobjectquery.ComplexObject +import com.fasterxml.jackson.`annotation`.JsonProperty import kotlin.String import kotlin.reflect.KClass @@ -22,6 +23,7 @@ public class ComplexObjectQuery : GraphQLClientRequest