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

Commit

Permalink
Merge pull request #397 from michaeldgraham/master
Browse files Browse the repository at this point in the history
Initial support for union types
  • Loading branch information
johnymontana authored Feb 29, 2020
2 parents 2dd28d9 + acf2b10 commit cc64bea
Show file tree
Hide file tree
Showing 15 changed files with 1,418 additions and 490 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ references:
env_neo4j40ce: &env_neo4j40ce
NEO4J_DIST: 'community'
NEO4J_VERSION: '4.0.0'
APOC_VERSION: '4.0.0-rc01'
APOC_VERSION: '4.0.0.4'
DATASTORE_VERSION: '4_0'
env_neo4j40ee: &env_neo4j40ee
NEO4J_DIST: 'enterprise'
NEO4J_VERSION: '4.0.0'
APOC_VERSION: '4.0.0-rc01'
APOC_VERSION: '4.0.0.4'
DATASTORE_VERSION: '4_0'

install_neo4j_steps: &install_neo4j_steps
Expand Down
2 changes: 2 additions & 0 deletions example/apollo-server/movies-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ type CameraMan implements Person {
cameraBuddy: Person @relation(name: "cameraBuddy", direction: "OUT")
}
union MovieSearch = Movie | Genre | Book | User | OldCamera
type Query {
Movie(movieId: ID, title: String, year: Int, plot: String, poster: String, imdbRating: Float): [Movie]
MoviesByYear(year: Int, first: Int = 10, offset: Int = 0): [Movie]
Expand Down
3 changes: 1 addition & 2 deletions src/augment/input-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {
import {
isNeo4jTemporalType,
isNeo4jPointType,
Neo4jTypeName,
isQueryTypeDefinition
Neo4jTypeName
} from './types/types';
import { isCypherField } from './directives';
import {
Expand Down
8 changes: 5 additions & 3 deletions src/augment/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ export const augmentResolvers = (
// must implement __resolveInfo for every Interface type
// we use "FRAGMENT_TYPE" key to identify the Interface implementation
// type at runtime, so grab this value
const interfaceTypes = Object.keys(augmentedTypeMap).filter(
e => augmentedTypeMap[e].kind === 'InterfaceTypeDefinition'
const derivedTypes = Object.keys(augmentedTypeMap).filter(
e =>
augmentedTypeMap[e].kind === 'InterfaceTypeDefinition' ||
augmentedTypeMap[e].kind === 'UnionTypeDefinition'
);
interfaceTypes.map(e => {
derivedTypes.map(e => {
resolvers[e] = {};

resolvers[e]['__resolveType'] = (obj, context, info) => {
Expand Down
Loading

0 comments on commit cc64bea

Please sign in to comment.