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
I have a GQL input type that uses the native ID type like
input MyInputType {
id: ID!
name: String!
and I want this ID to be of some custom Java/Kotlin type, e.g. URI for type safety
data class MyInputType(
val id: URI,
val name: String
)
I have already defined URI with @DgsScalar for use in other fields correctly, but when I use it as the ID type, I get DgsInvalidInputArgumentException
One solution would be to use URI instead of ID in the GQL type definition from the start but I want to see if it is possible using the above type signatures due to some schema conventions.
Is there any other DGS configuration I need to provide for the mapping between my custom type and ID (ID <-> URI) to be discovered and used?
update
doing the same for GQL type instead of input works fine, but probably because type needs only a kotlin-to-GQL serialization, and URI can be converted to a string with @DgsScalar. input works the inverse way and the translation bits are missing
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a GQL input type that uses the native ID type like
and I want this ID to be of some custom Java/Kotlin type, e.g. URI for type safety
I have already defined URI with @DgsScalar for use in other fields correctly, but when I use it as the ID type, I get
DgsInvalidInputArgumentExceptionOne solution would be to use
URIinstead ofIDin the GQL type definition from the start but I want to see if it is possible using the above type signatures due to some schema conventions.Is there any other DGS configuration I need to provide for the mapping between my custom type and ID (
ID <-> URI) to be discovered and used?update
doing the same for GQL
typeinstead ofinputworks fine, but probably becausetypeneeds only akotlin-to-GQLserialization, and URI can be converted to a string with@DgsScalar.inputworks the inverse way and the translation bits are missingBeta Was this translation helpful? Give feedback.
All reactions