Skip to content

Commit

Permalink
Add scratch using parameter/response refs (zircote#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann authored Jan 24, 2024
1 parent 56ad9c2 commit 9443abf
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/Fixtures/Scratch/UsingRefs.php
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
{
}
23 changes: 23 additions & 0 deletions tests/Fixtures/Scratch/UsingRefs.yaml
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'

0 comments on commit 9443abf

Please sign in to comment.