diff --git a/features/openapi/docs.feature b/features/openapi/docs.feature index 18f09998c8b..ae109da6012 100644 --- a/features/openapi/docs.feature +++ b/features/openapi/docs.feature @@ -238,7 +238,8 @@ Feature: Documentation support "type": "string" }, "property": { - "type": ["string", "null"] + "type": "string", + "nullable": true }, "required": { "type": "boolean" diff --git a/src/Hydra/JsonSchema/SchemaFactory.php b/src/Hydra/JsonSchema/SchemaFactory.php index 540834d92f5..30c41e01f30 100644 --- a/src/Hydra/JsonSchema/SchemaFactory.php +++ b/src/Hydra/JsonSchema/SchemaFactory.php @@ -92,12 +92,12 @@ public function buildSchema(string $className, string $format = 'jsonld', string unset($schema['items']); switch ($schema->getVersion()) { - // JSON Schema + OpenAPI 3.1 case Schema::VERSION_OPENAPI: + $nullableStringDefinition = ['type' => 'string', 'nullable' => true]; + break; case Schema::VERSION_JSON_SCHEMA: $nullableStringDefinition = ['type' => ['string', 'null']]; break; - // Swagger default: $nullableStringDefinition = ['type' => 'string']; break;