Skip to content

Inversion of skip? #32

Description

@acro5piano

Hi, thank you for the great library again.

I would like to propose a new API only, which is the inversion of skip.

The use case: We have a database table and GraphQL schema has "virtual" columns.

GraphQL:

type User {
  id: ID!
  firstName: String
  lastName: String
  fullName: String
}

Database:

- users:
  - id
  - firstName
  - lastName

Resolver:

const UserResolver = {
  lastName(root: User) {
    return `${user.firstName} ${user.lastName}`
  }
}

In this case, it would be really helpful if we have only

fieldsToList(info, {
  only: ['id', 'firstName', 'lastName'],
})

If you are okay, I'll create a PR for this.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions