0.1.1 • Published 5 years ago

graphql-filter-field v0.1.1

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

graphql-filter-field

filter any field on Schema not just root field

Install

yarn add graphql-filter-field

Usage

filterFields passes through all GraphQL type.

const typeDefs = `
  type User {
    id: ID
    fullName: String
    hello_delete: String
  }

  type Query {
    users: [User]
  }
`
const schema = makeExecutableSchema({ typeDefs })
addMockFunctionsToSchema({ schema })
const newSchema = filterFields(schema, (field) => {
  return field.name.endsWith('_delete')
})