Skip to content

Commit 5f2b237

Browse files
committed
Allow custom attributes in type definitions for user-land metadata
1 parent 2d54f65 commit 5f2b237

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Type/Definition/Config.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ private static function _validateMap($typeName, array $map, array $definitions,
8080

8181
// Make sure there are no unexpected keys in map
8282
$unexpectedKeys = array_keys(array_diff_key($map, $definitions));
83-
Utils::invariant(empty($unexpectedKeys), 'Error in "'.$typeName.'" type definition: Unexpected keys "%s" ' . $suffix, implode(', ', $unexpectedKeys));
83+
if (!empty($unexpectedKeys)) {
84+
trigger_error(sprintf('"%s" type definition: Unexpected keys "%s" ' . $suffix, $typeName, implode(', ', $unexpectedKeys)));
85+
$map = array_intersect_key($map, $definitions);
86+
}
8487

8588
// Make sure that all required keys are present in map
8689
$requiredKeys = array_filter($definitions, function($def) {return (self::_getFlags($def) & self::REQUIRED) > 0;});

0 commit comments

Comments
 (0)