From 5b745cbc071f6c0a23e9b13dc952dc241ed00088 Mon Sep 17 00:00:00 2001 From: Yied Pozi Date: Mon, 15 Jun 2026 13:11:06 +0800 Subject: [PATCH] fix: add nullable value in enum options --- src/Schema/EnumSchema.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Schema/EnumSchema.php b/src/Schema/EnumSchema.php index f97a130a5..f516b2488 100644 --- a/src/Schema/EnumSchema.php +++ b/src/Schema/EnumSchema.php @@ -29,11 +29,25 @@ public function toArray(): array { return [ 'description' => $this->description, - 'enum' => $this->options, + 'enum' => $this->options(), 'type' => $this->types(), ]; } + /** + * @return array + */ + protected function options(): array + { + $options = $this->options; + + if ($this->nullable) { + $options[] = null; + } + + return $options; + } + /** * @return string[]|string */