Is it possible to change the schema file pattern

I am referring to the documentation to specify the schema file and as per documentation by default it matches the pattern schema.[graphqls|json|sdl]

Is it possible to add .graphql ? We source schema from a different team who have it as schema.graphql. I am wondering if i should rename it or if there is any way for apollo kotlin to understand .graphql extension too

You can set your schema explicitely with schemaFile:

apollo {
  service("api") {
    schemaFile.set("path/to/schema.graphql")
  }
}

Beware that your schema should be in a separate folder from your operations or Apollo will try to parse your schema as an operation and fail.

Similar to schemaFile.set, is there a way to specify operation files too from a different path ?

I know one way to achieve is srcDir(file("path")) but it doesn’t exist in apollo3.

Can i have schemaFile.set and have operations read from srcDir(file("path"))

It should be there in apollo3, srcDir() has been there for a while now.

1 Like