-
Notifications
You must be signed in to change notification settings - Fork 942
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix resolving general component refs
- Loading branch information
1 parent
038da8a
commit 3074597
Showing
4 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* @license Apache 2.0 | ||
*/ | ||
|
||
namespace OpenApi\Tests\Fixtures\Scratch; | ||
|
||
use OpenApi\Attributes as OAT; | ||
|
||
#[OAT\RequestBody()] | ||
class RequestBodyRef | ||
{ | ||
} | ||
|
||
#[OAT\RequestBody(request: 'foo')] | ||
class RequestBodyRefFoo | ||
{ | ||
} | ||
|
||
#[OAT\Info(title: 'RequestBody', version: '1.0')] | ||
class RequestBodyController | ||
{ | ||
#[OAT\Get( | ||
path: '/endpoint', | ||
requestBody: new OAT\RequestBody( | ||
description: 'Information about a new pet in the system', | ||
content: new OAT\MediaType( | ||
mediaType: 'application/json' | ||
), | ||
), | ||
responses: [ | ||
new OAT\Response( | ||
response: 200, | ||
description: 'All good' | ||
), | ||
] | ||
)] | ||
public function post() | ||
{ | ||
} | ||
|
||
#[OAT\Post( | ||
path: '/endpoint/ref', | ||
requestBody: new OAT\RequestBody(ref: RequestBodyRef::class), | ||
responses: [ | ||
new OAT\Response( | ||
response: 200, | ||
description: 'All good' | ||
), | ||
] | ||
)] | ||
public function postRef() | ||
{ | ||
} | ||
|
||
#[OAT\Post( | ||
path: '/endpoint/ref-foo', | ||
requestBody: new OAT\RequestBody(ref: RequestBodyRefFoo::class), | ||
responses: [ | ||
new OAT\Response( | ||
response: 200, | ||
description: 'All good' | ||
), | ||
] | ||
)] | ||
public function postRefFoo() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: RequestBody | ||
version: '1.0' | ||
paths: | ||
/endpoint: | ||
get: | ||
operationId: 30597cf43b480393042f6b01a9d7980c | ||
requestBody: | ||
description: 'Information about a new pet in the system' | ||
content: | ||
application/json: { } | ||
responses: | ||
'200': | ||
description: 'All good' | ||
/endpoint/ref: | ||
post: | ||
operationId: 4250dd87e4e3872a8f2e481532cbc245 | ||
requestBody: | ||
$ref: '#/components/requestBodies/RequestBodyRef' | ||
responses: | ||
'200': | ||
description: 'All good' | ||
/endpoint/ref-foo: | ||
post: | ||
operationId: 344406e28927343e4e9e4f39bd6c385b | ||
requestBody: | ||
$ref: '#/components/requestBodies/foo' | ||
responses: | ||
'200': | ||
description: 'All good' | ||
components: | ||
requestBodies: | ||
RequestBodyRef: { } | ||
foo: { } |