Skip to content

Commit b426ffe

Browse files
committed
fix(openapi): invalid hydra type specification
1 parent 73569fc commit b426ffe

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

features/openapi/docs.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ Feature: Documentation support
238238
"type": "string"
239239
},
240240
"property": {
241-
"type": ["string", "null"]
241+
"type": "string",
242+
"nullable": true
242243
},
243244
"required": {
244245
"type": "boolean"

src/Hydra/JsonSchema/SchemaFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ public function buildSchema(string $className, string $format = 'jsonld', string
9292
unset($schema['items']);
9393

9494
switch ($schema->getVersion()) {
95-
// JSON Schema + OpenAPI 3.1
9695
case Schema::VERSION_OPENAPI:
96+
$nullableStringDefinition = ['type' => 'string', 'nullable' => true];
97+
break;
9798
case Schema::VERSION_JSON_SCHEMA:
9899
$nullableStringDefinition = ['type' => ['string', 'null']];
99100
break;
100-
// Swagger
101101
default:
102102
$nullableStringDefinition = ['type' => 'string'];
103103
break;

0 commit comments

Comments
 (0)