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

Add coerceInputLiteral() #3092

Open
wants to merge 5 commits into
base: definition-coordinates
Choose a base branch
from

Conversation

leebyron
Copy link
Contributor

@leebyron leebyron commented May 15, 2021

Depends on #3145

Removes valueFromAST() and adds coerceInputLiteral() as an additional export from coerceInputValue.

The implementation is almost exactly the same as valueFromAST() with a slightly more strict type signature and refactored tests to improve coverage (the file unit test has 100% coverage)

While this does not change any behavior, it could be breaking if you rely directly on the valueFromAST() method. Use coerceInputLiteral() as a direct replacement.

@leebyron leebyron changed the base branch from input-value-config to definition-coordinates June 1, 2021 18:57
@leebyron leebyron added PR: internal 🏠 PR: breaking change 💥 implementation requires increase of "major" version number and removed PR: internal 🏠 labels Jun 1, 2021
@leebyron leebyron force-pushed the coerce-input-literal branch 2 times, most recently from 15223bc to a79c0e5 Compare June 1, 2021 22:06
leebyron and others added 4 commits June 3, 2021 09:51
The lexer needed some cleanup, I found myself doing this as part of a Unicode RFC, but factoring all that out to make the Unicode RFC PR easier to follow.

* Always use hexadecimal form for code values.
* Remove use of `isNaN` for checking source over-reads.
* Defines `isSourceCharacter`
* Add more documentation and comments, also replaces regex with lexical grammar
* Simplifies error messages
* Adds additional tests
Co-authored-by: Ivan Goncharov <ivan.goncharov.ua@gmail.com>
Implements graphql/graphql-spec#794

Adds:

* DOT punctuator in lexer
* Improvements to lexer errors around misuse of `.`
* Minor improvement to parser core which simplified this addition
* `SchemaCoordinate` node and `isSchemaCoodinate()` predicate
* Support in `print()` and `visit()`
* Added function `parseSchemaCoordinate()` since it is a parser entry point.
* Added function `resolveSchemaCoordinate()` and `resolveASTSchemaCoordinate()` which implement the semantics (name mirrored from `buildASTSchema`) as well as the return type `ResolvedSchemaElement`
* Defines a `GraphQLSchemaElement` base class which defines a `.coordinate` property and `toString`/`toJSON` methods.
* Adds base class to types, fields, arguments, input fields, enum values, and directives.
* Uses this in validation error printing string templates.
Removes `valueFromAST()` and adds `coerceInputLiteral()` as an additional export from `coerceInputValue`.

The implementation is almost exactly the same as `valueFromAST()` with a slightly more strict type signature and refactored tests to improve coverage (the file unit test has 100% coverage)

While this does not change any behavior, it could be breaking if you rely directly on the valueFromAST() method. Use `coerceInputLiteral()` as a direct replacement.
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.

None yet

1 participant