Skip to content

Commit 4e4c602

Browse files
committed
Merge branch '4.1' into main
Resolve merge conflict in tests/Functional/ValidationTest.php by combining test cases.
2 parents c814250 + 1d1c6ea commit 4e4c602

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

SchemaFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,11 @@ private function buildLegacyPropertySchema(Schema $schema, string $definitionNam
246246
$subDefinitionName = $this->definitionNameFactory->create($className, $format, $className, null, $serializerContext);
247247

248248
if (isset($subSchema->getDefinitions()[$subDefinitionName])) {
249-
unset($subSchema->getDefinitions()[$subDefinitionName]['properties']['@id']);
249+
// @see https://github.com/api-platform/core/issues/7162
250+
// Need to rebuild the definition without @id property and set it back to the sub-schema
251+
$subSchemaDefinition = $subSchema->getDefinitions()[$subDefinitionName]->getArrayCopy();
252+
unset($subSchemaDefinition['properties']['@id']);
253+
$subSchema->getDefinitions()[$subDefinitionName] = new \ArrayObject($subSchemaDefinition);
250254
}
251255
}
252256

0 commit comments

Comments
 (0)