Draft
Conversation
This was referenced Oct 6, 2021
xperiandri
reviewed
Oct 6, 2021
Collaborator
xperiandri
left a comment
There was a problem hiding this comment.
Looks interesting.
But I have not noticed a practical usage sample in tests.
Co-authored-by: Andrii Chebukin <xperiandri@live.ru>
Co-authored-by: Andrii Chebukin <xperiandri@live.ru>
Co-authored-by: Andrii Chebukin <xperiandri@live.ru>
Contributor
Author
Good point - I can update one of the samples perhaps |
* Updates star-wars to new API * Updates star-wars to new API * Updates star-wars to new API * Updates star-wars to new API * Updates star-wars to new API * Updates star-wars to new API * Updates star-wars to new API
xperiandri
requested changes
Oct 12, 2022
|
|
||
| match error.Reason with | ||
| | DecodeErrorReason.TypeMismatch (expected, actual) -> | ||
| sprintf "expected value of type %s but got %s" expected actual |
Collaborator
There was a problem hiding this comment.
Suggested change
| sprintf "expected value of type %s but got %s" expected actual | |
| sprintf "expected value of type '%s' but got '%s'" expected actual |
| match varDef.TypeDef with | ||
| | Nullable _ -> Ok NullValue | ||
| |_ -> | ||
| let message = sprintf "Variable '$%s': expected value of type %s, but no value was found" vname (varDef.TypeDef.ToString()) |
Collaborator
There was a problem hiding this comment.
Suggested change
| let message = sprintf "Variable '$%s': expected value of type %s, but no value was found" vname (varDef.TypeDef.ToString()) | |
| let message = sprintf "Variable '$%s': expected value of type '%s', but no value was found" vname (varDef.TypeDef.ToString()) |
c8b3525 to
0810527
Compare
14aa27a to
3ba4016
Compare
1737829 to
246d6c0
Compare
0dd4372 to
81bc85e
Compare
d90f0e9 to
434b4be
Compare
f3a1bf8 to
9d4b950
Compare
6dc591e to
85a9d8c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces "decoders" to input types in the schema.
A decoder is like a
coerceInputfunction, but it returns a structuredErrorrather than anoption:A helper library of decoders is provided for common types like
string,int, etc. There is also a utility for automatic decoder generation using reflection.All input types (not just scalars) now have a decoder attached to them.
The user can provide a decoder (recommended) or they can allow a default one to be generated automatically. This allows the user to interpret the GraphQL AST with the context of the type being decoded.
There are currently some scrappy comments etc. If we like the idea I can clean it up before merging.