Skip to content

Conversation

@dondonz
Copy link
Member

@dondonz dondonz commented Apr 14, 2023

Reverts stricter parseValue coercion for built-in scalars String #3030 and Boolean, Float, and Int #3042.

We've received feedback that this parseValue breaking change is causing an issue with clients expecting the old behaviour. Whilst this change was to align parseValue coercion with the JS reference implementation, we want to temporarily revert this change while we work on a better migration solution.

The stricter parseValue coercion was previously released with GraphQL Java 20.0.

JS implementation: https://github.com/graphql/graphql-js/blob/main/src/type/scalars.ts

1234567l | 1234567
new AtomicInteger(42) | 42
Integer.MAX_VALUE | Integer.MAX_VALUE
Integer.MIN_VALUE | Integer.MIN_VALUE
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some reorganising so these two adjacent tests are ordered in the same way

new BigInteger("42") | 42
new BigDecimal("42") | 42
42.0f | 42
42.0d | 42
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reorganising

value | result
123 | "123"
true | "true"
customObject | "foo"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As all Java objects must have a toString method, there will always be a result for parseValue with the looser coercion.

@dondonz dondonz added this pull request to the merge queue Apr 17, 2023
Merged via the queue into master with commit cc2f460 Apr 17, 2023
@dondonz dondonz added this to the 2023 July milestone Apr 17, 2023
@jbellenger
Copy link
Contributor

👋 howdy! I've recently been looking into upgrading a v18.1 service to v20.2 and have been looking into how to safely migrate to this (now reverted) part of the update.

For example, an early attempt at this was to try modifying scalars like Boolean to use a new Coercing that could log compatibility issues. I couldn't get this to work, as the standard Boolean and its Coercing are baked into skip/include directives in a way that makes them difficult to replace.

It would be great to get this un-reverted eventually, but for now I'm interested in following any thinking about what a migration solution might look like. Is there a way to keep tabs on this?

@andimarek
Copy link
Member

hey @jbellenger ... so we decided to reverted it, because even if we think this is the right behaviour there is a chance of some existing clients could break.

Have a look at #3188 and maybe comment if that would help you: we plan to introduce a temporary internal only API for one or two releases that will allow everybody to migrate more safely.

@dondonz
Copy link
Member Author

dondonz commented Apr 18, 2023

You can keep track of the progress on #3191, I'll continue to add changes related to parseValue coercion to that issue

@dondonz dondonz deleted the revert-stricter-scalar-parseValue branch April 18, 2023 00:55
dondonz added a commit that referenced this pull request May 29, 2023
dondonz added a commit that referenced this pull request May 29, 2023
…ion-revert

Add backport of scalar coercion reversion PR #3186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants