How to ignore @rest directives from apollo codegen

I’m using @rest directive to request some data from REST API, but when I use the command apollo client:codegen this thrown an error like so:

 Cannot query field "acceptanceToken" on type "Query"

This error points to this @rest query.

Query that thrown the error

export const wompiAcceptanceTokenQuery = gql`
  query WompiAcceptanceToken {
    acceptanceToken
      @rest(
        type: "WompiAcceptanceToken"
        path: "some/api/endpoint"
      ) {
      data
    }
  }
`

There is a way to ignore this directives from npm client:codegen script?

Current NPM script

"typegenerate": "apollo client:codegen --target=typescript types --globalTypesFile=src/types/globalTypes.ts && rm -rf types",

There are two options I can think of:

  1. You can put your @rest queries into files with a specific extension (like .rest.gql.ts or something) or put them in a specific folder (like restQueries/query.ts). Then you can exclude files that match the pattern in your apollo.config.js file

  2. You could create a local-only graphql schema that matches your rest api, which would allow the typegen to interpret your rest queries and generate typescript types