Using OpenAPI Generator to generate PowerShell API clients

We’ve refactored the PowerShell client generator in OpenAPI Generator (GitHub - OpenAPITools/openapi-generator: OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)) to generate PowerShell SDKs with ease. To generate the PowerShell client given an OpenAPI/Swagger specification file (GitHub - OAI/OpenAPI-Specification: The OpenAPI Specification Repository), please follow 3 simple steps below:

  1. Download the Java JAR: https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.3.0-SNAPSHOT/openapi-generator-cli-4.3.0-20200319.082058-209.jar

  2. Rename the JAR as “openapi-generator-cli.jar”

  3. Run the following command to generate a PowerShell API client for the Petstore API: https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml

Mac/Linux:

$ java -jar openapi-generator-cli.jar generate -g powershell-experimental -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o /var/tmp/powershell-experimental/

Windows:

$ java -jar openapi-generator-cli.jar generate -g powershell-experimental -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o C:\tmp\powershell-experimental

If you’ve any feedback or question, please let us know via Sign in to GitHub · GitHub.

The new generator will be included in the upcoming v4.3.0 stable release.

Ref: [Powershell] refactor the client generator by wing328 · Pull Request #5629 · OpenAPITools/openapi-generator · GitHub