How to generate schema.graphql with Query and Mutation types

Hi, I’m referring to the guide here (Querying the graph | ComposeDB on Ceramic) saying: " The ComposeClient automatically generates a GraphQL Schema from the runtime composite definition.
It notablly creates a CeramicAccount" … and Query/Mutation objects based on the composite schema.

I see this file in the next-notes example (js-composedb/schema.graphql at main · ceramicstudio/js-composedb · GitHub)

How is this file being generated? I could not find anything further in the docs about it.

Or do I strictly even need it, if I’m using relay and the relay-compiler and I don’t use the “node” or CeramicAccount attributes in my query?

Thanks! Jan

Hi, the GraphQL schema is generated automatically by the ComposeDB client.

If you want to output the generated schema to a file (for example to be used by Relay’s compiler), you can use the CLI: CLI: graphql:* commands | ComposeDB on Ceramic or the devtools APIs directly: Module: devtools-node | ComposeDB on Ceramic

Thanks, Paul!

To confirm and summarize: The schema is generated internally in the ComposeClient and normally I would not need to export it. But when using Relay, I’d have to export and feed it to the relay compiler, so queries using CeramicAccount can be processed. Is that correct?

I started my app by using and adapting the next-notes example and that is using Relay, so I’m trying to get that to work … but this last puzzle piece is missing for me (how to run the relay compiler and what files are needed). When I run the relay compiler, it finds the graphql queries in my .ts files, but it complains about CeramicAccount fragments in the queries, so how would relay know about the exported schema.graphql?
Thanks for any help! Everything else is deployed and running.


Nevermind, I was missing some stuff in relay.config.json. It’s starting to make sense

  "src": "./src",
  "language": "typescript",
  "artifactDirectory": "./src/__generated__/relay",
  "schema": "./data/schema.graphql",
  "exclude": ["**/node_modules/**", "**/__generated__/**"]