You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[plugin] fix client generation when selecting custom scalars (#916)
When custom scalars (with converters) were referenced multiple times from selection set (e.g. from a common fragment) we would attempt to unwrap the converted scalar type when comparing generated object properties and next selection set fields. This that even though it was the same selection we could still end up with multiple duplicate classes. Added explicit check to verify whether unwrapped property type is auto converted scalar type.
Resolves: #903
Copy file name to clipboardExpand all lines: plugins/graphql-kotlin-plugin-core/src/main/kotlin/com/expediagroup/graphql/plugin/generator/types/generateTypeName.kt
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -203,7 +203,10 @@ private fun calculateGeneratedTypeProperties(context: GraphQLClientGeneratorCont
203
203
}
204
204
isClassName-> {
205
205
val fieldTypeName = propertyType.simpleNameWithoutWrapper()
Copy file name to clipboardExpand all lines: plugins/graphql-kotlin-plugin-core/src/test/kotlin/com/expediagroup/graphql/plugin/generator/GraphQLTestUtils.kt
Copy file name to clipboardExpand all lines: plugins/graphql-kotlin-plugin-core/src/test/kotlin/com/expediagroup/graphql/plugin/generator/types/GenerateGraphQLCustomScalarTypeSpecIT.kt
+105-3Lines changed: 105 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ class GenerateGraphQLCustomScalarTypeSpecIT {
scalarTypeToConverterMapping =mapOf("UUID" to ScalarConverterMapping("java.util.UUID", "com.expediagroup.graphql.plugin.generator.UUIDConverter"))
102
+
scalarTypeToConverterMapping =mapOf("UUID" to ScalarConverterMapping("java.util.UUID", "com.expediagroup.graphql.plugin.generator.UUIDScalarConverter"))
103
+
)
104
+
)
105
+
}
106
+
107
+
@Test
108
+
fun`verify selection sets can reference custom scalars`() {
scalarTypeToConverterMapping =mapOf("UUID" to ScalarConverterMapping("java.util.UUID", "com.expediagroup.graphql.plugin.generator.UUIDScalarConverter"))
0 commit comments