How to use the extendSchema function from graphql

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

7
8
9
10
11
12
13
14
15
16
  let astDocument = parse(typeDefs);
  let schema = buildASTSchema(astDocument);

  let extensionsAst = extractExtensionDefinitions(astDocument);
  if (extensionsAst.definitions.length > 0) {
    schema = extendSchema(schema, extensionsAst);
  }

  return schema;
};
fork icon0
star icon29
watch icon2

193
194
195
196
197
198
199
200
201
202
if (schemaExtensions.length <= 0) {
  return baseSchema;
}

// TODO T24511737 figure out if this is dangerous
return extendSchema(
  baseSchema,
  {
    kind: 'Document',
    definitions: schemaExtensions,
fork icon0
star icon10
watch icon3

+ 3 other calls in file

163
164
165
166
167
168
169
170
171
172

if (schemaExtensions.length <= 0) {
  return baseSchema;
}

return extendSchema(baseSchema, {
  kind: 'Document',
  // Flow doesn't recognize that TypeSystemDefinitionNode is a subset of DefinitionNode
  definitions: (schemaExtensions: Array<$FlowFixMe>),
});
fork icon0
star icon0
watch icon2

156
157
158
159
160
161
162
163
164
    if (schemaExtensions.length === 0) {
      return schema;
    }
    const extension = schemaExtensions.join('\n');
    return cachedExtend(schema, extension, () =>
      extendSchema(schema, parse(extension)),
    );
  });
}
fork icon0
star icon0
watch icon1

+ 3 other calls in file

142
143
144
145
146
147
148
149
150
151

function transformASTSchema(
  schema: GraphQLSchema,
  schemaExtensions: Array<string>,
): GraphQLSchema {
  return GraphQL.extendSchema(
    schema,
    GraphQL.parse(schemaExtensions.join('\n')),
  );
}
fork icon0
star icon0
watch icon2