When using New-PodeOAObjectProperty with the -AdditionalProperties parameter and the -NoProperties switch, the generated OpenAPI schema incorrectly includes an empty properties array.
The generated OpenAPI YAML should not include the properties: [] array when the -NoProperties switch is used. The corrected YAML should look like this:
Describe the Bug
When using
New-PodeOAObjectProperty
with the-AdditionalProperties
parameter and the-NoProperties
switch, the generated OpenAPI schema incorrectly includes an emptyproperties
array.Steps To Reproduce
Run the following PowerShell command:
This generates the following incorrect OpenAPI YAML:
The
properties: []
array should not be present.Expected Behavior
The generated OpenAPI YAML should not include the
properties: []
array when the-NoProperties
switch is used. The corrected YAML should look like this:Fix
Ensure that the
properties
array is omitted from the generated OpenAPI schema when the-NoProperties
switch is used.