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

ast: TYPE (non-null, list and named types) does not preserve ignored characters order #143

Closed
lrlna opened this issue Jan 18, 2022 · 0 comments · Fixed by #153
Closed

ast: TYPE (non-null, list and named types) does not preserve ignored characters order #143

lrlna opened this issue Jan 18, 2022 · 0 comments · Fixed by #153
Assignees
Labels
apollo-parser bug Something isn't working

Comments

@lrlna
Copy link
Member

lrlna commented Jan 18, 2022

Description

When any of the three TYPEs (NON_NULL_TYPE, LIST_TYPE, NAMED_TYPE) contain any number of ignored character before or after the actual type, their order is not preserved, but instead gets appended to the end of the TYPE node.

Steps to reproduce

For example, the AST produced for this query,

    #[test]
    fn test_whitespace() {
        let schema = r#"
type ProductVariation {
  id: ID!,, ,
}"#;
        let parser = Parser::new(schema);

        let ast = parser.parse();
        println!("{:?}", ast);
    }

results in the following AST:

This can be specifically seen in just the NON_NULL_TYPE node debug output:

Expected result

The Ignored tokens should be in their correct place, and the AST for the above example's NON_NULL_TYPE node should be as follows:

This is especially useful when we implement a String representation of the AST as the goal of our library is to preserve the original input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apollo-parser bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant