the V3 strapi is generating a graphql schema ( ./exports/graphql/schema.graphql). We use this to publish this subgraph to our apollo studio. In the current v4 version no export file is generated. Is that intended?
If so, is there a way to generate this scheme somehow differently?
I’m not sure if there is another (better) way, but if you edit @strapi/plugin-graphql directly you can generate types following instructions from the Nexus docs.
The Strapi team have mentioned using patch-package as an option for making these sorts of changes permanent without having to fork the project.
In this file: node_modules/@strapi/plugin-graphql/server/services/content-api/index.js
Add the following:
const path = require('path')
// ------ other stuff--------//
// Amend the makeSchema function (which starts on line 88) by adding shouldGenerateArtifacts & locations for generated type files.
const nexusSchema = makeSchema({
types: [
// Add the auto-generated Nexus types (shadow CRUD)
registry.definitions,
// Add every Nexus type registered using the extension service
types,
],
plugins: [
// Add every plugin registered using the extension service
...plugins,
],
shouldGenerateArtifacts: process.env.NODE_ENV === 'development',
outputs: {
schema: path.join(__dirname, 'generated/schema.gen.graphql'),
typegen: path.join(__dirname, 'generated/nexusTypes.gen.ts'),
},
});
I am not certain whether this is what you are looking for as I don’t use Apollo Studio and have been using introspection with client-side Apollo instead.