diff --git a/src/Annotations/Parameter.php b/src/Annotations/Parameter.php index f81dea14d..95eb80b39 100644 --- a/src/Annotations/Parameter.php +++ b/src/Annotations/Parameter.php @@ -163,7 +163,7 @@ class Parameter extends AbstractAnnotation * The key is the media type and the value describes it. * The map must only contain one entry. * - * @var MediaType[] + * @var array|JsonContent|XmlContent|Attachable */ public $content = Generator::UNDEFINED; diff --git a/src/Attributes/ParameterTrait.php b/src/Attributes/ParameterTrait.php index 139e97a94..30a30a12c 100644 --- a/src/Attributes/ParameterTrait.php +++ b/src/Attributes/ParameterTrait.php @@ -11,9 +11,10 @@ trait ParameterTrait { /** - * @param array $examples - * @param array|null $x - * @param Attachable[]|null $attachables + * @param array $examples + * @param array|JsonContent|XmlContent|Attachable|null $content + * @param array|null $x + * @param Attachable[]|null $attachables */ public function __construct( ?string $parameter = null, @@ -27,6 +28,7 @@ public function __construct( ?Schema $schema = null, mixed $example = Generator::UNDEFINED, ?array $examples = null, + array|JsonContent|XmlContent|Attachable|null $content = null, ?string $style = null, ?bool $explode = null, ?bool $allowReserved = null, @@ -52,7 +54,7 @@ public function __construct( 'spaceDelimited' => $spaceDelimited ?? Generator::UNDEFINED, 'pipeDelimited' => $pipeDelimited ?? Generator::UNDEFINED, 'x' => $x ?? Generator::UNDEFINED, - 'value' => $this->combine($schema, $examples, $attachables), + 'value' => $this->combine($schema, $examples, $content, $attachables), ]); } } diff --git a/tests/Annotations/AttributesSyncTest.php b/tests/Annotations/AttributesSyncTest.php index 7a2a73151..ff0af5808 100644 --- a/tests/Annotations/AttributesSyncTest.php +++ b/tests/Annotations/AttributesSyncTest.php @@ -16,7 +16,7 @@ class AttributesSyncTest extends OpenApiTestCase { public static $SCHEMA_EXCLUSIONS = ['const', 'maxProperties', 'minProperties', 'multipleOf', 'not', 'additionalItems', 'contains', 'patternProperties', 'dependencies', 'propertyNames']; public static $PATHITEM_EXCLUSIONS = ['ref', 'get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']; - public static $PARAMETER_EXCLUSIONS = ['content', 'matrix', 'label', 'form', 'simple', 'deepObject']; + public static $PARAMETER_EXCLUSIONS = ['matrix', 'label', 'form', 'simple', 'deepObject']; public function testCounts(): void { diff --git a/tests/Fixtures/Scratch/ParameterContent.php b/tests/Fixtures/Scratch/ParameterContent.php new file mode 100644 index 000000000..9d9029f62 --- /dev/null +++ b/tests/Fixtures/Scratch/ParameterContent.php @@ -0,0 +1,37 @@ +