Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/OpenApi/Service/RequestBodyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Ouzo\OpenApi\Model\Parameters\RequestBody;
use Ouzo\OpenApi\Util\Type\TypeUtils;
use ReflectionParameter;
use RuntimeException;

class RequestBodyService
{
Expand All @@ -18,6 +19,9 @@ public function __construct(private ContentService $contentService)
public function create(ReflectionParameter $reflectionParameter, string $httpMethod): ?RequestBody
{
$reflectionType = $reflectionParameter->getType();
if(is_null($reflectionType)) {
throw new RuntimeException("Parameter {$reflectionParameter->getName()} is not defined type.");
}

$isObjectAndNotGetHttpMethod = !$reflectionType->isBuiltin() && $httpMethod !== HttpMethod::GET;
if ($isObjectAndNotGetHttpMethod) {
Expand Down