From 10dcca3e60d02ff7d1092a531290935038d4eeee Mon Sep 17 00:00:00 2001 From: DerManoMann Date: Mon, 4 Dec 2023 16:22:28 +1300 Subject: [PATCH] Add missing attribute PathItem constructor args --- docs/reference/annotations.md | 4 +-- docs/reference/attributes.md | 32 ++++++++++++++++++------ src/Attributes/PathItem.php | 31 +++++++++++++++-------- tests/Annotations/AttributesSyncTest.php | 2 +- 4 files changed, 49 insertions(+), 20 deletions(-) diff --git a/docs/reference/annotations.md b/docs/reference/annotations.md index 2208ec7a..ff7af587 100644 --- a/docs/reference/annotations.md +++ b/docs/reference/annotations.md @@ -1009,7 +1009,7 @@ An array instance is valid against this property if its number of items is great

A boolean value indicating whether all items in an array property must be unique.

If this attribute is set to true, then all items in the array must be unique.

See: JSON schema validation

-
enum : string[]|int[]|float[]|\UnitEnum[]|class-string
+
enum : string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string

A collection of allowable values for a property.

A property instance is valid against this attribute if its value is one of the values specified in this collection.

See: JSON schema validation

@@ -1163,7 +1163,7 @@ An object representing a server variable for server URL template substitution.
serverVariable : string

The key into Server->variables array.

-
enum : string[]|int[]|float[]|\UnitEnum[]|class-string
+
enum : string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string

An enumeration of values to be used if the substitution options are from a limited set.

default : string

The default value to use for substitution, and to send, if an alternate value is not supplied.
diff --git a/docs/reference/attributes.md b/docs/reference/attributes.md index 292679b0..11c8dca5 100644 --- a/docs/reference/attributes.md +++ b/docs/reference/attributes.md @@ -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.

See: JSON schema validation

pattern : string|null

A string instance is considered valid if the regular expression matches the instance successfully.

-
enum : string[]|int[]|float[]|\UnitEnum[]|class-string
+
enum : string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string

A collection of allowable values for a property.

A property instance is valid against this attribute if its value is one of the values specified in this collection.

See: JSON schema validation

@@ -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.

See: JSON schema validation

pattern : string|null

A string instance is considered valid if the regular expression matches the instance successfully.

-
enum : string[]|int[]|float[]|\UnitEnum[]|class-string
+
enum : string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string

A collection of allowable values for a property.

A property instance is valid against this attribute if its value is one of the values specified in this collection.

See: JSON schema validation

@@ -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.

See: JSON schema validation

pattern : string|null

A string instance is considered valid if the regular expression matches the instance successfully.

-
enum : string[]|int[]|float[]|\UnitEnum[]|class-string
+
enum : string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string

A collection of allowable values for a property.

A property instance is valid against this attribute if its value is one of the values specified in this collection.

See: JSON schema validation

@@ -1772,10 +1772,28 @@ These will be ignored but can be used for custom processing.

path : string|null

Key for the Path Object (OpenApi->paths array).

+
ref : string|class-string|object|null
+

No details available.

See: Using refs

summary : string|null

An optional, string summary, intended to apply to all operations in this path.

description : string|null

An optional, string description, intended to apply to all operations in this path.

+
get : OpenApi\Attributes\Get|null
+

A definition of a GET operation on this path.

+
put : OpenApi\Attributes\Put|null
+

A definition of a PUT operation on this path.

+
post : OpenApi\Attributes\Post|null
+

A definition of a POST operation on this path.

+
delete : OpenApi\Attributes\Delete|null
+

A definition of a DELETE operation on this path.

+
options : OpenApi\Attributes\Options|null
+

A definition of a OPTIONS operation on this path.

+
head : OpenApi\Attributes\Head|null
+

A definition of a HEAD operation on this path.

+
patch : OpenApi\Attributes\Patch|null
+

A definition of a PATCH operation on this path.

+
trace : OpenApi\Attributes\Trace|null
+

A definition of a TRACE operation on this path.

servers : Server[]|null

An alternative server array to service all operations in this path.

parameters : Parameter[]|null
@@ -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.

See: JSON schema validation

pattern : string|null

A string instance is considered valid if the regular expression matches the instance successfully.

-
enum : string[]|int[]|float[]|\UnitEnum[]|class-string
+
enum : string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string

A collection of allowable values for a property.

A property instance is valid against this attribute if its value is one of the values specified in this collection.

See: JSON schema validation

@@ -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.

See: JSON schema validation

pattern : string|null

A string instance is considered valid if the regular expression matches the instance successfully.

-
enum : string[]|int[]|float[]|\UnitEnum[]|class-string
+
enum : string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string

A collection of allowable values for a property.

A property instance is valid against this attribute if its value is one of the values specified in this collection.

See: JSON schema validation

@@ -2700,7 +2718,7 @@ CommonMark syntax MAY be used for rich text representation.

The default value to use for substitution, and to send, if an alternate value is not supplied.

Unlike the Schema Object's default, this value must be provided by the consumer.

-
enum : string[]|int[]|float[]|\UnitEnum[]|class-string|null
+
enum : string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string|null

An enumeration of values to be used if the substitution options are from a limited set.

variables : array|null

A map between a variable name and its value.
@@ -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.

See: JSON schema validation

pattern : string|null

A string instance is considered valid if the regular expression matches the instance successfully.

-
enum : string[]|int[]|float[]|\UnitEnum[]|class-string
+
enum : string[]|int[]|float[]|bool[]|\UnitEnum[]|class-string

A collection of allowable values for a property.

A property instance is valid against this attribute if its value is one of the values specified in this collection.

See: JSON schema validation

diff --git a/src/Attributes/PathItem.php b/src/Attributes/PathItem.php index 4ecdd348..23475579 100644 --- a/src/Attributes/PathItem.php +++ b/src/Attributes/PathItem.php @@ -12,15 +12,25 @@ class PathItem extends \OpenApi\Annotations\PathItem { /** - * @param Server[]|null $servers - * @param Parameter[]|null $parameters - * @param array|null $x - * @param Attachable[]|null $attachables + * @param string|class-string|object|null $ref + * @param Server[]|null $servers + * @param Parameter[]|null $parameters + * @param array|null $x + * @param Attachable[]|null $attachables */ public function __construct( ?string $path = null, + ?string $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 @@ -28,11 +38,12 @@ public function __construct( ?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), + ]); } } diff --git a/tests/Annotations/AttributesSyncTest.php b/tests/Annotations/AttributesSyncTest.php index b62b482d..2f518e36 100644 --- a/tests/Annotations/AttributesSyncTest.php +++ b/tests/Annotations/AttributesSyncTest.php @@ -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