-
Notifications
You must be signed in to change notification settings - Fork 655
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
Allow custom scalars targets in FakeResolver return types #4359
Conversation
✅ Deploy Preview for apollo-android-docs canceled.
|
} | ||
} else { | ||
leafValue | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the meat of the change
* A GraphQL scalar type that is mapped to a Kotlin. This is named "Custom" for historical reasons | ||
* but is also used for builtin scalars | ||
* | ||
* TODO v4: rename this to ScalarType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started adding "TODO v4" for stuff that will need to be reworked. I don't think we had any marker previously?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
(I don't think we did)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool! 👍
Previously, compile-time adapters required
resolveLeaf
to return a Json-like value. This break the symmetry with runtime adapters and is more cumbersome to use.To allow this, we now generate a
customScalarAdapters
property that contains all compile-time adapters that we can use to automatically serialize when needed.Random thoughts: the compile-time vs run-time difference make all this code pretty cumbersome. In the future, we should think of ways to make everything a compile-time thing. Maybe with KSP: