Skip to content

Commit c017759

Browse files
committed
Fix bug in XML attribute annotation generation
1 parent b2b8564 commit c017759

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

Annotations/AnnotationGenerator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,10 @@ protected function removeTempOaXmlAttributeProperty(array &$decodedExampleValue)
13861386
foreach ($decodedExampleValue as $key => &$value) {
13871387
if ($key === OpenApiDocs::OA_XML_ATTRIBUTES_TEMP_PROPERTY_NAME) {
13881388
unset($decodedExampleValue[$key]);
1389+
// Add the attributes as actual properties so that they are visible in the example
1390+
foreach ($value as $attributeName => $attributeValue) {
1391+
$decodedExampleValue[$attributeName] = $attributeValue;
1392+
}
13891393
continue;
13901394
}
13911395

@@ -1437,7 +1441,7 @@ public function buildPropertyAnnotationFromXmlExample(string $propName, array $v
14371441
// Special handling for XML attributes
14381442
if ($key === OpenApiDocs::OA_XML_ATTRIBUTES_TEMP_PROPERTY_NAME) {
14391443
$hasAttributes = true;
1440-
$childLines[] = $this->buildXmlAttributeSchemaLines($value);
1444+
$childLines = array_merge($childLines, $this->buildXmlAttributeSchemaLines($value));
14411445
continue;
14421446
}
14431447

0 commit comments

Comments
 (0)