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

Ignore property types #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Ignore property types #28

wants to merge 2 commits into from

Conversation

imaximix
Copy link

@imaximix imaximix commented Jul 3, 2017

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.

You can now ignore properties that have specific types instead of the whole type.

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.
@@ -143,7 +143,7 @@ ${fields}
let f = isInput ? type.inputFields : type.fields || [];

let fields = f
.filter(field => filterField(field, ignoredTypes))
.filter(field => filterField(field, ignoredPropertyTypes))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Shouldn't it filter for both?

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

Successfully merging this pull request may close these issues.

2 participants