From 62510b2bbe514dca93ae3b081f43f1cb56fef984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20F=2E=20Fern=C3=A1ndez?= Date: Thu, 20 Apr 2023 09:01:27 +0200 Subject: [PATCH] fix(jsonschema): change type to integer in json schema for int backed enums (#5553) --- src/JsonSchema/TypeFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JsonSchema/TypeFactory.php b/src/JsonSchema/TypeFactory.php index 608e349d400..66d6cc37fb7 100644 --- a/src/JsonSchema/TypeFactory.php +++ b/src/JsonSchema/TypeFactory.php @@ -119,7 +119,7 @@ private function getClassType(?string $className, bool $nullable, string $format if (!$this->isResourceClass($className) && is_a($className, \BackedEnum::class, true)) { $enumCases = array_map(static fn (\BackedEnum $enum): string|int => $enum->value, $className::cases()); - $type = \is_string($enumCases[0] ?? '') ? 'string' : 'int'; + $type = \is_string($enumCases[0] ?? '') ? 'string' : 'integer'; if ($nullable) { $enumCases[] = null;