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

Commit

Permalink
Custom nested mutations using @cypher on input fields (#542)
Browse files Browse the repository at this point in the history
* blocks generated translation of input objects to cypher parameters

* clones the gql definitions object to prevent errors with repeated augmentation

* adds INPUT_FIELD_DEFINITION to @cypher locations

* adds support for nested and sibling @cypher on INPUT_FIELD_DEFINITION

* adds test paths for nested @cypher input

* helpers for @cypher input tests

* test schema for @cypher input

* simplifies import path, removes misplaced config

* test helpers for @cypher input (experimental)

* test schema for @cypher input (experimental)

* updates @cypher directive

* updates @cypher directive

* updates @cypher directive

* @cypher input tests

* @cypher input tests (experimental)
  • Loading branch information
michaeldgraham authored Nov 18, 2020
1 parent ae5a246 commit e2825f9
Show file tree
Hide file tree
Showing 15 changed files with 3,459 additions and 53 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"build-with-sourcemaps": "babel src --presets @babel/preset-env --out-dir dist --source-maps",
"precommit": "lint-staged",
"prepare": "npm run build",
"test": "nyc --reporter=lcov ava test/unit/augmentSchemaTest.test.js test/unit/configTest.test.js test/unit/assertSchema.test.js test/unit/cypherTest.test.js test/unit/filterTest.test.js test/unit/filterTests.test.js test/unit/experimental/augmentSchemaTest.test.js test/unit/experimental/cypherTest.test.js",
"test": "nyc --reporter=lcov ava test/unit/augmentSchemaTest.test.js test/unit/configTest.test.js test/unit/assertSchema.test.js test/unit/cypherTest.test.js test/unit/filterTest.test.js test/unit/filterTests.test.js test/unit/custom/cypherTest.test.js test/unit/experimental/augmentSchemaTest.test.js test/unit/experimental/cypherTest.test.js test/unit/experimental/custom/cypherTest.test.js",
"parse-tck": "babel-node test/helpers/tck/parseTck.js",
"test-tck": "nyc ava --fail-fast test/unit/filterTests.test.js",
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
Expand Down
3 changes: 2 additions & 1 deletion src/augment/augment.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import { augmentDirectiveDefinitions } from './directives';
import { extractResolversFromSchema, augmentResolvers } from './resolvers';
import { addAuthDirectiveImplementations } from '../auth';
import _ from 'lodash';

/**
* The main export for augmenting an SDL document
Expand All @@ -40,7 +41,7 @@ export const makeAugmentedExecutableSchema = ({
let definitions = [];
if (isParsedTypeDefs) {
// Print if we recieved parsed type definitions in a GraphQL Document
definitions = typeDefs.definitions;
definitions = _.cloneDeep(typeDefs.definitions);
} else {
// Otherwise parse the SDL and get its definitions
definitions = parse(typeDefs).definitions;
Expand Down
5 changes: 4 additions & 1 deletion src/augment/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ const directiveDefinitionBuilderMap = {
}
}
],
locations: [DirectiveLocation.FIELD_DEFINITION]
locations: [
DirectiveLocation.FIELD_DEFINITION,
DirectiveLocation.INPUT_FIELD_DEFINITION
]
};
},
[DirectiveDefinition.RELATION]: ({ config }) => {
Expand Down
Loading

0 comments on commit e2825f9

Please sign in to comment.