Skip to content

Commit 9ea8223

Browse files
calebmerleebyron
authored andcommitted
add ‘GraphQL’ prefix to input object types (#526)
* 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
1 parent 5629337 commit 9ea8223

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/type/definition.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -890,22 +890,22 @@ export class GraphQLInputObjectType {
890890
name: string;
891891
description: ?string;
892892

893-
_typeConfig: InputObjectConfig;
894-
_fields: InputObjectFieldMap;
893+
_typeConfig: GraphQLInputObjectTypeConfig;
894+
_fields: GraphQLInputFieldDefinitionMap;
895895

896-
constructor(config: InputObjectConfig) {
896+
constructor(config: GraphQLInputObjectTypeConfig) {
897897
invariant(config.name, 'Type must be named.');
898898
assertValidName(config.name);
899899
this.name = config.name;
900900
this.description = config.description;
901901
this._typeConfig = config;
902902
}
903903

904-
getFields(): InputObjectFieldMap {
904+
getFields(): GraphQLInputFieldDefinitionMap {
905905
return this._fields || (this._fields = this._defineFieldMap());
906906
}
907907

908-
_defineFieldMap(): InputObjectFieldMap {
908+
_defineFieldMap(): GraphQLInputFieldDefinitionMap {
909909
const fieldMap: any = resolveThunk(this._typeConfig.fields);
910910
invariant(
911911
isPlainObj(fieldMap),
@@ -940,31 +940,31 @@ export class GraphQLInputObjectType {
940940
}
941941
}
942942

943-
export type InputObjectConfig = {
943+
export type GraphQLInputObjectTypeConfig = {
944944
name: string;
945-
fields: Thunk<InputObjectConfigFieldMap>;
945+
fields: Thunk<GraphQLInputFieldConfigMap>;
946946
description?: ?string;
947947
};
948948

949-
export type InputObjectFieldConfig = {
949+
export type GraphQLInputFieldConfig = {
950950
type: GraphQLInputType;
951951
defaultValue?: mixed;
952952
description?: ?string;
953953
};
954954

955-
export type InputObjectConfigFieldMap = {
956-
[fieldName: string]: InputObjectFieldConfig;
955+
export type GraphQLInputFieldConfigMap = {
956+
[fieldName: string]: GraphQLInputFieldConfig;
957957
};
958958

959-
export type InputObjectField = {
959+
export type GraphQLInputFieldDefinition = {
960960
name: string;
961961
type: GraphQLInputType;
962962
defaultValue?: mixed;
963963
description?: ?string;
964964
};
965965

966-
export type InputObjectFieldMap = {
967-
[fieldName: string]: InputObjectField;
966+
export type GraphQLInputFieldDefinitionMap = {
967+
[fieldName: string]: GraphQLInputFieldDefinition;
968968
};
969969

970970

0 commit comments

Comments
 (0)