diff --git a/ModelDescriber/JMSModelDescriber.php b/ModelDescriber/JMSModelDescriber.php index 1c96dde..ec661e8 100644 --- a/ModelDescriber/JMSModelDescriber.php +++ b/ModelDescriber/JMSModelDescriber.php @@ -93,8 +93,20 @@ class JMSModelDescriber implements ModelDescriberInterface, ModelRegistryAwareIn $reflection = new \ReflectionProperty($item->class, $item->name); } - $property = $properties->get($annotationsReader->getPropertyName($reflection, $name)); $groups = $this->computeGroups($context, $item->type); + + if (true === $item->inline && isset($item->type['name'])) { + // currently array types can not be documented :-/ + if (!in_array($item->type['name'], ['array', 'ArrayCollection'], true)) { + $inlineModel = new Model(new Type(Type::BUILTIN_TYPE_OBJECT, false, $item->type['name']), $groups); + $this->describe($inlineModel, $schema); + } + $context->popPropertyMetadata(); + + continue; + } + + $property = $properties->get($annotationsReader->getPropertyName($reflection, $name)); $annotationsReader->updateProperty($reflection, $property, $groups); } catch (\ReflectionException $e) { $property = $properties->get($name); diff --git a/Tests/Functional/Entity/JMSNote.php b/Tests/Functional/Entity/JMSNote.php new file mode 100644 index 0000000..c2118f4 --- /dev/null +++ b/Tests/Functional/Entity/JMSNote.php @@ -0,0 +1,34 @@ + [ + 'type' => 'string', + ], + 'short' => [ + 'type' => 'integer', + ], ], ], $this->getModel('JMSUser')->toArray());