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

Unexpected output on scheme based on unions #37

Open
menxit opened this issue Jun 17, 2020 · 1 comment
Open

Unexpected output on scheme based on unions #37

menxit opened this issue Jun 17, 2020 · 1 comment

Comments

@menxit
Copy link

menxit commented Jun 17, 2020

I'm generating queries based on this graphql scheme:

type Query {
  animals: [AnimalResult]!
}

union AnimalResult = Dog | Cat

type Dog {
  example: [Something!]!
}

type Cat {
  example: [Something!]!
}

type Something {
  id: ID!
}

I would expect that a animals.gql would be generated:

query animals{
    animals{
        ... on Dog {
            example{
                id
            }
        }
        ... on Cat {
            example{
                id
            }
        }
    }
}

But I obtain this:

query animals{
    animals{
        ... on Dog {
            example{
                id
            }
        }
        ... on Cat {

        }
    }
}

As you can see id field in Cat is not included.

Is this a bug? I would like to fix this, I think it could be something about this loop:
https://github.com/timqian/gql-generator/blob/master/index.js#L140

@mishasyrbu
Copy link
Collaborator

fix #44

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