Saving original field config with field definition to allow custom app-level definitions

This commit is contained in:
vladar 2015-08-30 13:46:20 +06:00
parent c6a9712790
commit 9ccfb93ef2

View File

@ -25,11 +25,7 @@ class FieldDefinition
/** /**
* source?: any, * source?: any,
* args?: ?{[argName: string]: any}, * args?: ?{[argName: string]: any},
* context?: any, * info
* fieldAST?: any,
* fieldType?: any,
* parentType?: any,
* schema?: GraphQLSchema
* *
* @var callable * @var callable
*/ */
@ -45,6 +41,13 @@ class FieldDefinition
*/ */
public $deprecationReason; public $deprecationReason;
/**
* Original field definition config
*
* @var array
*/
public $config;
private static $def; private static $def;
public static function getDefinition() public static function getDefinition()
@ -55,6 +58,7 @@ class FieldDefinition
'args' => Config::arrayOf([ 'args' => Config::arrayOf([
'name' => Config::STRING | Config::REQUIRED, 'name' => Config::STRING | Config::REQUIRED,
'type' => Config::INPUT_TYPE | Config::REQUIRED, 'type' => Config::INPUT_TYPE | Config::REQUIRED,
'description' => Config::STRING,
'defaultValue' => Config::ANY 'defaultValue' => Config::ANY
], Config::KEY_AS_NAME), ], Config::KEY_AS_NAME),
'resolve' => Config::CALLBACK, 'resolve' => Config::CALLBACK,
@ -98,6 +102,8 @@ class FieldDefinition
$this->description = isset($config['description']) ? $config['description'] : null; $this->description = isset($config['description']) ? $config['description'] : null;
$this->deprecationReason = isset($config['deprecationReason']) ? $config['deprecationReason'] : null; $this->deprecationReason = isset($config['deprecationReason']) ? $config['deprecationReason'] : null;
$this->config = $config;
} }
/** /**