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

Fix RequestBody content type-hint #1495

Merged
merged 1 commit into from
Nov 30, 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
16 changes: 8 additions & 8 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 @@ -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.</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 @@ -2366,7 +2366,7 @@ CommonMark syntax may be used for rich text representation.</p></dd>
<br />
If the parameter location is "path", this property is required and its value must be true.<br />
Otherwise, the property may be included and its default value is false.</p></dd>
<dt><strong>content</strong> : <span style="font-family: monospace;">array&lt;MediaType&gt;|MediaType|JsonContent|XmlContent|Attachable|null</span></dt>
<dt><strong>content</strong> : <span style="font-family: monospace;">array&lt;MediaType|JsonContent|XmlContent&gt;|MediaType|XmlContent|Attachable|null</span></dt>
<dd><p>The content of the request body.<br />
<br />
The key is a media type or media type range and the value describes it. For requests that match multiple keys,<br />
Expand Down Expand Up @@ -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.</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 +2700,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 +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.</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
4 changes: 3 additions & 1 deletion src/Annotations/RequestBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

namespace OpenApi\Annotations;

use OpenApi\Attributes\JsonContent;
use OpenApi\Attributes\XmlContent;
use OpenApi\Generator;

/**
Expand Down Expand Up @@ -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>|MediaType|JsonContent|XmlContent|Attachable
* @var array<MediaType|JsonContent|XmlContent>|MediaType|JsonContent|XmlContent|Attachable
*/
public $content = Generator::UNDEFINED;

Expand Down
8 changes: 4 additions & 4 deletions src/Attributes/RequestBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
class RequestBody extends OA\RequestBody
{
/**
* @param string|class-string|object|null $ref
* @param array<MediaType>|MediaType|JsonContent|XmlContent|Attachable|null $content
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
* @param string|class-string|object|null $ref
* @param array<MediaType|JsonContent|XmlContent>|MediaType|JsonContent|XmlContent|Attachable|null $content
* @param array<string,mixed>|null $x
* @param Attachable[]|null $attachables
*/
public function __construct(
string|object|null $ref = null,
Expand Down
Loading