forked from zircote/swagger-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scratch using parameter/response refs (zircote#1537)
- Loading branch information
1 parent
56ad9c2
commit 9443abf
Showing
2 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* @license Apache 2.0 | ||
*/ | ||
|
||
namespace OpenApi\Tests\Fixtures\Scratch; | ||
|
||
use OpenApi\Attributes as OAT; | ||
|
||
#[OAT\PathParameter(name: 'itemName', description: 'The item name')] | ||
class UsingRefsParameter | ||
{ | ||
} | ||
|
||
#[OAT\Response(response: 'item', description: 'Item response')] | ||
class UsingRefsResponse | ||
{ | ||
} | ||
|
||
#[OAT\Info(title: 'Parameter Ref', version: '1.0.0')] | ||
#[OAT\Get( | ||
path: '/item/{item_name}', | ||
parameters: [ | ||
new OAT\Parameter(ref: '#/components/parameters/itemName'), | ||
], | ||
responses: [ | ||
new OAT\Response(response: 200, ref: '#/components/responses/item'), | ||
] | ||
)] | ||
class UsingRefsController | ||
{ | ||
} |
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,23 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: 'Parameter Ref' | ||
version: 1.0.0 | ||
paths: | ||
'/item/{item_name}': | ||
get: | ||
operationId: 6ecb3788642c6ba8ce8d99cbcd554dbe | ||
parameters: | ||
- | ||
$ref: '#/components/parameters/itemName' | ||
responses: | ||
'200': | ||
$ref: '#/components/responses/item' | ||
components: | ||
responses: | ||
item: | ||
description: 'Item response' | ||
parameters: | ||
itemName: | ||
name: itemName | ||
in: path | ||
description: 'The item name' |