From 77752184858b0784b904b116262a528c88b531bb Mon Sep 17 00:00:00 2001 From: Dan Adajian Date: Wed, 20 Mar 2024 15:10:31 -0500 Subject: [PATCH] feat: support graphql-kotlin ID scalar --- src/helpers/build-type-metadata.ts | 2 +- test/unit/should_support_custom_scalars/expected.kt | 1 + test/unit/should_support_custom_scalars/schema.graphql | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/helpers/build-type-metadata.ts b/src/helpers/build-type-metadata.ts index 637555b..2682774 100644 --- a/src/helpers/build-type-metadata.ts +++ b/src/helpers/build-type-metadata.ts @@ -100,7 +100,7 @@ export function buildListType(typeNode: TypeNode, typeName: string) { export const KOTLIN_SCALARS = [ { scalarName: "ID", - kotlinType: "String", + kotlinType: "com.expediagroup.graphql.generator.scalars.ID", }, { scalarName: "String", diff --git a/test/unit/should_support_custom_scalars/expected.kt b/test/unit/should_support_custom_scalars/expected.kt index 25eb236..0043250 100644 --- a/test/unit/should_support_custom_scalars/expected.kt +++ b/test/unit/should_support_custom_scalars/expected.kt @@ -3,6 +3,7 @@ package com.kotlin.generated import com.expediagroup.graphql.generator.annotations.* data class MyScalarType( + val idField: com.expediagroup.graphql.generator.scalars.ID? = null, val field: URL? = null, val field2: URL ) diff --git a/test/unit/should_support_custom_scalars/schema.graphql b/test/unit/should_support_custom_scalars/schema.graphql index 80ae8a4..ae7aaa3 100644 --- a/test/unit/should_support_custom_scalars/schema.graphql +++ b/test/unit/should_support_custom_scalars/schema.graphql @@ -1,6 +1,7 @@ scalar URL type MyScalarType { + idField: ID field: URL field2: URL! }