From 7a5c84dc30521a0bc173b3dccd4940eca3e36adc Mon Sep 17 00:00:00 2001
From: DerManoMann
Date: Tue, 14 Nov 2023 13:09:57 +1300
Subject: [PATCH] Fix RequestBody content type-hint
---
docs/reference/annotations.md | 4 ++--
docs/reference/attributes.md | 16 ++++++++--------
src/Annotations/RequestBody.php | 4 +++-
src/Attributes/RequestBody.php | 8 ++++----
4 files changed, 17 insertions(+), 15 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..6db5c292 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
@@ -2079,7 +2079,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
@@ -2366,7 +2366,7 @@ CommonMark syntax may be used for rich text representation.
If the parameter location is "path", this property is required and its value must be true.
Otherwise, the property may be included and its default value is false.
- content : array<MediaType>|MediaType|JsonContent|XmlContent|Attachable|null
+ content : array<MediaType|JsonContent|XmlContent>|MediaType|XmlContent|Attachable|null
The content of the request body.
The key is a media type or media type range and the value describes it. For requests that match multiple keys,
@@ -2525,7 +2525,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 +2700,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 +2973,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/Annotations/RequestBody.php b/src/Annotations/RequestBody.php
index 20045d91..4844d1da 100644
--- a/src/Annotations/RequestBody.php
+++ b/src/Annotations/RequestBody.php
@@ -6,6 +6,8 @@
namespace OpenApi\Annotations;
+use OpenApi\Attributes\JsonContent;
+use OpenApi\Attributes\XmlContent;
use OpenApi\Generator;
/**
@@ -60,7 +62,7 @@ class RequestBody extends AbstractAnnotation
* The key is a media type or media type range and the value describes it. For requests that match multiple keys,
* only the most specific key is applicable. e.g. text/plain overrides text/*.
*
- * @var array|MediaType|JsonContent|XmlContent|Attachable
+ * @var array|MediaType|JsonContent|XmlContent|Attachable
*/
public $content = Generator::UNDEFINED;
diff --git a/src/Attributes/RequestBody.php b/src/Attributes/RequestBody.php
index dbb2ef27..02cfaac5 100644
--- a/src/Attributes/RequestBody.php
+++ b/src/Attributes/RequestBody.php
@@ -13,10 +13,10 @@
class RequestBody extends OA\RequestBody
{
/**
- * @param string|class-string|object|null $ref
- * @param array|MediaType|JsonContent|XmlContent|Attachable|null $content
- * @param array|null $x
- * @param Attachable[]|null $attachables
+ * @param string|class-string|object|null $ref
+ * @param array|MediaType|JsonContent|XmlContent|Attachable|null $content
+ * @param array|null $x
+ * @param Attachable[]|null $attachables
*/
public function __construct(
string|object|null $ref = null,