Skip to content

Commit 3a7fafa

Browse files
committed
repeatable flag in the introspection results is now optional
1 parent 3b5bf03 commit 3a7fafa

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/utilities/__tests__/buildClientSchema-test.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,19 @@ import {
3737
// query against the client-side schema, it should get a result identical to
3838
// what was returned by the server.
3939
function testSchema(serverSchema) {
40-
const initialIntrospection = introspectionFromSchema(serverSchema);
40+
const introspectionOptions = {
41+
descriptions: true,
42+
directiveRepeatableFlag: true,
43+
};
44+
const initialIntrospection = introspectionFromSchema(
45+
serverSchema,
46+
introspectionOptions,
47+
);
4148
const clientSchema = buildClientSchema(initialIntrospection);
42-
const secondIntrospection = introspectionFromSchema(clientSchema);
49+
const secondIntrospection = introspectionFromSchema(
50+
clientSchema,
51+
introspectionOptions,
52+
);
4353
expect(secondIntrospection).to.deep.equal(initialIntrospection);
4454
}
4555

src/utilities/buildClientSchema.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,10 @@ export function buildClientSchema(
355355
description: directiveIntrospection.description,
356356
locations: directiveIntrospection.locations.slice(),
357357
args: buildInputValueDefMap(directiveIntrospection.args),
358-
repeatable: directiveIntrospection.repeatable,
358+
repeatable:
359+
directiveIntrospection.repeatable === undefined
360+
? false
361+
: directiveIntrospection.repeatable,
359362
});
360363
}
361364

src/utilities/introspectionQuery.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,5 +279,5 @@ export type IntrospectionDirective = {|
279279
+description?: ?string,
280280
+locations: $ReadOnlyArray<DirectiveLocationEnum>,
281281
+args: $ReadOnlyArray<IntrospectionInputValue>,
282-
+repeatable: boolean,
282+
+repeatable?: boolean,
283283
|};

0 commit comments

Comments
 (0)