-
Notifications
You must be signed in to change notification settings - Fork 354
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
Better support for custom scalars as input types #1445
Labels
module: generator
Issue affects the schema generator and federation code
type: enhancement
New feature or request
Comments
dariuszkuc
added a commit
to dariuszkuc/graphql-kotlin
that referenced
this issue
Jul 22, 2022
Update `kotlinx-serialization` handling of custom scalars to allow non-primitive values. While custom scalars are most often represented as some primitive value (e.g. UUID -> String), there are use cases when scalars need to be represented as objects. One common use case is Apollo Federation and its usage of `_Any` scalar to represent arbitrary entity object map that contains various fields to uniquely identity it. Updated custom scalar documentation with examples n how to use arbitrary objects as custom scalars. Resolves: * ExpediaGroup#1408 * ExpediaGroup#1435 * ExpediaGroup#1445
dariuszkuc
added a commit
to dariuszkuc/graphql-kotlin
that referenced
this issue
Jul 22, 2022
Update `kotlinx-serialization` handling of custom scalars to allow non-primitive values. While custom scalars are most often represented as some primitive value (e.g. UUID -> String), there are use cases when scalars need to be represented as objects. One common use case is Apollo Federation and its usage of `_Any` scalar to represent arbitrary entity object map that contains various fields to uniquely identity it. Updated custom scalar documentation with examples n how to use arbitrary objects as custom scalars. Resolves: * ExpediaGroup#1408 * ExpediaGroup#1435 * ExpediaGroup#1445
dariuszkuc
added a commit
that referenced
this issue
Jul 26, 2022
Update `kotlinx-serialization` handling of custom scalars to allow non-primitive values. While custom scalars are most often represented as some primitive value (e.g. UUID -> String), there are use cases when scalars need to be represented as objects. One common use case is Apollo Federation and its usage of `_Any` scalar to represent arbitrary entity object map that contains various fields to uniquely identity it. Updated custom scalar documentation with examples n how to use arbitrary objects as custom scalars. Resolves: * #1408 * #1435 * #1445
Resolved by #1488 |
I'm not sure if this is resolved |
Ah indeed, closed incorrectly. |
dariuszkuc
added a commit
to dariuszkuc/graphql-kotlin
that referenced
this issue
Aug 5, 2022
Update `kotlinx-serialization` handling of custom scalars to allow non-primitive values. While custom scalars are most often represented as some primitive value (e.g. UUID -> String), there are use cases when scalars need to be represented as objects. One common use case is Apollo Federation and its usage of `_Any` scalar to represent arbitrary entity object map that contains various fields to uniquely identity it. Updated custom scalar documentation with examples n how to use arbitrary objects as custom scalars. Resolves: * ExpediaGroup#1408 * ExpediaGroup#1435 * ExpediaGroup#1445
dariuszkuc
added
the
module: generator
Issue affects the schema generator and federation code
label
Aug 14, 2022
@dariuszkuc Any ideas on support of Map<K, V> as input argument type? I tryed different options on server side. One was Coercing, but in runtime it thows PrimaryConstructorNotFound: Invalid input object Map - missing public primary constructor which was shown in 1808 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
module: generator
Issue affects the schema generator and federation code
type: enhancement
New feature or request
Is your feature request related to a problem? Please describe.
Consider the following query:
The type
JsonNode
is an abstract class and resolved to a custom scalar as explained in the documentation:However, this does not work. JsonNode is an abstract class, and
generateArgument.kt
disallows those before resolving the type using the schema generator hooks.Describe the solution you'd like
Move the check, that no interface / union would be generated from
generateArgument.kt
to objectFromReflection (of course only check if it is an input type).Describe alternatives you've considered
Currently, I use a workaround where I use
Any
as Kotlin type and specify the scalar using@GraphQLType
, however, this results in unnecessary casts.The text was updated successfully, but these errors were encountered: