Skip to content

Commit

Permalink
Add missing attribute PathItem constructor args (#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann authored Dec 4, 2023
1 parent 364fd85 commit 8ea52e3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 11 deletions.
18 changes: 18 additions & 0 deletions docs/reference/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -1787,10 +1787,28 @@ These will be ignored but can be used for custom processing.</p></dd>
<dl>
<dt><strong>path</strong> : <span style="font-family: monospace;">string|null</span></dt>
<dd><p>Key for the Path Object (OpenApi->paths array).</p></dd>
<dt><strong>ref</strong> : <span style="font-family: monospace;">string|class-string|object|null</span></dt>
<dd><p>No details available.</p><p><i>See</i>: <a href="https://swagger.io/docs/specification/using-ref/">Using refs</a></p></dd>
<dt><strong>summary</strong> : <span style="font-family: monospace;">string|null</span></dt>
<dd><p>An optional, string summary, intended to apply to all operations in this path.</p></dd>
<dt><strong>description</strong> : <span style="font-family: monospace;">string|null</span></dt>
<dd><p>An optional, string description, intended to apply to all operations in this path.</p></dd>
<dt><strong>get</strong> : <span style="font-family: monospace;">OpenApi\Attributes\Get|null</span></dt>
<dd><p>A definition of a GET operation on this path.</p></dd>
<dt><strong>put</strong> : <span style="font-family: monospace;">OpenApi\Attributes\Put|null</span></dt>
<dd><p>A definition of a PUT operation on this path.</p></dd>
<dt><strong>post</strong> : <span style="font-family: monospace;">OpenApi\Attributes\Post|null</span></dt>
<dd><p>A definition of a POST operation on this path.</p></dd>
<dt><strong>delete</strong> : <span style="font-family: monospace;">OpenApi\Attributes\Delete|null</span></dt>
<dd><p>A definition of a DELETE operation on this path.</p></dd>
<dt><strong>options</strong> : <span style="font-family: monospace;">OpenApi\Attributes\Options|null</span></dt>
<dd><p>A definition of a OPTIONS operation on this path.</p></dd>
<dt><strong>head</strong> : <span style="font-family: monospace;">OpenApi\Attributes\Head|null</span></dt>
<dd><p>A definition of a HEAD operation on this path.</p></dd>
<dt><strong>patch</strong> : <span style="font-family: monospace;">OpenApi\Attributes\Patch|null</span></dt>
<dd><p>A definition of a PATCH operation on this path.</p></dd>
<dt><strong>trace</strong> : <span style="font-family: monospace;">OpenApi\Attributes\Trace|null</span></dt>
<dd><p>A definition of a TRACE operation on this path.</p></dd>
<dt><strong>servers</strong> : <span style="font-family: monospace;">Server[]|null</span></dt>
<dd><p>An alternative server array to service all operations in this path.</p></dd>
<dt><strong>parameters</strong> : <span style="font-family: monospace;">Parameter[]|null</span></dt>
Expand Down
31 changes: 21 additions & 10 deletions src/Attributes/PathItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,38 @@
class PathItem extends \OpenApi\Annotations\PathItem
{
/**
* @param Server[]|null $servers
* @param Parameter[]|null $parameters
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
* @param string|class-string|object|null $ref
* @param Server[]|null $servers
* @param Parameter[]|null $parameters
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
*/
public function __construct(
?string $path = null,
mixed $ref = null,
?string $summary = null,
?string $description = null,
?Get $get = null,
?Put $put = null,
?Post $post = null,
?Delete $delete = null,
?Options $options = null,
?Head $head = null,
?Patch $patch = null,
?Trace $trace = null,
?array $servers = null,
?array $parameters = null,
// annotation
?array $x = null,
?array $attachables = null
) {
parent::__construct([
'path' => $path ?? Generator::UNDEFINED,
'summary' => $summary ?? Generator::UNDEFINED,
'description' => $description ?? Generator::UNDEFINED,
'x' => $x ?? Generator::UNDEFINED,
'value' => $this->combine($servers, $parameters, $attachables),
]);
'path' => $path ?? Generator::UNDEFINED,
'ref' => $ref ?? Generator::UNDEFINED,
'summary' => $summary ?? Generator::UNDEFINED,
'description' => $description ?? Generator::UNDEFINED,
'x' => $x ?? Generator::UNDEFINED,
'value' => $this->combine($get, $put, $post, $delete, $options, $head, $patch, $trace, $servers, $parameters, $attachables),
]);
}
}
2 changes: 1 addition & 1 deletion tests/Annotations/AttributesSyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class AttributesSyncTest extends OpenApiTestCase
{
public static $SCHEMA_EXCLUSIONS = ['const', 'multipleOf', 'not', 'additionalItems', 'contains', 'patternProperties', 'dependencies', 'propertyNames'];
public static $PATHITEM_EXCLUSIONS = ['ref', 'get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'];
public static $PATHITEM_EXCLUSIONS = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'];
public static $PARAMETER_EXCLUSIONS = ['matrix', 'label', 'form', 'simple', 'deepObject'];

public function testCounts(): void
Expand Down

0 comments on commit 8ea52e3

Please sign in to comment.