diff --git a/src/JsonSchema/TypeFactory.php b/src/JsonSchema/TypeFactory.php index b2595ee6ff0..02e61098f79 100644 --- a/src/JsonSchema/TypeFactory.php +++ b/src/JsonSchema/TypeFactory.php @@ -127,6 +127,13 @@ private function getClassType(?string $className, string $format, ?bool $readabl ]; } + if (is_a($className, \BackedEnum::class, true)) { + return [ + 'type' => 'string', + 'format' => 'enum', + ]; + } + // Skip if $schema is null (filters only support basic types) if (null === $schema) { return ['type' => 'string'];