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

Generated AST is not compat with graphql-tag #23

Closed
thangngoc89 opened this issue Feb 13, 2018 · 1 comment
Closed

Generated AST is not compat with graphql-tag #23

thangngoc89 opened this issue Feb 13, 2018 · 1 comment

Comments

@thangngoc89
Copy link

thangngoc89 commented Feb 13, 2018

This is a list of differences between the AST generated by this ppx and graphql-tag

1. Simple query

Query:

module PatientsQuery = [%graphql
  {|
  query allPatients {
    patients: patientsConnection(first: 20) {
      edges {
        node {
          id
          patientId: externalId
          phone
          address
          name
          gender
          ageInYears
        }
      }
    }
  }
  |}
];

ppx : https://gist.github.com/thangngoc89/707524bb00dcc573f69f60bb0a776ac9#file-1-ppx-json
tag: https://gist.github.com/thangngoc89/707524bb00dcc573f69f60bb0a776ac9#file-1-tag-json

Diff (left: ppx, right: tag)
image

After I edit the generated JS, apollo client could use this without issue

2. Query with arguments

This is the same query with above but with arguments and input

query allPatients($first: Int!) {
    patients: patientsConnection(first: $first) {
      edges {
        node {
          id
          patientId: externalId
          phone
          address
          name
          gender
          ageInYears
        }
      }
    }
  }

ppx : https://gist.github.com/thangngoc89/707524bb00dcc573f69f60bb0a776ac9#file-2-ppx-json
tag: https://gist.github.com/thangngoc89/707524bb00dcc573f69f60bb0a776ac9#file-2-tag-json

Diff (left: ppx, right: tag)
image

In this case, even if I edited this generated JS, apollo-client stills send an malformed query like this (notice the [Object object] )

image

@mhallin
Copy link
Owner

mhallin commented Feb 18, 2018

Thank you for finding this. I just published 0.2.1 which should fix this issue. Please let me know if there still are compatibility issues.

@mhallin mhallin closed this as completed Feb 18, 2018
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

No branches or pull requests

2 participants