diff --git a/src/execution/__tests__/abstract-test.js b/src/execution/__tests__/abstract-test.js index 0a0d5931d4..f126747d20 100644 --- a/src/execution/__tests__/abstract-test.js +++ b/src/execution/__tests__/abstract-test.js @@ -423,10 +423,7 @@ describe('Execute: Handles execution of abstract types', () => { errors: [ { message: - 'Abstract type FooInterface must resolve to an Object type at ' + - 'runtime for field Query.foo with value "dummy", received "[]". ' + - 'Either the FooInterface type should provide a "resolveType" ' + - 'function or each possible type should provide an "isTypeOf" function.', + 'Abstract type FooInterface must resolve to an Object type at runtime for field Query.foo with value "dummy", received "[]". Either the FooInterface type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.', locations: [{ line: 1, column: 3 }], path: ['foo'], }, diff --git a/src/execution/execute.js b/src/execution/execute.js index 61e6dee709..6f57c1e2f5 100644 --- a/src/execution/execute.js +++ b/src/execution/execute.js @@ -288,9 +288,7 @@ export function assertValidExecutionArguments( // Variables, if provided, must be an object. invariant( !rawVariableValues || typeof rawVariableValues === 'object', - 'Variables must be provided as an Object where each property is a ' + - 'variable value. Perhaps look to see if an unparsed JSON string ' + - 'was provided.', + 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.', ); } diff --git a/src/language/__tests__/lexer-test.js b/src/language/__tests__/lexer-test.js index adc739d718..e91099b9f9 100644 --- a/src/language/__tests__/lexer-test.js +++ b/src/language/__tests__/lexer-test.js @@ -226,8 +226,7 @@ describe('Lexer', () => { expectSyntaxError( "'single quotes'", - "Unexpected single quote character ('), " + - 'did you mean to use a double quote (")?', + 'Unexpected single quote character (\'), did you mean to use a double quote (")?', { line: 1, column: 1 }, ); diff --git a/src/language/lexer.js b/src/language/lexer.js index aee0e73cd9..11e74180e3 100644 --- a/src/language/lexer.js +++ b/src/language/lexer.js @@ -364,10 +364,7 @@ function unexpectedCharacterMessage(code) { if (code === 39) { // ' - return ( - "Unexpected single quote character ('), did you mean to use " + - 'a double quote (")?' - ); + return 'Unexpected single quote character (\'), did you mean to use a double quote (")?'; } return `Cannot parse the unexpected character ${printCharCode(code)}.`; diff --git a/src/type/__tests__/introspection-test.js b/src/type/__tests__/introspection-test.js index 0405f59749..6f03b891f4 100644 --- a/src/type/__tests__/introspection-test.js +++ b/src/type/__tests__/introspection-test.js @@ -1291,10 +1291,7 @@ describe('Introspection', () => { schemaType: { name: '__Schema', description: - 'A GraphQL Schema defines the capabilities of a ' + - 'GraphQL server. It exposes all available types and ' + - 'directives on the server, as well as the entry ' + - 'points for query, mutation, and subscription operations.', + 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', fields: [ { name: 'types', diff --git a/src/type/definition.js b/src/type/definition.js index 6eab19ce00..06f7f35ebf 100644 --- a/src/type/definition.js +++ b/src/type/definition.js @@ -567,8 +567,7 @@ export class GraphQLScalarType { invariant( typeof config.serialize === 'function', `${this.name} must provide "serialize" function. If this custom Scalar ` + - 'is also used as an input type, ensure "parseValue" and "parseLiteral" ' + - 'functions are also provided.', + 'is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.', ); if (config.parseValue || config.parseLiteral) { invariant( diff --git a/src/type/directives.js b/src/type/directives.js index c15f0fea39..02c6859430 100644 --- a/src/type/directives.js +++ b/src/type/directives.js @@ -118,8 +118,7 @@ export type GraphQLDirectiveConfig = {| export const GraphQLIncludeDirective = new GraphQLDirective({ name: 'include', description: - 'Directs the executor to include this field or fragment only when ' + - 'the `if` argument is true.', + 'Directs the executor to include this field or fragment only when the `if` argument is true.', locations: [ DirectiveLocation.FIELD, DirectiveLocation.FRAGMENT_SPREAD, @@ -139,8 +138,7 @@ export const GraphQLIncludeDirective = new GraphQLDirective({ export const GraphQLSkipDirective = new GraphQLDirective({ name: 'skip', description: - 'Directs the executor to skip this field or fragment when the `if` ' + - 'argument is true.', + 'Directs the executor to skip this field or fragment when the `if` argument is true.', locations: [ DirectiveLocation.FIELD, DirectiveLocation.FRAGMENT_SPREAD, @@ -170,9 +168,7 @@ export const GraphQLDeprecatedDirective = new GraphQLDirective({ reason: { type: GraphQLString, description: - 'Explains why this element was deprecated, usually also including a ' + - 'suggestion for how to access supported similar data. Formatted using ' + - 'the Markdown syntax (as specified by [CommonMark](https://commonmark.org/).', + 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax (as specified by [CommonMark](https://commonmark.org/).', defaultValue: DEFAULT_DEPRECATION_REASON, }, }, diff --git a/src/type/introspection.js b/src/type/introspection.js index f1b4b53fa0..7db1b23711 100644 --- a/src/type/introspection.js +++ b/src/type/introspection.js @@ -34,9 +34,7 @@ import { DirectiveLocation } from '../language/directiveLocation'; export const __Schema = new GraphQLObjectType({ name: '__Schema', description: - 'A GraphQL Schema defines the capabilities of a GraphQL server. It ' + - 'exposes all available types and directives on the server, as well as ' + - 'the entry points for query, mutation, and subscription operations.', + 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', fields: () => ({ types: { description: 'A list of all types supported by this server.', @@ -52,15 +50,13 @@ export const __Schema = new GraphQLObjectType({ }, mutationType: { description: - 'If this server supports mutation, the type that ' + - 'mutation operations will be rooted at.', + 'If this server supports mutation, the type that mutation operations will be rooted at.', type: __Type, resolve: schema => schema.getMutationType(), }, subscriptionType: { description: - 'If this server support subscription, the type that ' + - 'subscription operations will be rooted at.', + 'If this server support subscription, the type that subscription operations will be rooted at.', type: __Type, resolve: schema => schema.getSubscriptionType(), }, @@ -75,12 +71,7 @@ export const __Schema = new GraphQLObjectType({ export const __Directive = new GraphQLObjectType({ name: '__Directive', description: - 'A Directive provides a way to describe alternate runtime execution and ' + - 'type validation behavior in a GraphQL document.' + - "\n\nIn some cases, you need to provide options to alter GraphQL's " + - 'execution behavior in ways field arguments will not suffice, such as ' + - 'conditionally including or skipping a field. Directives provide this by ' + - 'describing additional information to the executor.', + "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", fields: () => ({ name: { type: GraphQLNonNull(GraphQLString), @@ -104,8 +95,7 @@ export const __Directive = new GraphQLObjectType({ export const __DirectiveLocation = new GraphQLEnumType({ name: '__DirectiveLocation', description: - 'A Directive can be adjacent to many parts of the GraphQL language, a ' + - '__DirectiveLocation describes one such possible adjacencies.', + 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.', values: { QUERY: { value: DirectiveLocation.QUERY, @@ -189,14 +179,7 @@ export const __DirectiveLocation = new GraphQLEnumType({ export const __Type = new GraphQLObjectType({ name: '__Type', description: - 'The fundamental unit of any GraphQL Schema is the type. There are ' + - 'many kinds of types in GraphQL as represented by the `__TypeKind` enum.' + - '\n\nDepending on the kind of a type, certain fields describe ' + - 'information about that type. Scalar types provide no information ' + - 'beyond a name and description, while Enum types provide their values. ' + - 'Object and Interface types provide the fields they describe. Abstract ' + - 'types, Union and Interface, provide the Object types possible ' + - 'at runtime. List and NonNull types compose other types.', + 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.', fields: () => ({ kind: { type: GraphQLNonNull(__TypeKind), @@ -297,8 +280,7 @@ export const __Type = new GraphQLObjectType({ export const __Field = new GraphQLObjectType({ name: '__Field', description: - 'Object and Interface types are described by a list of Fields, each of ' + - 'which has a name, potentially a list of arguments, and a return type.', + 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.', fields: () => ({ name: { type: GraphQLNonNull(GraphQLString), @@ -330,9 +312,7 @@ export const __Field = new GraphQLObjectType({ export const __InputValue = new GraphQLObjectType({ name: '__InputValue', description: - 'Arguments provided to Fields or Directives and the input fields of an ' + - 'InputObject are represented as Input Values which describe their type ' + - 'and optionally a default value.', + 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.', fields: () => ({ name: { type: GraphQLNonNull(GraphQLString), @@ -349,8 +329,7 @@ export const __InputValue = new GraphQLObjectType({ defaultValue: { type: GraphQLString, description: - 'A GraphQL-formatted string representing the default value for this ' + - 'input value.', + 'A GraphQL-formatted string representing the default value for this input value.', resolve(inputVal) { const valueAST = astFromValue(inputVal.defaultValue, inputVal.type); return valueAST ? print(valueAST) : null; @@ -362,9 +341,7 @@ export const __InputValue = new GraphQLObjectType({ export const __EnumValue = new GraphQLObjectType({ name: '__EnumValue', description: - 'One possible value for a given Enum. Enum values are unique values, not ' + - 'a placeholder for a string or numeric value. However an Enum value is ' + - 'returned in a JSON response as a string.', + 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.', fields: () => ({ name: { type: GraphQLNonNull(GraphQLString), @@ -407,14 +384,12 @@ export const __TypeKind = new GraphQLEnumType({ OBJECT: { value: TypeKind.OBJECT, description: - 'Indicates this type is an object. ' + - '`fields` and `interfaces` are valid fields.', + 'Indicates this type is an object. `fields` and `interfaces` are valid fields.', }, INTERFACE: { value: TypeKind.INTERFACE, description: - 'Indicates this type is an interface. ' + - '`fields` and `possibleTypes` are valid fields.', + 'Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.', }, UNION: { value: TypeKind.UNION, @@ -429,8 +404,7 @@ export const __TypeKind = new GraphQLEnumType({ INPUT_OBJECT: { value: TypeKind.INPUT_OBJECT, description: - 'Indicates this type is an input object. ' + - '`inputFields` is a valid field.', + 'Indicates this type is an input object. `inputFields` is a valid field.', }, LIST: { value: TypeKind.LIST, diff --git a/src/type/scalars.js b/src/type/scalars.js index 6d72219894..5c50426527 100644 --- a/src/type/scalars.js +++ b/src/type/scalars.js @@ -61,8 +61,7 @@ function coerceInt(value: mixed): number { export const GraphQLInt = new GraphQLScalarType({ name: 'Int', description: - 'The `Int` scalar type represents non-fractional signed whole numeric ' + - 'values. Int can represent values between -(2^31) and 2^31 - 1.', + 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.', serialize: serializeInt, parseValue: coerceInt, parseLiteral(ast) { @@ -105,9 +104,7 @@ function coerceFloat(value: mixed): number { export const GraphQLFloat = new GraphQLScalarType({ name: 'Float', description: - 'The `Float` scalar type represents signed double-precision fractional ' + - 'values as specified by ' + - '[IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', + 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', serialize: serializeFloat, parseValue: coerceFloat, parseLiteral(ast) { @@ -165,9 +162,7 @@ function coerceString(value: mixed): string { export const GraphQLString = new GraphQLScalarType({ name: 'String', description: - 'The `String` scalar type represents textual data, represented as UTF-8 ' + - 'character sequences. The String type is most often used by GraphQL to ' + - 'represent free-form human-readable text.', + 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', serialize: serializeString, parseValue: coerceString, parseLiteral(ast) { @@ -231,11 +226,7 @@ function coerceID(value: mixed): string { export const GraphQLID = new GraphQLScalarType({ name: 'ID', description: - 'The `ID` scalar type represents a unique identifier, often used to ' + - 'refetch an object or as key for a cache. The ID type appears in a JSON ' + - 'response as a String; however, it is not intended to be human-readable. ' + - 'When expected as an input type, any string (such as `"4"`) or integer ' + - '(such as `4`) input value will be accepted as an ID.', + 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', serialize: serializeID, parseValue: coerceID, parseLiteral(ast) { diff --git a/src/utilities/buildClientSchema.js b/src/utilities/buildClientSchema.js index acad5033d3..e86cc90d32 100644 --- a/src/utilities/buildClientSchema.js +++ b/src/utilities/buildClientSchema.js @@ -154,8 +154,7 @@ export function buildClientSchema( if (!type) { throw new Error( `Invalid or incomplete schema, unknown type: ${typeName}. Ensure ` + - 'that a full introspection query is used in order to build a ' + - 'client schema.', + 'that a full introspection query is used in order to build a client schema.', ); } @@ -220,8 +219,7 @@ export function buildClientSchema( } } throw new Error( - 'Invalid or incomplete introspection result. Ensure that a full ' + - 'introspection query is used in order to build a client schema:' + + 'Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema:' + inspect(type), ); }