Skip to content

Commit 9cbe464

Browse files
committed
remove schemas property
1 parent 0664fbf commit 9cbe464

File tree

11 files changed

+59
-93
lines changed

11 files changed

+59
-93
lines changed

packages/links/tests/upload.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('graphql upload', () => {
114114
};
115115

116116
const gatewaySchema = stitchSchemas({
117-
schemas: [subschema],
117+
subschemas: [subschema],
118118
resolvers: {
119119
Upload: ServerGraphQLUpload,
120120
},

packages/merge/tests/merge-typedefs.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ describe('Merge TypeDefs', () => {
763763
});
764764
it('should handle extend types when GraphQLSchema is the source', () => {
765765
const schema = stitchSchemas({
766-
schemas: [
766+
typeDefs: [
767767
`
768768
type Query {
769769
foo: String
@@ -807,7 +807,7 @@ describe('Merge TypeDefs', () => {
807807

808808
it('should handle extend input types', () => {
809809
const schema = stitchSchemas({
810-
schemas: [
810+
typeDefs: [
811811
`
812812
type Query {
813813
foo(i: TestInput): String

packages/stitch/src/stitchSchemas.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
GraphQLDirective,
66
specifiedDirectives,
77
extendSchema,
8-
isSchema,
98
ASTNode,
109
GraphQLNamedType,
1110
} from 'graphql';
@@ -34,8 +33,6 @@ export function stitchSchemas({
3433
subschemas = [],
3534
types = [],
3635
typeDefs,
37-
// `schemas` to be removed in v7, replaces by subschemas, types, typeDefs
38-
schemas = [],
3936
onTypeConflict,
4037
mergeDirectives,
4138
mergeTypes = false,
@@ -77,48 +74,14 @@ export function stitchSchemas({
7774
}
7875
});
7976

80-
// to be removed in v7
81-
schemas.forEach(schemaLikeObject => {
82-
if (
83-
!isSchema(schemaLikeObject) &&
84-
!isSubschemaConfig(schemaLikeObject) &&
85-
typeof schemaLikeObject !== 'string' &&
86-
!isDocumentNode(schemaLikeObject) &&
87-
!Array.isArray(schemaLikeObject)
88-
) {
89-
throw new Error('Invalid schema passed');
90-
}
91-
});
92-
93-
// to be removed in v7
94-
schemas.forEach(schemaLikeObject => {
95-
if (isSchema(schemaLikeObject) || isSubschemaConfig(schemaLikeObject)) {
96-
schemaLikeObjects.push(schemaLikeObject);
97-
}
98-
});
99-
10077
if ((typeDefs && !Array.isArray(typeDefs)) || (Array.isArray(typeDefs) && typeDefs.length)) {
10178
schemaLikeObjects.push(buildDocumentFromTypeDefinitions(typeDefs, parseOptions));
10279
}
10380

104-
// to be removed in v7
105-
schemas.forEach(schemaLikeObject => {
106-
if (typeof schemaLikeObject === 'string' || isDocumentNode(schemaLikeObject)) {
107-
schemaLikeObjects.push(buildDocumentFromTypeDefinitions(schemaLikeObject, parseOptions));
108-
}
109-
});
110-
11181
if (types != null) {
11282
schemaLikeObjects = schemaLikeObjects.concat(types);
11383
}
11484

115-
// to be removed in v7
116-
schemas.forEach(schemaLikeObject => {
117-
if (Array.isArray(schemaLikeObject)) {
118-
schemaLikeObjects = schemaLikeObjects.concat(schemaLikeObject);
119-
}
120-
});
121-
12285
const transformedSchemas: Map<GraphQLSchema | SubschemaConfig, GraphQLSchema> = new Map();
12386
const extensions: Array<DocumentNode> = [];
12487
const directives: Array<GraphQLDirective> = [];

packages/stitch/src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export interface IStitchSchemasOptions<TContext = any> extends Omit<IExecutableS
6464
subschemas?: Array<GraphQLSchema | SubschemaConfig | Array<SubschemaConfig>>;
6565
typeDefs?: ITypeDefinitions;
6666
types?: Array<GraphQLNamedType>;
67-
schemas?: Array<SchemaLikeObject>;
6867
onTypeConflict?: OnTypeConflict;
6968
mergeDirectives?: boolean;
7069
mergeTypes?: boolean | Array<string> | MergeTypeFilter;

packages/stitch/tests/alternateStitchSchemas.test.ts

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ describe('optional arguments', () => {
426426
});
427427

428428
const stitchedSchema = stitchSchemas({
429-
schemas: [schema],
429+
subschemas: [schema],
430430
});
431431

432432
it('work with schema stitching', async () => {
@@ -1494,12 +1494,12 @@ describe('interface resolver inheritance', () => {
14941494

14951495
test('copies resolvers from interface', async () => {
14961496
const stitchedSchema = stitchSchemas({
1497-
schemas: [
1498-
// pull in an executable schema just so mergeSchema doesn't complain
1497+
subschemas: [
1498+
// pull in an executable schema just so stitchSchemas doesn't complain
14991499
// about not finding default types (e.g. ID)
15001500
propertySchema,
1501-
testSchemaWithInterfaceResolvers,
15021501
],
1502+
typeDefs: testSchemaWithInterfaceResolvers,
15031503
resolvers,
15041504
inheritResolversFromInterfaces: true,
15051505
});
@@ -1517,12 +1517,12 @@ describe('interface resolver inheritance', () => {
15171517

15181518
test('does not copy resolvers from interface when flag is false', async () => {
15191519
const stitchedSchema = stitchSchemas({
1520-
schemas: [
1520+
subschemas: [
15211521
// pull in an executable schema just so mergeSchema doesn't complain
15221522
// about not finding default types (e.g. ID)
15231523
propertySchema,
1524-
testSchemaWithInterfaceResolvers,
15251524
],
1525+
typeDefs: testSchemaWithInterfaceResolvers,
15261526
resolvers,
15271527
inheritResolversFromInterfaces: false,
15281528
});
@@ -1537,12 +1537,12 @@ describe('interface resolver inheritance', () => {
15371537

15381538
test('does not copy resolvers from interface when flag is not provided', async () => {
15391539
const stitchedSchema = stitchSchemas({
1540-
schemas: [
1541-
// pull in an executable schema just so mergeSchema doesn't complain
1540+
subschemas: [
1541+
// pull in an executable schema just so stitchSchemas doesn't complain
15421542
// about not finding default types (e.g. ID)
15431543
propertySchema,
1544-
testSchemaWithInterfaceResolvers,
15451544
],
1545+
typeDefs: testSchemaWithInterfaceResolvers,
15461546
resolvers,
15471547
});
15481548
const query = '{ user { id name } }';
@@ -1573,7 +1573,7 @@ describe('stitchSchemas', () => {
15731573
},
15741574
});
15751575
const stitchedSchema = stitchSchemas({
1576-
schemas: [schema],
1576+
subschemas: [schema],
15771577
});
15781578

15791579
const query = '{ test { field } }';
@@ -1599,7 +1599,7 @@ describe('stitchSchemas', () => {
15991599
},
16001600
});
16011601
const stitchedSchema = stitchSchemas({
1602-
schemas: [schema],
1602+
subschemas: [schema],
16031603
});
16041604

16051605
const query = '{ getInput(input: {}) }';
@@ -1645,7 +1645,7 @@ type Query {
16451645
},
16461646
});
16471647
const stitchedSchema = stitchSchemas({
1648-
schemas: [schema],
1648+
subschemas: [schema],
16491649
resolvers: {
16501650
TestScalar: new GraphQLScalarType({
16511651
name: 'TestScalar',
@@ -1685,7 +1685,7 @@ type Query {
16851685
},
16861686
});
16871687
const stitchedSchema = stitchSchemas({
1688-
schemas: [schema],
1688+
subschemas: [schema],
16891689
resolvers: {
16901690
TestScalar: new GraphQLScalarType({
16911691
name: 'TestScalar',
@@ -1720,14 +1720,12 @@ type Query {
17201720
},
17211721
});
17221722
const stitchedSchema = stitchSchemas({
1723-
schemas: [
1724-
schema,
1725-
`
1726-
type Query {
1727-
get2: WrappingType
1728-
}
1729-
`,
1730-
],
1723+
subschemas: [schema],
1724+
typeDefs: `
1725+
type Query {
1726+
get2: WrappingType
1727+
}
1728+
`,
17311729
resolvers: {
17321730
Query: {
17331731
get2: (_root, _args, context, info) =>
@@ -1766,7 +1764,7 @@ type Query {
17661764
});
17671765

17681766
const stitchedSchema = stitchSchemas({
1769-
schemas: [schema],
1767+
subschemas: [schema],
17701768
resolvers: {
17711769
Query: {
17721770
wrappingObject: () => ({
@@ -1838,7 +1836,7 @@ describe('onTypeConflict', () => {
18381836

18391837
test('by default takes last type', async () => {
18401838
const stitchedSchema = stitchSchemas({
1841-
schemas: [schema1, schema2],
1839+
subschemas: [schema1, schema2],
18421840
});
18431841
const result1 = await graphql(stitchedSchema, '{ test2 { fieldC } }');
18441842
expect(result1.data?.test2.fieldC).toBe('C');
@@ -1848,7 +1846,7 @@ describe('onTypeConflict', () => {
18481846

18491847
test('can use onTypeConflict to select last type', async () => {
18501848
const stitchedSchema = stitchSchemas({
1851-
schemas: [schema1, schema2],
1849+
subschemas: [schema1, schema2],
18521850
onTypeConflict: (_left, right) => right,
18531851
});
18541852
const result1 = await graphql(stitchedSchema, '{ test2 { fieldC } }');
@@ -1859,7 +1857,7 @@ describe('onTypeConflict', () => {
18591857

18601858
test('can use onTypeConflict to select first type', async () => {
18611859
const stitchedSchema = stitchSchemas({
1862-
schemas: [schema1, schema2],
1860+
subschemas: [schema1, schema2],
18631861
onTypeConflict: (left) => left,
18641862
});
18651863
const result1 = await graphql(stitchedSchema, '{ test1 { fieldB } }');

packages/stitch/tests/dataloader.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('dataloader', () => {
4949
});
5050

5151
const schema = stitchSchemas({
52-
schemas: [taskSchema, userSchema],
52+
subschemas: [taskSchema, userSchema],
5353
typeDefs: `
5454
extend type Task {
5555
user: User!

packages/stitch/tests/errors.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('passes along errors for missing fields on list', () => {
3131
});
3232

3333
const stitchedSchema = stitchSchemas({
34-
schemas: [schema],
34+
subschemas: [schema],
3535
});
3636

3737
const query = '{ getOuter { innerList { mandatoryField } } }';
@@ -66,7 +66,7 @@ describe('passes along errors for missing fields on list', () => {
6666
});
6767

6868
const stitchedSchema = stitchSchemas({
69-
schemas: [schema],
69+
subschemas: [schema],
7070
});
7171

7272
const query = '{ getOuter { innerList { mandatoryField } } }';
@@ -103,7 +103,7 @@ describe('passes along errors when list field errors', () => {
103103
});
104104

105105
const stitchedSchema = stitchSchemas({
106-
schemas: [schema],
106+
subschemas: [schema],
107107
});
108108

109109
const query = '{ getOuter { innerList { mandatoryField } } }';
@@ -138,7 +138,7 @@ describe('passes along errors when list field errors', () => {
138138
});
139139

140140
const stitchedSchema = stitchSchemas({
141-
schemas: [schema],
141+
subschemas: [schema],
142142
});
143143

144144
const query = '{ getOuter { innerList { mandatoryField } } }';
@@ -207,7 +207,7 @@ describe('passes along errors for remote schemas', () => {
207207
}) as ExecutionResult<any>;
208208

209209
const stitchedSchema = stitchSchemas({
210-
schemas: [{
210+
subschemas: [{
211211
schema,
212212
executor,
213213
}]

packages/stitch/tests/fragments.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ describe('stitching', () => {
7878
let schema: GraphQLSchema;
7979
beforeAll(() => {
8080
schema = stitchSchemas({
81-
schemas: [bookingSchema, propertySchema, proxyTypeDefs],
81+
subschemas: [bookingSchema, propertySchema],
82+
typeDefs: proxyTypeDefs,
8283
resolvers: proxyResolvers,
8384
});
8485
});

0 commit comments

Comments
 (0)