mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-22 12:56:05 +03:00
Allow custom attributes in type definitions for user-land metadata
This commit is contained in:
parent
2d54f654c2
commit
5f2b2376e0
@ -80,7 +80,10 @@ class Config
|
|||||||
|
|
||||||
// Make sure there are no unexpected keys in map
|
// Make sure there are no unexpected keys in map
|
||||||
$unexpectedKeys = array_keys(array_diff_key($map, $definitions));
|
$unexpectedKeys = array_keys(array_diff_key($map, $definitions));
|
||||||
Utils::invariant(empty($unexpectedKeys), 'Error in "'.$typeName.'" type definition: Unexpected keys "%s" ' . $suffix, implode(', ', $unexpectedKeys));
|
if (!empty($unexpectedKeys)) {
|
||||||
|
trigger_error(sprintf('"%s" type definition: Unexpected keys "%s" ' . $suffix, $typeName, implode(', ', $unexpectedKeys)));
|
||||||
|
$map = array_intersect_key($map, $definitions);
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure that all required keys are present in map
|
// Make sure that all required keys are present in map
|
||||||
$requiredKeys = array_filter($definitions, function($def) {return (self::_getFlags($def) & self::REQUIRED) > 0;});
|
$requiredKeys = array_filter($definitions, function($def) {return (self::_getFlags($def) & self::REQUIRED) > 0;});
|
||||||
|
Loading…
Reference in New Issue
Block a user