Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing attribute PathItem constructor args #1510

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/reference/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ An array instance is valid against this property if its number of items is great
<dd><p>A boolean value indicating whether all items in an array property must be unique.<br />
<br />
If this attribute is set to true, then all items in the array must be unique.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor49">JSON schema validation</a></p></dd>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|\UnitEnum[]|class-string</span></dt>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string</span></dt>
<dd><p>A collection of allowable values for a property.<br />
<br />
A property instance is valid against this attribute if its value is one of the values specified in this collection.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor76">JSON schema validation</a></p></dd>
Expand Down Expand Up @@ -1163,7 +1163,7 @@ An object representing a server variable for server URL template substitution.
<dl>
<dt><strong>serverVariable</strong> : <span style="font-family: monospace;">string</span></dt>
<dd><p>The key into Server->variables array.</p></dd>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|\UnitEnum[]|class-string</span></dt>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string</span></dt>
<dd><p>An enumeration of values to be used if the substitution options are from a limited set.</p></dd>
<dt><strong>default</strong> : <span style="font-family: monospace;">string</span></dt>
<dd><p>The default value to use for substitution, and to send, if an alternate value is not supplied.<br />
Expand Down
32 changes: 25 additions & 7 deletions docs/reference/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ An array instance is valid against this property if its number of items is great
If this attribute is set to true, then all items in the array must be unique.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor49">JSON schema validation</a></p></dd>
<dt><strong>pattern</strong> : <span style="font-family: monospace;">string|null</span></dt>
<dd><p>A string instance is considered valid if the regular expression matches the instance successfully.</p></dd>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|\UnitEnum[]|class-string</span></dt>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string</span></dt>
<dd><p>A collection of allowable values for a property.<br />
<br />
A property instance is valid against this attribute if its value is one of the values specified in this collection.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor76">JSON schema validation</a></p></dd>
Expand Down Expand Up @@ -1057,7 +1057,7 @@ An array instance is valid against this property if its number of items is great
If this attribute is set to true, then all items in the array must be unique.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor49">JSON schema validation</a></p></dd>
<dt><strong>pattern</strong> : <span style="font-family: monospace;">string|null</span></dt>
<dd><p>A string instance is considered valid if the regular expression matches the instance successfully.</p></dd>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|\UnitEnum[]|class-string</span></dt>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string</span></dt>
<dd><p>A collection of allowable values for a property.<br />
<br />
A property instance is valid against this attribute if its value is one of the values specified in this collection.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor76">JSON schema validation</a></p></dd>
Expand Down Expand Up @@ -1215,7 +1215,7 @@ An array instance is valid against this property if its number of items is great
If this attribute is set to true, then all items in the array must be unique.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor49">JSON schema validation</a></p></dd>
<dt><strong>pattern</strong> : <span style="font-family: monospace;">string|null</span></dt>
<dd><p>A string instance is considered valid if the regular expression matches the instance successfully.</p></dd>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|\UnitEnum[]|class-string</span></dt>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string</span></dt>
<dd><p>A collection of allowable values for a property.<br />
<br />
A property instance is valid against this attribute if its value is one of the values specified in this collection.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor76">JSON schema validation</a></p></dd>
Expand Down Expand Up @@ -1772,10 +1772,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 Expand Up @@ -2079,7 +2097,7 @@ An array instance is valid against this property if its number of items is great
If this attribute is set to true, then all items in the array must be unique.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor49">JSON schema validation</a></p></dd>
<dt><strong>pattern</strong> : <span style="font-family: monospace;">string|null</span></dt>
<dd><p>A string instance is considered valid if the regular expression matches the instance successfully.</p></dd>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|\UnitEnum[]|class-string</span></dt>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string</span></dt>
<dd><p>A collection of allowable values for a property.<br />
<br />
A property instance is valid against this attribute if its value is one of the values specified in this collection.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor76">JSON schema validation</a></p></dd>
Expand Down Expand Up @@ -2525,7 +2543,7 @@ An array instance is valid against this property if its number of items is great
If this attribute is set to true, then all items in the array must be unique.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor49">JSON schema validation</a></p></dd>
<dt><strong>pattern</strong> : <span style="font-family: monospace;">string|null</span></dt>
<dd><p>A string instance is considered valid if the regular expression matches the instance successfully.</p></dd>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|\UnitEnum[]|class-string</span></dt>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string</span></dt>
<dd><p>A collection of allowable values for a property.<br />
<br />
A property instance is valid against this attribute if its value is one of the values specified in this collection.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor76">JSON schema validation</a></p></dd>
Expand Down Expand Up @@ -2700,7 +2718,7 @@ CommonMark syntax MAY be used for rich text representation.</p></dd>
<dd><p>The default value to use for substitution, and to send, if an alternate value is not supplied.<br />
<br />
Unlike the Schema Object's default, this value must be provided by the consumer.</p></dd>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|\UnitEnum[]|class-string|null</span></dt>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string|null</span></dt>
<dd><p>An enumeration of values to be used if the substitution options are from a limited set.</p></dd>
<dt><strong>variables</strong> : <span style="font-family: monospace;">array|null</span></dt>
<dd><p>A map between a variable name and its value.<br />
Expand Down Expand Up @@ -2973,7 +2991,7 @@ An array instance is valid against this property if its number of items is great
If this attribute is set to true, then all items in the array must be unique.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor49">JSON schema validation</a></p></dd>
<dt><strong>pattern</strong> : <span style="font-family: monospace;">string|null</span></dt>
<dd><p>A string instance is considered valid if the regular expression matches the instance successfully.</p></dd>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|\UnitEnum[]|class-string</span></dt>
<dt><strong>enum</strong> : <span style="font-family: monospace;">string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string</span></dt>
<dd><p>A collection of allowable values for a property.<br />
<br />
A property instance is valid against this attribute if its value is one of the values specified in this collection.</p><p><i>See</i>: <a href="http://json-schema.org/latest/json-schema-validation.html#anchor76">JSON schema validation</a></p></dd>
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
Loading