From 7c198c88884be4753c3558a59aa8dbbd967f98d9 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 17 Dec 2024 14:13:26 +0100 Subject: [PATCH] feat(OpenApiType): Warn about non-required nullable properties Signed-off-by: provokateurin --- src/OpenApiType.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/OpenApiType.php b/src/OpenApiType.php index 63ce147..b1a3ff8 100644 --- a/src/OpenApiType.php +++ b/src/OpenApiType.php @@ -210,6 +210,8 @@ public static function resolve(string $context, array $definitions, ParamTagValu $properties[$name] = $type; if (!$item->optional) { $required[] = $name; + } elseif ($type->nullable) { + Logger::warning($context, 'Property "' . $name . '" is both nullable and not required. Please consider only using one of these at once.'); } } return new OpenApiType(