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

Commits on Jun 3, 2021

  1. Refactor Lexer

    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
    leebyron committed Jun 3, 2021
    Configuration menu
    Copy the full SHA
    540c59e View commit details
    Browse the repository at this point in the history
  2. Code review

    Co-authored-by: Ivan Goncharov <ivan.goncharov.ua@gmail.com>
    leebyron and IvanGoncharov committed Jun 3, 2021
    Configuration menu
    Copy the full SHA
    b6864ac View commit details
    Browse the repository at this point in the history
  3. Schema Coordinates

    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`
    leebyron committed Jun 3, 2021
    Configuration menu
    Copy the full SHA
    8fa8a4c View commit details
    Browse the repository at this point in the history
  4. Add coordinate field to schema element definitions

    * 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.
    leebyron committed Jun 3, 2021
    Configuration menu
    Copy the full SHA
    a4c7cea View commit details
    Browse the repository at this point in the history
  5. Add coerceInputLiteral()

    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 committed Jun 3, 2021
    Configuration menu
    Copy the full SHA
    8abb052 View commit details
    Browse the repository at this point in the history