Skip to content

Commit 131c9b8

Browse files
authored
Preparations for [email protected]. (#3712)
* Adjust test to not use deprecated `introspectionQuery` constant. Instead, use `getIntrospectionQuery` instead, which has been around since before [email protected], thus within our supported version ranges. * Adjust documentation links for moved `introspectionQuery` page. This file now lives at `getIntrospectionQuery`. * Applying upstream modification to `printDescription`. I'm assuming we'll want to keep this change which was also applied upstream, though I'm not sure what our longer term plans are for keeping up with these changes. Ref: https://github.com/graphql/graphql-js/pull/2177/files#diff-71ba52e9c625f826d2b0df2963c8633aR320 * Remove empty descriptions which will be included in SDL w/graphql@15. In `graphql@15`, empty descriptions are intentionally included in the SDL output. In order to be excluded entirely, they must be absent (or `null`). Ref: graphql/graphql-js#2177
1 parent 2ea7c15 commit 131c9b8

File tree

5 files changed

+5
-14
lines changed

5 files changed

+5
-14
lines changed

docs/source/testing/mocking.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ server.listen().then(({ url }) => {
187187

188188
## Mocking a schema using introspection
189189

190-
The GraphQL specification allows clients to introspect the schema with a [special set of types and fields](https://facebook.github.io/graphql/#sec-Introspection) that every schema must include. The results of a [standard introspection query](https://github.com/graphql/graphql-js/blob/master/src/utilities/introspectionQuery.js) can be used to generate an instance of GraphQLSchema which can be mocked as explained above.
190+
The GraphQL specification allows clients to introspect the schema with a [special set of types and fields](https://facebook.github.io/graphql/#sec-Introspection) that every schema must include. The results of a [standard introspection query](https://github.com/graphql/graphql-js/blob/master/src/utilities/getIntrospectionQuery.js) can be used to generate an instance of GraphQLSchema which can be mocked as explained above.
191191

192192
This helps when you need to mock a schema defined in a language other than JS, for example Go, Ruby, or Python.
193193

194-
To convert an [introspection query](https://github.com/graphql/graphql-js/blob/master/src/utilities/introspectionQuery.js) result to a `GraphQLSchema` object, you can use the `buildClientSchema` utility from the `graphql` package.
194+
To convert an [introspection query](https://github.com/graphql/graphql-js/blob/master/src/utilities/getIntrospectionQuery.js) result to a `GraphQLSchema` object, you can use the `buildClientSchema` utility from the `graphql` package.
195195

196196
```js
197197
const { buildClientSchema } = require('graphql');

packages/apollo-federation/src/directives.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,48 +23,40 @@ import {
2323

2424
export const KeyDirective = new GraphQLDirective({
2525
name: 'key',
26-
description: '',
2726
locations: [DirectiveLocation.OBJECT, DirectiveLocation.INTERFACE],
2827
args: {
2928
fields: {
3029
type: GraphQLNonNull(GraphQLString),
31-
description: '',
3230
},
3331
},
3432
});
3533

3634
export const ExtendsDirective = new GraphQLDirective({
3735
name: 'extends',
38-
description: '',
3936
locations: [DirectiveLocation.OBJECT, DirectiveLocation.INTERFACE],
4037
});
4138

4239
export const ExternalDirective = new GraphQLDirective({
4340
name: 'external',
44-
description: '',
4541
locations: [DirectiveLocation.OBJECT, DirectiveLocation.FIELD_DEFINITION],
4642
});
4743

4844
export const RequiresDirective = new GraphQLDirective({
4945
name: 'requires',
50-
description: '',
5146
locations: [DirectiveLocation.FIELD_DEFINITION],
5247
args: {
5348
fields: {
5449
type: GraphQLNonNull(GraphQLString),
55-
description: '',
5650
},
5751
},
5852
});
5953

6054
export const ProvidesDirective = new GraphQLDirective({
6155
name: 'provides',
62-
description: '',
6356
locations: [DirectiveLocation.FIELD_DEFINITION],
6457
args: {
6558
fields: {
6659
type: GraphQLNonNull(GraphQLString),
67-
description: '',
6860
},
6961
},
7062
});

packages/apollo-federation/src/service/printFederatedSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ function printDescription(
342342
| GraphQLUnionType,
343343
indentation: string = '',
344344
): string {
345-
if (!def.description) {
345+
if (def.description == null) {
346346
return '';
347347
}
348348

packages/apollo-federation/src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export const entitiesField: GraphQLFieldConfig<any, any> = {
7676
type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(AnyType))),
7777
},
7878
},
79-
description: '',
8079
resolve(_source, { representations }, context, info) {
8180
return representations.map((reference: { __typename: string } & object) => {
8281
const { __typename } = reference;

packages/apollo-server-integration-testsuite/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
GraphQLError,
1111
GraphQLNonNull,
1212
GraphQLScalarType,
13-
introspectionQuery,
13+
getIntrospectionQuery,
1414
BREAK,
1515
DocumentNode,
1616
getOperationAST,
@@ -620,7 +620,7 @@ export default (createApp: CreateAppFunc, destroyApp?: DestroyAppFunc) => {
620620
app = await createApp();
621621
const req = request(app)
622622
.post('/graphql')
623-
.send({ query: introspectionQuery });
623+
.send({ query: getIntrospectionQuery() });
624624
return req.then(res => {
625625
expect(res.status).toEqual(200);
626626
expect(res.body.data.__schema.types[0].fields[0].name).toEqual(

0 commit comments

Comments
 (0)