Skip to content

Commit a92bab9

Browse files
aaa2000soyuka
authored andcommitted
Fix rebase
1 parent f3ddc2c commit a92bab9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/JsonSchema/SchemaFactory.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,18 @@ private function buildPropertySchema(Schema $schema, string $definitionName, str
176176
$propertySchema['externalDocs'] = ['url' => $iri];
177177
}
178178

179+
if (!isset($propertySchema['default']) && null !== $default = $propertyMetadata->getDefault()) {
180+
$propertySchema['default'] = $default;
181+
}
182+
183+
if (!isset($propertySchema['example']) && null !== $example = $propertyMetadata->getExample()) {
184+
$propertySchema['example'] = $example;
185+
}
186+
187+
if (!isset($propertySchema['example']) && isset($propertySchema['default'])) {
188+
$propertySchema['example'] = $propertySchema['default'];
189+
}
190+
179191
$valueSchema = [];
180192
if (null !== $type = $propertyMetadata->getType()) {
181193
$isCollection = $type->isCollection();

0 commit comments

Comments
 (0)