graphql-query-rewriter / core

Seamlessly turn breaking GraphQL changes into non-breaking changes
https://graphql-query-rewriter.github.io/core
MIT License
407 stars 15 forks source link

Extends FieldArgTypeCoercion #50

Closed AndresPrez closed 2 years ago

AndresPrez commented 2 years ago

Hello @chanind, here's an extension proposal for the FieldArgTypeRewriter rewriter.

This PR is backwards compatible.

New functionalities are included for the FieldArgTypeRewriter rewriter.

  1. 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

  2. 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])

  3. In-Query argument values can be coerced: _Now, there's the coerceArgumentValue that allows support when argument values come in the query document.

  4. Unit Tests for new functionalities

AndresPrez commented 2 years ago

Hey @chanind, thanks for taking a look at this. Ive fixed the lint issues and your suggestions as well.

chanind commented 2 years ago

:tada: This PR is included in version 3.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: