From a47e3f691b6c602a110cdd995a1b1dcd5d8992db Mon Sep 17 00:00:00 2001 From: DerManoMann Date: Sat, 13 Jun 2026 09:48:34 +1200 Subject: [PATCH] Revert "fix: resolve Schema ref from parameter type in AugmentRequestBody (#2018)" This reverts commit 57378fe061dbd44ab8f6d171fe9d25fb61fa019f. --- src/Processors/AugmentRequestBody.php | 11 ----------- tests/Fixtures/Scratch/RequestBody.php | 13 ------------- tests/Fixtures/Scratch/RequestBody3.0.0-legacy.yaml | 8 -------- .../Scratch/RequestBody3.0.0-type-info.yaml | 8 -------- tests/Fixtures/Scratch/RequestBody3.1.0-legacy.yaml | 8 -------- .../Scratch/RequestBody3.1.0-type-info.yaml | 8 -------- tests/Fixtures/Scratch/RequestBody3.2.0-legacy.yaml | 8 -------- .../Scratch/RequestBody3.2.0-type-info.yaml | 8 -------- 8 files changed, 72 deletions(-) diff --git a/src/Processors/AugmentRequestBody.php b/src/Processors/AugmentRequestBody.php index dd9825a3d..104e6f1c8 100644 --- a/src/Processors/AugmentRequestBody.php +++ b/src/Processors/AugmentRequestBody.php @@ -58,17 +58,6 @@ protected function augmentRequestBody(Analysis $analysis, array $requestBodies): $requestBody->ref = $schema->ref; } - // Fall back: resolve parameter type to a Schema ref - if (Generator::isDefault($requestBody->ref)) { - $type = $context->reflector->getType(); - if ($type instanceof \ReflectionNamedType && !$type->isBuiltin()) { - $className = $type->getName(); - if ($schemaAnnotation = $analysis->getAnnotationForSource($className, OA\Schema::class)) { - $requestBody->ref = OA\Components::ref($schemaAnnotation); - } - } - } - if (Generator::isDefault($requestBody->required)) { $requestBody->required = !$schema->isNullable(); } diff --git a/tests/Fixtures/Scratch/RequestBody.php b/tests/Fixtures/Scratch/RequestBody.php index 2d608865c..25879d1f5 100644 --- a/tests/Fixtures/Scratch/RequestBody.php +++ b/tests/Fixtures/Scratch/RequestBody.php @@ -89,17 +89,4 @@ public function postRef() public function postRefFoo(#[OAT\RequestBody] RequestBodyRefFoo $body) { } - - #[OAT\Post( - path: '/endpoint/schema-param', - responses: [ - new OAT\Response( - response: 200, - description: 'All good' - ), - ] - )] - public function postSchemaParam(#[OAT\RequestBody] RequestBodySchema $body) - { - } } diff --git a/tests/Fixtures/Scratch/RequestBody3.0.0-legacy.yaml b/tests/Fixtures/Scratch/RequestBody3.0.0-legacy.yaml index 52e51b24b..9348b72ca 100644 --- a/tests/Fixtures/Scratch/RequestBody3.0.0-legacy.yaml +++ b/tests/Fixtures/Scratch/RequestBody3.0.0-legacy.yaml @@ -43,14 +43,6 @@ paths: responses: '200': description: 'All good' - /endpoint/schema-param: - post: - operationId: e9325a4f940b91d3babe398eeebd8426 - requestBody: - $ref: '#/components/schemas/RequestBodySchema' - responses: - '200': - description: 'All good' components: schemas: RequestBodySchema: { } diff --git a/tests/Fixtures/Scratch/RequestBody3.0.0-type-info.yaml b/tests/Fixtures/Scratch/RequestBody3.0.0-type-info.yaml index b26c96dd6..724732237 100644 --- a/tests/Fixtures/Scratch/RequestBody3.0.0-type-info.yaml +++ b/tests/Fixtures/Scratch/RequestBody3.0.0-type-info.yaml @@ -43,14 +43,6 @@ paths: responses: '200': description: 'All good' - /endpoint/schema-param: - post: - operationId: e9325a4f940b91d3babe398eeebd8426 - requestBody: - $ref: '#/components/schemas/RequestBodySchema' - responses: - '200': - description: 'All good' components: schemas: RequestBodySchema: { } diff --git a/tests/Fixtures/Scratch/RequestBody3.1.0-legacy.yaml b/tests/Fixtures/Scratch/RequestBody3.1.0-legacy.yaml index a55ae7649..8a0474e9c 100644 --- a/tests/Fixtures/Scratch/RequestBody3.1.0-legacy.yaml +++ b/tests/Fixtures/Scratch/RequestBody3.1.0-legacy.yaml @@ -43,14 +43,6 @@ paths: responses: '200': description: 'All good' - /endpoint/schema-param: - post: - operationId: e9325a4f940b91d3babe398eeebd8426 - requestBody: - $ref: '#/components/schemas/RequestBodySchema' - responses: - '200': - description: 'All good' components: schemas: RequestBodySchema: { } diff --git a/tests/Fixtures/Scratch/RequestBody3.1.0-type-info.yaml b/tests/Fixtures/Scratch/RequestBody3.1.0-type-info.yaml index e8e9039c1..7f2ae1812 100644 --- a/tests/Fixtures/Scratch/RequestBody3.1.0-type-info.yaml +++ b/tests/Fixtures/Scratch/RequestBody3.1.0-type-info.yaml @@ -43,14 +43,6 @@ paths: responses: '200': description: 'All good' - /endpoint/schema-param: - post: - operationId: e9325a4f940b91d3babe398eeebd8426 - requestBody: - $ref: '#/components/schemas/RequestBodySchema' - responses: - '200': - description: 'All good' components: schemas: RequestBodySchema: { } diff --git a/tests/Fixtures/Scratch/RequestBody3.2.0-legacy.yaml b/tests/Fixtures/Scratch/RequestBody3.2.0-legacy.yaml index d5e83e96b..d2b6b706f 100644 --- a/tests/Fixtures/Scratch/RequestBody3.2.0-legacy.yaml +++ b/tests/Fixtures/Scratch/RequestBody3.2.0-legacy.yaml @@ -43,14 +43,6 @@ paths: responses: '200': description: 'All good' - /endpoint/schema-param: - post: - operationId: e9325a4f940b91d3babe398eeebd8426 - requestBody: - $ref: '#/components/schemas/RequestBodySchema' - responses: - '200': - description: 'All good' components: schemas: RequestBodySchema: { } diff --git a/tests/Fixtures/Scratch/RequestBody3.2.0-type-info.yaml b/tests/Fixtures/Scratch/RequestBody3.2.0-type-info.yaml index 8e2539240..d3e3a73a8 100644 --- a/tests/Fixtures/Scratch/RequestBody3.2.0-type-info.yaml +++ b/tests/Fixtures/Scratch/RequestBody3.2.0-type-info.yaml @@ -43,14 +43,6 @@ paths: responses: '200': description: 'All good' - /endpoint/schema-param: - post: - operationId: e9325a4f940b91d3babe398eeebd8426 - requestBody: - $ref: '#/components/schemas/RequestBodySchema' - responses: - '200': - description: 'All good' components: schemas: RequestBodySchema: { }