How to use the GraphQLInterfaceType function from graphql

Find comprehensive JavaScript graphql.GraphQLInterfaceType code examples handpicked from public code repositorys.

0
1
2
3
4
5
6
7
8
9
const graphql = require('graphql');
const assert = require('assert');
const _ = require('lodash');

const InputObjectType = graphql.GraphQLInputObjectType;
const InterfaceType = graphql.GraphQLInterfaceType;
const ScalarType = graphql.GraphQLScalarType;
const ObjectType = graphql.GraphQLObjectType;
const UnionType = graphql.GraphQLUnionType;
const NonNullType = graphql.GraphQLNonNull;
fork icon13
star icon203
watch icon10

+ 3 other calls in file

3
4
5
6
7
8
9
10
11
12
const getGraphqlName = require('./getGraphqlName');
const getGraphqlTypeResolver = require('./getGraphqlTypeResolver');

function getGraphqlInterfaceType(g, iri) {

  return new GraphQLInterfaceType({
    name: `${getGraphqlName(g, iri)}Interface`,
    description: `Interface for ${iri}`,
    fields: () => require('./getGraphqlFieldConfigMap')(g, iri), // dynamic require to prevent require cycles
    resolveType: getGraphqlTypeResolver(g, iri),
fork icon12
star icon73
watch icon8

25
26
27
28
29
30
31
32
33
34
    fields: () => this._parseFields(this._rawInterface.fields, types)
  });
  for (const listener of this._listeners.onGenerateInterface) {
    ifaceDef = Object.assign(ifaceDef, listener({ iface: ifaceDef, types }));
  }
  return new graphql.GraphQLInterfaceType(ifaceDef);
}

_parseFields(fields, types) {
  const finalFields = {};
fork icon6
star icon36
watch icon5

0
1
2
3
4
5
6
7
8
9
const graphql = require('graphql');

const TitleType = require('./title');

// Article, Media, etc
const BlockItem = new graphql.GraphQLInterfaceType({
        id: {
            type: new graphql.GraphQLString()
        },
        type: {
fork icon2
star icon0
watch icon27

4
5
6
7
8
9
10
11
12
13
global.GraphqlSchema = global.GraphQLSchema = graphql.GraphQLSchema;
global.GraphqlObjectType = global.GraphQLObjectType = graphql.GraphQLObjectType;
global.GraphqlList = global.GraphQLList = graphql.GraphQLList;
global.GraphqlNonNull = global.GraphQLNonNull = graphql.GraphQLNonNull;
global.GraphqlUnionType = global.GraphQLUnionType = graphql.GraphQLUnionType;
global.GraphqlInterfaceType = global.GraphQLInterfaceType = graphql.GraphQLInterfaceType;
global.GraphqlEnumType = global.GraphQLEnumType = graphql.GraphQLEnumType;
global.GraphqlInt = global.GraphQLInt = graphql.GraphQLInt;
global.GraphqlFloat = global.GraphQLFloat = graphql.GraphQLFloat;
global.GraphqlString = global.GraphQLString = graphql.GraphQLString;
fork icon0
star icon0
watch icon5