From 9ea8223c01f1c64a8dfb72315a415bbc3e78cc39 Mon Sep 17 00:00:00 2001 From: Caleb Meredith Date: Thu, 27 Oct 2016 22:58:48 -0400 Subject: [PATCH] =?UTF-8?q?add=20=E2=80=98GraphQL=E2=80=99=20prefix=20to?= =?UTF-8?q?=20input=20object=20types=20(#526)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add ‘GraphQL’ prefix to input object types Types with names like `InputObjectConfig` are inconsistent with all other type names. This makes the types awkward to import and use. This may be considered a breaking change (although I’d venture to believe very few people if any are importing this specific file to get at the types). If you’d like to mitigate breakage we could re-export aliases like so: ```js export type InputObjectConfig = GraphQLInputObjectConfig ``` * Update definition.js * Update definition.js --- src/type/definition.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/type/definition.js b/src/type/definition.js index 2be3f3844b..dd62e7133a 100644 --- a/src/type/definition.js +++ b/src/type/definition.js @@ -890,10 +890,10 @@ export class GraphQLInputObjectType { name: string; description: ?string; - _typeConfig: InputObjectConfig; - _fields: InputObjectFieldMap; + _typeConfig: GraphQLInputObjectTypeConfig; + _fields: GraphQLInputFieldDefinitionMap; - constructor(config: InputObjectConfig) { + constructor(config: GraphQLInputObjectTypeConfig) { invariant(config.name, 'Type must be named.'); assertValidName(config.name); this.name = config.name; @@ -901,11 +901,11 @@ export class GraphQLInputObjectType { this._typeConfig = config; } - getFields(): InputObjectFieldMap { + getFields(): GraphQLInputFieldDefinitionMap { return this._fields || (this._fields = this._defineFieldMap()); } - _defineFieldMap(): InputObjectFieldMap { + _defineFieldMap(): GraphQLInputFieldDefinitionMap { const fieldMap: any = resolveThunk(this._typeConfig.fields); invariant( isPlainObj(fieldMap), @@ -940,31 +940,31 @@ export class GraphQLInputObjectType { } } -export type InputObjectConfig = { +export type GraphQLInputObjectTypeConfig = { name: string; - fields: Thunk; + fields: Thunk; description?: ?string; }; -export type InputObjectFieldConfig = { +export type GraphQLInputFieldConfig = { type: GraphQLInputType; defaultValue?: mixed; description?: ?string; }; -export type InputObjectConfigFieldMap = { - [fieldName: string]: InputObjectFieldConfig; +export type GraphQLInputFieldConfigMap = { + [fieldName: string]: GraphQLInputFieldConfig; }; -export type InputObjectField = { +export type GraphQLInputFieldDefinition = { name: string; type: GraphQLInputType; defaultValue?: mixed; description?: ?string; }; -export type InputObjectFieldMap = { - [fieldName: string]: InputObjectField; +export type GraphQLInputFieldDefinitionMap = { + [fieldName: string]: GraphQLInputFieldDefinition; };