GraphQL Schema

The first piece of any GraphQL API is the schema, which defines what data is made available to the client.

In Vulcan, this GraphQL schema can be generated automatically from your collection’s JSON schema, so you don’t have to type things twice. Just pass a SimpleSchema-compatible JSON schema as createCollection‘s schema property.

Viewing the Schema

You can view your GraphQL schema using the Meteor shell. First, launch the shell with:

1
meteor shell

Then, type:

1
Vulcan.getGraphQLSchema()

Custom Schemas

If you need to manually add a schema, you can also do so using the GraphQLSchema.addSchema function, which will add one or more GraphQL schemas to your GraphQL API:

1
2
3
4
5
6
7
8
const customSchema = `
input Custom {
_id: String
userId: String
title: String
}
`;
GraphQLSchema.addSchema(customSchema);
Edit on GitHub