-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
Support @GQLValueType
s when rendering API
#1126
Comments
The You can achieve this today with for example: case class MyScalar(value: Int)
implicit val myScalarSchema: Schema[Any, MyScalar] = Schema.scalarSchema("MyScalar", None, IntValue(_)) Your second suggestion would work. To prevent breaking existing code, we could re-use @GQLValueType(isScalar = true)
case class MyScalar(value: Int) Does that sounds like what you wanted? |
Turns out it was simple: #1127 |
Great! #1127 looks like what I need, thanks for the quick PR and prompt answer. Let me know when this is released as I'll use it right away. Had a brief look at the PR implementation and looks solid, nothing to add. Your approach to customize the schema instance is something I've considered in the past but it's verbose enough for all my types that I've discarded it, the new solution to this problem is much better. |
When using the
render
method on theGraphQL
object, Caliban prints a schema that can be distributed to clients. However, this schema contains no information about value types and instead uses the underlying representation, which loses type information. The GQL Value types could be represented as scalars in the schema, right after theLong
andDateTime
definitions. I'd like to suggest that Caliban supports this feature either by default, or by opting in via either of the following mechanisms:render
methodGQLScalarType
annotation that combines the semantics ofGQLValueType
and the scalar representationThe text was updated successfully, but these errors were encountered: