Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codegen from Apollo executableSchema object #1046

Open
piglovesyou opened this issue Feb 25, 2019 · 0 comments
Open

Codegen from Apollo executableSchema object #1046

piglovesyou opened this issue Feb 25, 2019 · 0 comments
Labels
🤖 component - codegen related to the codegen core packages

Comments

@piglovesyou
Copy link

This is a feature proposal which would be the third option of service to achieve codegen.

Problem

I need to launch a GraphQL server on CI even though I don't need it.

  • I don't want to include any auto-generated files including introspection schema files in Git
  • I'd like to pass static type checking on CI with type files in __generated__.
  • So I need to do Codegen on CI
  • To do that, currently I need to do the following steps in yarn codegen:
    1. Start GraphQL server with my executableSchema object
    2. Run apollo client:codegen command
    3. Stop the server

Launching a server is redundant, since we have apollo-link-schema which make it possible to communicate with GraphQL without HTTP servers.

Solution

Why don't we accept the third option for service in apollo.config.js like this:

const { makeExecutableSchema } = require('graphql-tools');
const { default as schema } = require('./src/data/schema');

module.exports = {
  service: {
    executableSchema: {
      schema: makeExecutableSchema(schema),
      context: {},
    },
  },
};

which is passed as a parameter to SchemaLink of apollo-link-schema.

I know Apollo Tooling avoids implementing Apollo Server-specific features, but I think it's efficient for Apollo toolset users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 component - codegen related to the codegen core packages
Projects
None yet
Development

No branches or pull requests

2 participants