Skip to content
This repository has been archived by the owner on Nov 14, 2021. It is now read-only.

Generate PowerShell module from OpenAPI spec using Swagger Codegen

License

Notifications You must be signed in to change notification settings

beatcracker/POSH-swagger-codegen

Repository files navigation

A word of warning: this repo is probably rendered obsolete by the release of PSSwagger.


Generate PowerShell module from OpenAPI spec using Swagger Codegen.

Promo Tweet

Swagger Codegen 2.2.3 aims to have PowerShell module generator. Until it's released, you can build latest version of Swagger Codegen yourself, which already has beta-quality PowerShell support and use it to generate PowerShell module.

Info

Details

This repository contains set of scripts that will:

Usage

Generated module will be available in the ApiName\PowerShell\src\IO.Swagger directory.

To import it use: Import-Module -name .\ApiName\PowerShell\src\IO.Swagger

Build XKCD module

If run without arguments, Build.ps1 script will install all prerequisites, build Swagger Codegen and generate XKCD module using this spec: https://github.com/APIs-guru/openapi-directory/tree/master/APIs/xkcd.com/1.0.0

  • Run PowerShell/PowerShell ISE as admin
  • Run Build.ps1 script

Build custom module

If you already run Build.ps1 script and have all prerequisites, you can build custom PowerShell modules.

By API name

Build instagram.com module by API name

.\Build.ps1 -ApiName instagram.com

From custom file

Build instagram.com module from file

.\Build.ps1 -ApiName instagram.com -InFile .\path\to\spec\swagger.yml

Update Swagger Codegen

To pull latest changes and rebuild Swagger Codegen, add UpdateCodegen switch.

.\Build.ps1 -UpdateCodegen

Releases

No releases published

Packages

No packages published