[Feature] Add Support for Directive filters and Type filters to cover AWS AppSync use-cases #1143
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.
Problem Statement
Current implementation of custom directives and scalars always outputs a definition for the directive/scalar with the developer having no control over it. for e.g. defining
aws_lambda
directive for certain fields which is a inherently defined / supported directive by AWS App Sync but not by the GraphQL standard will output the directive definition which AWS does not like 🥲, making this library in all it's glory very hard to use with AppSync.An example of the current output:
What AWS AppSync would like the output to be:
Fix
To work around the issue and to give more control to the developer I added another optional field to the
makeSchema
method called filters, which allows the developer to define custom filters for the directives and types which gives them the ability to exclude them from the definition if needed.