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 */