diff --git a/docs/reference/attributes.md b/docs/reference/attributes.md index c4ebcf0c2..292679b09 100644 --- a/docs/reference/attributes.md +++ b/docs/reference/attributes.md @@ -152,6 +152,8 @@ schema defined by this property's value.

oneOf : array<Schema|\OpenApi\Annotations\Schema>

An instance validates successfully against this property if it validates successfully against exactly one schema
defined by this property's value.

+
additionalProperties : OpenApi\Attributes\AdditionalProperties|bool|null
+

http://json-schema.org/latest/json-schema-validation.html#anchor64.

x : array<string,mixed>|null

While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.
For further details see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions
diff --git a/src/Attributes/AdditionalProperties.php b/src/Attributes/AdditionalProperties.php index 6147238c2..ca0ab3f8d 100644 --- a/src/Attributes/AdditionalProperties.php +++ b/src/Attributes/AdditionalProperties.php @@ -61,6 +61,7 @@ public function __construct( ?array $allOf = null, ?array $anyOf = null, ?array $oneOf = null, + AdditionalProperties|bool|null $additionalProperties = null, // annotation ?array $x = null, ?array $attachables = null @@ -100,7 +101,7 @@ public function __construct( 'oneOf' => $oneOf ?? Generator::UNDEFINED, 'x' => $x ?? Generator::UNDEFINED, 'attachables' => $attachables ?? Generator::UNDEFINED, - 'value' => $this->combine($items, $discriminator, $externalDocs, $attachables), + 'value' => $this->combine($items, $discriminator, $externalDocs, $additionalProperties, $attachables), ]); } } diff --git a/tests/Fixtures/Scratch/NestedAdditionalProperties.php b/tests/Fixtures/Scratch/NestedAdditionalProperties.php new file mode 100644 index 000000000..01eb62b1e --- /dev/null +++ b/tests/Fixtures/Scratch/NestedAdditionalProperties.php @@ -0,0 +1,30 @@ +