diff --git a/src/Annotations/AbstractAnnotation.php b/src/Annotations/AbstractAnnotation.php index f3e7154e..c23dfdf3 100644 --- a/src/Annotations/AbstractAnnotation.php +++ b/src/Annotations/AbstractAnnotation.php @@ -652,7 +652,7 @@ public function getRoot(): string */ public function isRoot(string $rootClass): bool { - return $this->getRoot() == $rootClass; + return get_class($this) == $rootClass || $this->getRoot() == $rootClass; } /** diff --git a/src/Annotations/RequestBody.php b/src/Annotations/RequestBody.php index 4844d1da..cf954d5d 100644 --- a/src/Annotations/RequestBody.php +++ b/src/Annotations/RequestBody.php @@ -29,7 +29,7 @@ class RequestBody extends AbstractAnnotation public $ref = Generator::UNDEFINED; /** - * Request body model name. + * The key into Components->requestBodies array. * * @var string */ @@ -95,4 +95,17 @@ class RequestBody extends AbstractAnnotation MediaType::class => ['content', 'mediaType'], Attachable::class => ['attachables'], ]; + + /** + * @inheritdoc + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $data = parent::jsonSerialize(); + + unset($data->request); + + return $data; + } } diff --git a/tests/Fixtures/Scratch/RequestBody.php b/tests/Fixtures/Scratch/RequestBody.php new file mode 100644 index 00000000..95515ca1 --- /dev/null +++ b/tests/Fixtures/Scratch/RequestBody.php @@ -0,0 +1,70 @@ +