diff --git a/src/Generator/TypeResolver.php b/src/Generator/TypeResolver.php index ca96722..fd5efd2 100644 --- a/src/Generator/TypeResolver.php +++ b/src/Generator/TypeResolver.php @@ -64,7 +64,12 @@ public function resolve( return Types::Enum; } - $type = match ($schema->type) { + $schemaType = $schema->type; + if (is_array($schema->type) && count($schema->type) == 2 && in_array("null", $schema->type)) { + $schemaType = current( array_filter($schema->type, fn (string $type) => $type !== 'null')); + } + + $type = match ($schemaType) { 'number' => match ($schema->format) { 'double', 'float' => 'float', default => 'int'