Remote-schema.graphql - what to generate it?

I need to generate new remote-schema.graphql file with .graphqlconfig, based on the previous version of that file:

# This file was generated based on ".graphqlconfig". Do not edit manually.

schema {
  query: Query
}

interface FileFieldInterface {
  _createdAt: DateTime!
  _updatedAt: DateTime!
  alt(
    "If you want to fallback to a default translation when a translation has not been found"
    fallbackLocales: [SiteLocale!]
    "The locale to use 
...

My .graphqlconfig looks like this:

{
  "name": "NAME DatoCMS GraphQL Schema",
  "schemaPath": "remote-schema.graphql",
  "extensions": {
    "endpoints": {
      "Remote GraphQL Endpoint": {
        "url": "https://graphql.datocms.com",
        "headers": {
          "Authorization": "Bearer ${env:NEXT_DATOCMS_API_TOKEN}"
        },
        "introspect": true
      }
    }
  }
}

How or where I can do that?

Hello @andriyilko and welcome to the community!

It depends on what setup you are using, if you followed the tutorial at: How To Generate TypeScript Types From GraphQL — DatoCMS

You should be able to have a script such as this one in your package.json:

That can be run by running npm run generate-ts-types that will re-generate everything based on the graphql.config.yml file

2 Likes