Skip to content
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

improve upgrade path for new custom scalar parseConstLiteral() method #4209

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Sep 30, 2024

parseLiteral() has been marked as deprecated, prompting but not forcing our users to convert to parseConstLiteral().

With this additional change:

  • in v17, if not supplied, the new parseConstLiteral() method will be left as undefined, and during execution, we will fall back toparseLiteral().
  • in v18, we will remove parseLiteral() and set up a default function for parseConstLiteral() when not supplied.

Prior to this change, users of custom scalars with custom parseLiteral() functions who did not provide a custom parseConstLiteral() function would just get the default parseConstLiteral() function during execution, which might not work as expected.

This scheme will work except for users of custom scalars who want to embed experimental fragment variables in their custom scalars, which will only work with the new parseConstLiteral() method.

…parseConstValue()

`parseValue()` has been marked as deprecated, prompting but not forcing our users to convert to `parseConstValue()`.

With this additional change:

- in v17, if not supplied, the new `parseConstValue()` method will be left as undefined, and during execution, we will fall back to`parseValue()`.
- in v18, we will remove `parseValue()` and set up a default function for `parseConstValue()` when not supplied.

Prior to this change, users of custom scalars with custom `parseValue()` functions who did not provide a custom `parseConstValue()` function would just get the default `parseConstValue()` function during execution, which might not work as expected.

This scheme will work except for users of custom scalars who want to embed experimental fragment variables in their custom scalars, which will only work with the new `parseConstValue()` method.
@yaacovCR yaacovCR requested a review from a team as a code owner September 30, 2024 09:45
Copy link

netlify bot commented Sep 30, 2024

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit b14f5fd
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/66fa74b170e8c00008251853
😎 Deploy Preview https://deploy-preview-4209--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@yaacovCR yaacovCR changed the title provide better upgrade experience for custom scalars for the move to … provide better upgrade route for the new custom scalar parseConstValue() method Sep 30, 2024
@yaacovCR yaacovCR changed the title provide better upgrade route for the new custom scalar parseConstValue() method improve upgrade route for new custom scalar parseConstValue() method Sep 30, 2024
@yaacovCR yaacovCR changed the title improve upgrade route for new custom scalar parseConstValue() method improve upgrade path for new custom scalar parseConstValue() method Sep 30, 2024
@yaacovCR yaacovCR added the PR: breaking change 💥 implementation requires increase of "major" version number label Sep 30, 2024
@yaacovCR yaacovCR changed the title improve upgrade path for new custom scalar parseConstValue() method improve upgrade path for new custom scalar parseConstLiteral() method Sep 30, 2024
@yaacovCR yaacovCR merged commit 0e22cc4 into graphql:main Sep 30, 2024
20 checks passed
@yaacovCR yaacovCR deleted the improve-upgrade-path branch September 30, 2024 12:33
yaacovCR added a commit to yaacovCR/graphql-js that referenced this pull request Sep 30, 2024
after the landing of graphql#4209, we don't have any breaking behavior (yet) in terms of input value coercion!
yaacovCR added a commit that referenced this pull request Oct 13, 2024
the new method was introduced in #3812 with upgrade path improved in
#4209.

This PR completes polishes this work a bit:

1. The method is renamed to `coerceInputLiteral()` following the naming
convention suggested in #2357, with the other methods to be renamed in
later PRs.
2. The type of the method `GraphQLScalarInputLiteralCoercer` is
exported, which was not done in the initial work. The old
`GraphQLScalarLiteralParser` type is deprecated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: breaking change 💥 implementation requires increase of "major" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants