Skip to content

Commit

Permalink
Merge 794d7a6 into c37641b
Browse files Browse the repository at this point in the history
  • Loading branch information
Zowac committed Jan 14, 2021
2 parents c37641b + 794d7a6 commit 618c419
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/JsonSchema/SchemaFactory.php
Expand Up @@ -226,7 +226,11 @@ private function buildPropertySchema(Schema $schema, string $definitionName, str
$valueSchema = $this->typeFactory->getType(new Type($builtinType, $type->isNullable(), $className, $isCollection), $format, $propertyMetadata->isReadableLink(), $serializerContext, $schema);
}

$propertySchema = new \ArrayObject($propertySchema + $valueSchema);
if (\count($propertySchema) > 0 && \array_key_exists('$ref', $valueSchema)) {
$propertySchema = new \ArrayObject($propertySchema);
} else {
$propertySchema = new \ArrayObject($propertySchema + $valueSchema);
}
$schema->getDefinitions()[$definitionName]['properties'][$normalizedPropertyName] = $propertySchema;
}

Expand Down
1 change: 0 additions & 1 deletion tests/Swagger/Serializer/DocumentationNormalizerV2Test.php
Expand Up @@ -2339,7 +2339,6 @@ public function testNormalizeWithNestedNormalizationGroups(): void
]),
'relatedDummy' => new \ArrayObject([
'description' => 'This is a related dummy \o/.',
'$ref' => '#/definitions/'.$relatedDummyRef,
]),
],
]),
Expand Down

0 comments on commit 618c419

Please sign in to comment.