You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now suppose that $Client is defined as being an array [PSCustomObject[]]. The conversion to JSON is done in the same way, but the JSON output changes depending on whether $Client is an array of one or multiple elements, because the parameter type declaration does not force an array context when the array contains a single element.
openapi-generator version
Up to 7.5
OpenAPI declaration file content or url
The issue was first noticed using a PowerShell client generated from Connectwise PSA API specs. The specs are too complex (over 4K endpoints) to be used for an example.
Bug Report Checklist
Description
Consider the function
Invoke-PS123TestSpecialTags
of PSPetstore. It has a parameter $Client of type[PSCustomObject]
:which is correctly translated into JSON by the line
Now suppose that $Client is defined as being an array
[PSCustomObject[]]
. The conversion to JSON is done in the same way, but the JSON output changes depending on whether $Client is an array of one or multiple elements, because the parameter type declaration does not force an array context when the array contains a single element.openapi-generator version
Up to 7.5
OpenAPI declaration file content or url
The issue was first noticed using a PowerShell client generated from Connectwise PSA API specs. The specs are too complex (over 4K endpoints) to be used for an example.
Generation Details
openapi-generator generate --input-spec SPECS/2022.2/All.json --generator-name powershell --output PSClient --additional-properties=packageName=CWPSA,packageVersion=2022.2,apiNamePrefix=PSA --skip-validate-spec
Steps to reproduce
Reproducing the issue requires changing
AnotherFakeApi
specs, but the same behaviour can be seen from the console:Related issues/PRs
None found
Suggest a fix
The optimal solution would be to force an array context when the parameter is declared as being an array, as in:
I would not know what changes to the mustache files are required to obtain this result.
The text was updated successfully, but these errors were encountered: