Skip to content

Commit 6da5d03

Browse files
authored
fix: allow empty properties for object (#680)
1 parent b136659 commit 6da5d03

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/PHPDraft/Out/OpenAPI/OpenApiRenderer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private function toOperation(HTTPRequest $request, Transition $transition, array
175175
'name' => $name,
176176
'in' => 'header',
177177
'schema' => ['type' => 'string'],
178-
'example' => $value
178+
'example' => $value,
179179
];
180180
}
181181

@@ -371,7 +371,7 @@ private function getComponents(): object
371371
"type" => "apiKey",
372372
"name" => $this->base_data['API_KEY_HEADER'],
373373
"in" => "header",
374-
]
374+
],
375375
];
376376
}
377377

@@ -475,7 +475,7 @@ private function getSchemaProperty(BasicStructureElement|ElementStructureElement
475475
return $propery_data;
476476
} elseif ($value->type === 'object') {
477477
$propery_data['type'] = $value->type;
478-
$propery_data['properties'] = $this->getComponent($value->value)['properties'];
478+
$propery_data['properties'] = $this->getComponent($value->value)['properties'] ?? new class{};
479479

480480
return $propery_data;
481481
}

0 commit comments

Comments
 (0)