Closed mdaneri closed 2 months ago
This PR fixes a bug where the -NoAdditionalProperties parameter was not affecting the OpenAPI document. With this fix, when -NoAdditionalProperties is specified, AdditionalProperties will be correctly set to false in the generated schema.
-NoAdditionalProperties
AdditionalProperties
New-PodeOAIntProperty -Name 'id'-Format Int64 -Example 1 | New-PodeOAStringProperty -Name 'name' -Example 'Dogs' | New-PodeOAObjectProperty -XmlName 'category' -NoAdditionalProperties| Add-PodeOAComponentSchema -Name 'Category'
Currently, the OpenAPI document is generated without the AdditionalProperties setting, even when the NoAdditionalProperties parameter is used:
NoAdditionalProperties
"Category": { "type": "object", "xml": { "name": "category" }, "properties": { "id": { "type": "integer", "example": 1, "format": "int64" }, "name": { "type": "string", "example": "Dogs" } } }
With the bug fix, the OpenAPI document will correctly include AdditionalProperties set to false when the NoAdditionalProperties parameter is used:
"Category": { "type": "object", "xml": { "name": "category" }, "properties": { "id": { "type": "integer", "example": 1, "format": "int64" }, "name": { "type": "string", "example": "Dogs" } }, "additionalProperties": false }
Description of the Change
This PR fixes a bug where the
-NoAdditionalProperties
parameter was not affecting the OpenAPI document. With this fix, when-NoAdditionalProperties
is specified,AdditionalProperties
will be correctly set to false in the generated schema.Current Behavior
Currently, the OpenAPI document is generated without the
AdditionalProperties
setting, even when theNoAdditionalProperties
parameter is used:Expected Behavior with Fix
With the bug fix, the OpenAPI document will correctly include
AdditionalProperties
set to false when theNoAdditionalProperties
parameter is used: