MCPcopy
hub / github.com/graphql/graphql-js / constructor

Method constructor

src/type/definition.ts:5213–5234  ·  view source on GitHub ↗

* Creates a resolved GraphQL input field definition. * @param parentType - Input object type that owns this field. * @param name - Input field name. * @param config - Input field configuration. * @example * ```ts * import { * GraphQLInputField, * GraphQLInputObjectType,

(
    parentType: GraphQLInputObjectType,
    name: string,
    config: GraphQLInputFieldConfig,
  )

Source from the content-addressed store, hash-verified

5211 * ```
5212 */
5213 constructor(
5214 parentType: GraphQLInputObjectType,
5215 name: string,
5216 config: GraphQLInputFieldConfig,
5217 ) {
5218 devAssert(
5219 !('resolve' in config),
5220 `${parentType}.${name} field has a resolve property, but Input Types cannot define resolvers.`,
5221 );
5222
5223 this.__kind = inputFieldSymbol;
5224 this.parentType = parentType;
5225 this.name = assertName(name);
5226 this.description = config.description;
5227 this.type = config.type;
5228 this.defaultValue = config.defaultValue;
5229 this.default = config.default;
5230 this._memoizedCoercedDefaultValue = undefined;
5231 this.deprecationReason = config.deprecationReason;
5232 this.extensions = toObjMapWithSymbols(config.extensions);
5233 this.astNode = config.astNode;
5234 }
5235
5236 /**
5237 * Returns the value used by `Object.prototype.toString`.

Callers

nothing calls this directly

Calls 3

devAssertFunction · 0.90
assertNameFunction · 0.90
toObjMapWithSymbolsFunction · 0.90

Tested by

no test coverage detected