Skip to content

Commit

Permalink
Merge a1b21b1 into d4d6377
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryPEGEOT committed Dec 3, 2020
2 parents d4d6377 + a1b21b1 commit 728ba73
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Hydra/JsonSchema/SchemaFactory.php
Expand Up @@ -74,6 +74,17 @@ public function buildSchema(string $className, string $format = 'jsonld', string
$items = $schema['items'];
unset($schema['items']);

switch ($schema->getVersion()) {
case Schema::VERSION_JSON_SCHEMA:
$mappingPropDefinition = ['type' => ['string', 'null']];
break;
case Schema::VERSION_OPENAPI:
$mappingPropDefinition = ['type' => 'string', 'nullable' => true];
break;
default:
$mappingPropDefinition = ['type' => 'string'];
}

$schema['type'] = 'object';
$schema['properties'] = [
'hydra:member' => [
Expand Down Expand Up @@ -121,7 +132,7 @@ public function buildSchema(string $className, string $format = 'jsonld', string
'properties' => [
'@type' => ['type' => 'string'],
'variable' => ['type' => 'string'],
'property' => ['type' => 'string'],
'property' => $mappingPropDefinition,
'required' => ['type' => 'boolean'],
],
],
Expand Down

0 comments on commit 728ba73

Please sign in to comment.