Skip to content

Commit 5a24a59

Browse files
committed
update
after the landing of #4209, we don't have any breaking behavior (yet) in terms of input value coercion!
1 parent ccb0ea1 commit 5a24a59

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

website/docs/tutorials/whats-new-in-graphql-js-v17.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,15 @@
3333

3434
## New API features
3535

36+
- Use new utility `coerceInputLiteral()` as a replacement for `valueFromAST()`.
37+
- Use new utility `valueToLiteral()` to convert from an external input value to a literal value. Custom scalars can define custom behavior by implementing an optional new `valueToLiteral()` method, otherwise a default conversion function will be used.
38+
- Use new utility `replaceVariableValues()` to replace variables within complex scalars uses as inputs. This allows variables embedded within complex scalars to use the correct default values.
39+
- Use new `parseConstLiteral()` methods on custom scalar types instead of `parseLiteral()` (along with the new `valueToLiteral()` method when required) to automatically convert literals to values, including any variables embedded within complex scalars. Embedded variables will (finally) receive the appropriate default values! Note: `parseLiteral()` has been deprecated; in the next major version, it will be removed and the `parseConstLiteral()` method for custom scalars will be set to a default function when not provided, similar to the current behavior of `parseLiteral()`.
3640
- Support for resolver functions returning async iterables.
3741
- Expose `printDirective()` helper function.
3842

3943
## API Changes:
4044

41-
- Changes to input coercion:
42-
- Use new utility `coerceInputLiteral()` instead of `valueFromAST()`.
43-
- Use new utility `replaceVariableValues()` to replace variables within complex scalars uses as inputs. Internally, `replaceVariableValues()` uses new utility `valueToLiteral()` to convert from an external input value to a literal value. This allows variables embedded within complex scalars to use the correct default values.
44-
- Use new utility `valueToLiteral()` to convert from an external input value to a literal value. Custom scalars can define custom behavior by implementing an optional `valueToLiteral()` method.
45-
- Use new `parseConstLiteral()` methods on leaf types instead of `parseLiteral()` to convert literals to values, by first calling new utility `replaceVariableValues()` on the non-constant literal, and then by calling `parseConstLiteral()`.
4645
- Changes to the `subscribe()` function:
4746
- `subscribe()` may now return a non-promise.
4847
- When a subscription root field errors, `subscribe()` now returns a well-formatted `GraphQLError` rather than throwing.

0 commit comments

Comments
 (0)