Skip to content

Commit fbdb28f

Browse files
authored
Revert "fix: resolve Schema ref from parameter type in AugmentRequestBody (#2018)" (#2023)
This reverts commit 57378fe.
1 parent 57378fe commit fbdb28f

8 files changed

Lines changed: 0 additions & 72 deletions

src/Processors/AugmentRequestBody.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,6 @@ protected function augmentRequestBody(Analysis $analysis, array $requestBodies):
5858
$requestBody->ref = $schema->ref;
5959
}
6060

61-
// Fall back: resolve parameter type to a Schema ref
62-
if (Generator::isDefault($requestBody->ref)) {
63-
$type = $context->reflector->getType();
64-
if ($type instanceof \ReflectionNamedType && !$type->isBuiltin()) {
65-
$className = $type->getName();
66-
if ($schemaAnnotation = $analysis->getAnnotationForSource($className, OA\Schema::class)) {
67-
$requestBody->ref = OA\Components::ref($schemaAnnotation);
68-
}
69-
}
70-
}
71-
7261
if (Generator::isDefault($requestBody->required)) {
7362
$requestBody->required = !$schema->isNullable();
7463
}

tests/Fixtures/Scratch/RequestBody.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,4 @@ public function postRef()
8989
public function postRefFoo(#[OAT\RequestBody] RequestBodyRefFoo $body)
9090
{
9191
}
92-
93-
#[OAT\Post(
94-
path: '/endpoint/schema-param',
95-
responses: [
96-
new OAT\Response(
97-
response: 200,
98-
description: 'All good'
99-
),
100-
]
101-
)]
102-
public function postSchemaParam(#[OAT\RequestBody] RequestBodySchema $body)
103-
{
104-
}
10592
}

tests/Fixtures/Scratch/RequestBody3.0.0-legacy.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ paths:
4343
responses:
4444
'200':
4545
description: 'All good'
46-
/endpoint/schema-param:
47-
post:
48-
operationId: e9325a4f940b91d3babe398eeebd8426
49-
requestBody:
50-
$ref: '#/components/schemas/RequestBodySchema'
51-
responses:
52-
'200':
53-
description: 'All good'
5446
components:
5547
schemas:
5648
RequestBodySchema: { }

tests/Fixtures/Scratch/RequestBody3.0.0-type-info.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ paths:
4343
responses:
4444
'200':
4545
description: 'All good'
46-
/endpoint/schema-param:
47-
post:
48-
operationId: e9325a4f940b91d3babe398eeebd8426
49-
requestBody:
50-
$ref: '#/components/schemas/RequestBodySchema'
51-
responses:
52-
'200':
53-
description: 'All good'
5446
components:
5547
schemas:
5648
RequestBodySchema: { }

tests/Fixtures/Scratch/RequestBody3.1.0-legacy.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ paths:
4343
responses:
4444
'200':
4545
description: 'All good'
46-
/endpoint/schema-param:
47-
post:
48-
operationId: e9325a4f940b91d3babe398eeebd8426
49-
requestBody:
50-
$ref: '#/components/schemas/RequestBodySchema'
51-
responses:
52-
'200':
53-
description: 'All good'
5446
components:
5547
schemas:
5648
RequestBodySchema: { }

tests/Fixtures/Scratch/RequestBody3.1.0-type-info.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ paths:
4343
responses:
4444
'200':
4545
description: 'All good'
46-
/endpoint/schema-param:
47-
post:
48-
operationId: e9325a4f940b91d3babe398eeebd8426
49-
requestBody:
50-
$ref: '#/components/schemas/RequestBodySchema'
51-
responses:
52-
'200':
53-
description: 'All good'
5446
components:
5547
schemas:
5648
RequestBodySchema: { }

tests/Fixtures/Scratch/RequestBody3.2.0-legacy.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ paths:
4343
responses:
4444
'200':
4545
description: 'All good'
46-
/endpoint/schema-param:
47-
post:
48-
operationId: e9325a4f940b91d3babe398eeebd8426
49-
requestBody:
50-
$ref: '#/components/schemas/RequestBodySchema'
51-
responses:
52-
'200':
53-
description: 'All good'
5446
components:
5547
schemas:
5648
RequestBodySchema: { }

tests/Fixtures/Scratch/RequestBody3.2.0-type-info.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ paths:
4343
responses:
4444
'200':
4545
description: 'All good'
46-
/endpoint/schema-param:
47-
post:
48-
operationId: e9325a4f940b91d3babe398eeebd8426
49-
requestBody:
50-
$ref: '#/components/schemas/RequestBodySchema'
51-
responses:
52-
'200':
53-
description: 'All good'
5446
components:
5547
schemas:
5648
RequestBodySchema: { }

0 commit comments

Comments
 (0)