timqian / gql-generator

Generate queries from graphql schema, used for writing api test.
MIT License
375 stars 93 forks source link

How to generate __typename? #63

Closed snawaz closed 2 years ago

snawaz commented 2 years ago

Currently, my mutation is generated as:

mutation login($login: LoginInput!){
    login(login: $login){
        ... on Authorised {
            _tag
            tokens{
                accessToken
                refreshToken
                accessExpiration
            }
        }
        ... on UnAuthorised {
            _tag
        }
    }
}

I want __typename to be generated as well, like:

mutation login($login: LoginInput!){
    login(login: $login){
        __typename                      <----- THIS SHOULD BE GENERATED AS WELL
        ... on Authorised {
            _tag
            tokens{
                accessToken
                refreshToken
                accessExpiration
            }
        }
        ... on UnAuthorised {
            _tag
        }
    }
}

How can I get this?