joarwilk / gql2flow

Convert a GraphQL Schema to a flow definition
97 stars 24 forks source link

Ignore property types #28

Open imaximix opened 7 years ago

imaximix commented 7 years ago

With these changes you can now ignore properties that have specific types instead of the whole type.

I'm not that familiar with the spec, so I might have missed some use cases. This just works well enough for me since I'm just using regular ol' types.

E.g. schema

type Role {
  name: String!
}

type User {
  email: String!,
  roles: [Role]!
}

gql2flow --ignore-property-types "Role"

type User = {
  email: string
}

type Role = {
  name: string
}

gql2flow

type User = {
  email: string,
  roles: Array<Role>
}

type Role = {
  name: string
}

The reason is that I needed these types to annotate my resolver functions in apollo.