Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are we making this change?
One of cynics features is that it allows you to use types from any crate as custom scalars, bypassing the usual orphan rule restrictions. In other words, cynic doesn't have to specifically add support for that crate, and that crate doesn't need to add support for cynic either.
Currently this uses the
serde::Serialize
&serde::Deserialize
impls for the type. This is fine when the format used by the serde impls matches that used by the server you're talking to. But when the format does not match, you can no longer use the type directly, and have to create a wrapping newtype instead.What effects does this change have?
This PR updates the cynic code so that it uses a set of cynic traits for serialising & deserialising scalars. These types are generic over the underlying schema type - allowing the ser/de of scalars to hook into the same schema specific mechanisms we do to match types to custom scalars.
This means that an application can serialise one individual type differently depending on what the server it's sending to expects.
Fixes #782
Todo:
todo!()
in there.