Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Configuring the schema augmentation process #131

Merged
merged 4 commits into from
Oct 18, 2018
Merged

Configuring the schema augmentation process #131

merged 4 commits into from
Oct 18, 2018

Conversation

michaeldgraham
Copy link
Collaborator

@michaeldgraham michaeldgraham commented Oct 17, 2018

This PR contains initial support for configuring the schema augmentation process, resolving the following issues:

A config key is added to the makeAugmentedSchema argument object:

const augmentedSchema = makeAugmentedSchema({ 
  typeDefs,
  config: {
    query: true, // default
    mutation: false
  }
}

And the same configuration object is added as a second argument to augmentSchema:

const augmentedSchema = augmentSchema(schema, {
  mutation: false
});

By providing a boolean value, you can prevent the generation of the Query or Mutation API generally. For more fine-grained control, you can provide an array of type names to exclude (such as payload types, etc.) from the schema augmentation process. Excluding a type blocks the following associated API features from being generated during the schema augmentation process.

Query API
  • A query for the excluded type is not generated.
  • Any field or query that returns a list of the excluded type will not recieve first / offset / orderBy arguments.
Mutation API
  • The create, update, and delete node mutations are not generated.
  • The Add and Remove relation mutations are not generated for any relation in the schema coming from or going to excluded type.
Example
const config =  {
  query: {
    exclude: ["MyCustomPayload"]
  },
  mutation: {
    exclude: ["MyCustomPayload"]
  }
};
// const augmentedSchema = augmentSchema(schema, config);
const augmentedSchema = makeAugmentedSchema({ 
  typeDefs,
  config
}

@johnymontana johnymontana merged commit 10256d6 into neo4j-graphql:master Oct 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants