mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
Merge fixes
This commit is contained in:
commit
b5fb133533
@ -36,11 +36,8 @@ class PhpdocPropertyAnnotationReader
|
||||
|
||||
/**
|
||||
* Update the Swagger information with information from the DocBlock comment.
|
||||
*
|
||||
* @param \ReflectionProperty $reflectionProperty
|
||||
* @param Items|Schema $property
|
||||
*/
|
||||
public function updateWithPhpdoc(\ReflectionProperty $reflectionProperty, $property)
|
||||
public function updateWithPhpdoc(\ReflectionProperty $reflectionProperty, Schema $property)
|
||||
{
|
||||
try {
|
||||
$docBlock = $this->docBlockFactory->create($reflectionProperty);
|
||||
|
@ -29,37 +29,33 @@ class SwaggerPropertyAnnotationReader
|
||||
$this->annotationsReader = $annotationsReader;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \ReflectionProperty $reflectionProperty
|
||||
* @param Items|Schema $property
|
||||
*/
|
||||
public function updateWithSwaggerPropertyAnnotation(\ReflectionProperty $reflectionProperty, $property)
|
||||
public function updateWithSwaggerPropertyAnnotation(\ReflectionProperty $reflectionProperty, Schema $property)
|
||||
{
|
||||
$swgProperty = $this->annotationsReader->getPropertyAnnotation($reflectionProperty, SwgProperty::class);
|
||||
if ($swgProperty instanceof SwgProperty) {
|
||||
if (null !== $swgProperty->type) {
|
||||
$property->setType($swgProperty->type);
|
||||
}
|
||||
if (UNDEFINED !== $swgProperty->default) {
|
||||
$property->setDefault($swgProperty->default);
|
||||
}
|
||||
if (null !== $swgProperty->enum) {
|
||||
$property->setEnum($swgProperty->enum);
|
||||
}
|
||||
if ($property instanceof Schema) {
|
||||
if (null !== $swgProperty->description) {
|
||||
$property->setDescription($swgProperty->description);
|
||||
}
|
||||
if (null !== $swgProperty->title) {
|
||||
$property->setTitle($swgProperty->title);
|
||||
}
|
||||
if (null !== $swgProperty->example) {
|
||||
$property->setExample($swgProperty->example);
|
||||
}
|
||||
if (null !== $swgProperty->readOnly) {
|
||||
$property->setReadOnly($swgProperty->readOnly);
|
||||
}
|
||||
}
|
||||
if (!$swgProperty = $this->annotationsReader->getPropertyAnnotation($reflectionProperty, SwgProperty::class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (null !== $swgProperty->type) {
|
||||
$property->setType($swgProperty->type);
|
||||
}
|
||||
if (UNDEFINED !== $swgProperty->default) {
|
||||
$property->setDefault($swgProperty->default);
|
||||
}
|
||||
if (null !== $swgProperty->enum) {
|
||||
$property->setEnum($swgProperty->enum);
|
||||
}
|
||||
|
||||
if (null !== $swgProperty->description) {
|
||||
$property->setDescription($swgProperty->description);
|
||||
}
|
||||
if (null !== $swgProperty->title) {
|
||||
$property->setTitle($swgProperty->title);
|
||||
}
|
||||
if (null !== $swgProperty->example) {
|
||||
$property->setExample($swgProperty->example);
|
||||
}
|
||||
if (null !== $swgProperty->readOnly) {
|
||||
$property->setReadOnly($swgProperty->readOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user