Skip to content

Conversation

@Convly
Copy link
Member

@Convly Convly commented Feb 10, 2022

What does it do?

Adds a artifacts attribute in the GraphQL plugin configuration that allows generating artifacts (GraphQL schema & types definitions) for ou application.
Also, add a generateArtifacts config option to allow or not the generation of such artifacts. The default value is true in dev ENV and false otherwise.

A documentation PR will follow soon.

Why is it needed?

In V3 it was possible to extract our GraphQL schema.

How to test it?

src/config/plugins.js

'use strict';

const { join } = require('path');

module.exports = () => ({
  // ...
  graphql: {
    enabled: true,
    config: {
      generateArtifacts: true,
      artifacts: {
        schema: join(__dirname, '..', 'schema.graphql'),
        typegen: join(__dirname, '..', 'types.d.ts'),
      },
    }
  }
})

Related issue(s)/PR(s)

Fix #12420

@Convly Convly added issue: enhancement Issue suggesting an enhancement to an existing feature source: plugin:graphql Source is plugin/graphql package labels Feb 10, 2022
@Convly Convly added this to the 4.0.8 milestone Feb 10, 2022
@codecov
Copy link

codecov bot commented Feb 10, 2022

Codecov Report

Merging #12467 (96aee20) into master (e5402d0) will not change coverage.
The diff coverage is n/a.

❗ Current head 96aee20 differs from pull request most recent head 97254f8. Consider uploading reports for the commit 97254f8 to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #12467   +/-   ##
=======================================
  Coverage   47.64%   47.64%           
=======================================
  Files         210      210           
  Lines        8177     8177           
  Branches     1849     1849           
=======================================
  Hits         3896     3896           
  Misses       3520     3520           
  Partials      761      761           
Flag Coverage Δ
front ?
unit 47.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5402d0...97254f8. Read the comment docs.

petersg83
petersg83 previously approved these changes Feb 10, 2022
Copy link
Contributor

@petersg83 petersg83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me :)
I put a suggestion for a line but feel free to ignore it

Copy link
Member

@alexandrebodin alexandrebodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any tests you can add ?

@Convly Convly force-pushed the enhancement/gql-artifacts-generation branch from b911c95 to ae7731c Compare February 14, 2022 10:01
@Convly Convly merged commit 5da5c3a into master Feb 14, 2022
@Convly Convly deleted the enhancement/gql-artifacts-generation branch February 14, 2022 15:48
@strapi-bot
Copy link

This pull request has been mentioned on Strapi Community Forum. There might be relevant details there:

https://forum.strapi.io/t/v4-graphql-type-definitions-are-not-generated/13470/11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

issue: enhancement Issue suggesting an enhancement to an existing feature source: plugin:graphql Source is plugin/graphql package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graphql schema isn't generated

5 participants