From 0e221ff273ea7be4e110993c019be43372d84c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 30 Oct 2017 14:50:27 +0100 Subject: [PATCH] Include swagger context even when type is null I do not know when the type is supposed to be null, but I am using the YamlExtractor and it always seems to be the case with that metadata specification method. --- src/Swagger/Serializer/DocumentationNormalizer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Swagger/Serializer/DocumentationNormalizer.php b/src/Swagger/Serializer/DocumentationNormalizer.php index b69c0cd5983..7c9ff4daff9 100644 --- a/src/Swagger/Serializer/DocumentationNormalizer.php +++ b/src/Swagger/Serializer/DocumentationNormalizer.php @@ -508,7 +508,7 @@ private function getDefinitionSchema(string $resourceClass, ResourceMetadata $re */ private function getPropertySchema(PropertyMetadata $propertyMetadata, \ArrayObject $definitions, array $serializerContext = null): \ArrayObject { - $propertySchema = new \ArrayObject(); + $propertySchema = new \ArrayObject($propertyMetadata->getAttributes()['swagger_context'] ?? []); if (false === $propertyMetadata->isWritable()) { $propertySchema['readOnly'] = true; @@ -533,7 +533,7 @@ private function getPropertySchema(PropertyMetadata $propertyMetadata, \ArrayObj $valueSchema = $this->getType($builtinType, $isCollection, $className, $propertyMetadata->isReadableLink(), $definitions, $serializerContext); - return new \ArrayObject((array) $propertySchema + $valueSchema + ($propertyMetadata->getAttributes()['swagger_context'] ?? [])); + return new \ArrayObject((array) $propertySchema + $valueSchema); } /**