Skip to content

Commit

Permalink
add ‘GraphQL’ prefix to input object types (#526)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
calebmer authored and leebyron committed Oct 28, 2016
1 parent 5629337 commit 9ea8223
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/type/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -890,22 +890,22 @@ 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;
this.description = config.description;
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),
Expand Down Expand Up @@ -940,31 +940,31 @@ export class GraphQLInputObjectType {
}
}

export type InputObjectConfig = {
export type GraphQLInputObjectTypeConfig = {
name: string;
fields: Thunk<InputObjectConfigFieldMap>;
fields: Thunk<GraphQLInputFieldConfigMap>;
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;
};


Expand Down

0 comments on commit 9ea8223

Please sign in to comment.