Make the fragment matcher deterministic #10214
Open
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.
Description
This exposes a new plugin option
deterministic
that when enabled will ensure that the fragment matcher will always return the same result for the same schema, no matter the order it is in the schema.It does this by sorting the results so that they are always in the same order.
The default is
false
to maintain backwards compatibility.Related # (issue)
fragment-matcher
deterministic #7367Type of change
How Has This Been Tested?
Ran this against a small private schema and one large private schema.
Test Environment:
15.1.1
@graphql-codegen/core
:4.0.2
@graphql-codegen/fragment-matcher
: This PRv20.18.0
Checklist: