-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Description
When using codegen to output PowerShell code based on [X] OpenAPI specification parameters of datatype are not declared in the proper PowerShell syntax. See this attached picture as an example -->
Swagger-codegen
- v2.2.3 downloaded from https://oss.sonatype.org/content/repositories/releases/io/swagger/swagger-codegen-cli/2.2.3/
- I execute it on a Win7 SP1 computer with critical patches up until last month.
Swagger declaration file content or url
Gist containing the OctopusDeploy OpenAPI implementation json file:
Command line used for generation
java -jar swagger-codegen-cli-2.2.3.jar generate -i ./octopusDeploy.json -o outputfolderName -c config.json
config.json content
{ "packageName": "Danske.Spil.Octopus.Deploy.API" }
Steps to reproduce
- Execute the cmdline written under "Swagger declaration file content or url" above.
- Open the folder containing the generated code in any IDE
- Open for example the file named: "New-AccountResource.ps1". It is located underneath
DRIVE:\PATH_TO_OUTPUT_FOLDER\src\IO.Swagger\Model\
Related issues/PRs
Haven't found one. Did a search both in the closed and the open issues.
Suggest a fix/enhancement
As the Dictionary and Hashtable types are almost similar it could be an option to declare a dictionary type as [Hashtable]. So for an PowerShell function parameter it would look like this:
function New-AccountResource { [CmdletBinding()] Param ( [System.Nullable[HashTable]] ${Links} ) ..............
Additional note
- Why is the API and Model parts of an OpenAPI implementing API being generated into a folder named "IO.Swagger"?
When the "Private" folder and .psm1 file are generated under a folder respecting the > packageName specified inside the config.json file? See this attached picture as an example:
- Also, why is the parameter type being declared as
[System.Nullable]
?
Thank you and I'm looking forward to hear from you. Let me know if there is anything I can elaborate further upon. Have a great day/evening (where ever you are).