-
Notifications
You must be signed in to change notification settings - Fork 16
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
Extends FieldArgTypeCoercion #50
Extends FieldArgTypeCoercion #50
Conversation
3302a20
to
b73c68a
Compare
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.
This looks like a great idea! I'm not sure why test/linting isn't running against the PR in CI, so I'll just verify that it passes manually later
Hey @chanind, thanks for taking a look at this. Ive fixed the lint issues and your suggestions as well. |
|
||
// If no fieldName is provided, check for defined matchConditions. | ||
// This avoids having to define one rewriter for many fields individually. | ||
// Alternatively, regex matching for fieldName could be implemented. |
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.
👍 this is a cool idea for a future PR!
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.
Apologies for the delay getting back to you! This looks great, but it looks like linting is failing. If you run apologies I was on the old version still!yarn lint
you can see the linting failures. If these can be fixed I think this should be good to go!
🎉 This PR is included in version 3.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hello @chanind, here's an extension proposal for the
FieldArgTypeRewriter
rewriter.This PR is backwards compatible.
New functionalities are included for the
FieldArgTypeRewriter
rewriter.fieldName now optional in case matchConditions are passed: Useful to avoid having to create a new rewriter for every field, as now the matching can be delegated to the matchConditions
coerceVariable function now receives context in second argument: Context includes all of query's variables and arguments, and very useful for coercion that needs the value of other argument values as in pagination coercion (e.g.,
[limit, offset]
to[pageSize, pageNumber]
)In-Query argument values can be coerced: _Now, there's the coerceArgumentValue that allows support when argument values come in the query document.
Unit Tests for new functionalities