diff --git a/src/Model/SchemaDefinition/JsonSchema.php b/src/Model/SchemaDefinition/JsonSchema.php index adfe9cd..df0cf22 100644 --- a/src/Model/SchemaDefinition/JsonSchema.php +++ b/src/Model/SchemaDefinition/JsonSchema.php @@ -48,16 +48,18 @@ public function __construct(string $file, array $json) { // wrap in an allOf to pass the processing to multiple handlers - ugly hack to be removed after rework if (isset($json['$ref']) && count(array_diff(array_intersect(array_keys($json), self::SCHEMA_SIGNATURE_RELEVANT_FIELDS), ['$ref', 'type']))) { - $json = [ - ...array_diff_key($json, array_fill_keys(self::SCHEMA_SIGNATURE_RELEVANT_FIELDS, null)), - 'allOf' => [ - ['$ref' => $json['$ref']], - array_intersect_key( - $json, - array_fill_keys(array_diff(self::SCHEMA_SIGNATURE_RELEVANT_FIELDS, ['$ref']), null), - ), + $json = array_merge( + array_diff_key($json, array_fill_keys(self::SCHEMA_SIGNATURE_RELEVANT_FIELDS, null)), + [ + 'allOf' => [ + ['$ref' => $json['$ref']], + array_intersect_key( + $json, + array_fill_keys(array_diff(self::SCHEMA_SIGNATURE_RELEVANT_FIELDS, ['$ref']), null), + ), + ], ], - ]; + ); } $this->json = $json;