https://github.com/wndrr/swaggerclientpowershellgenerator
This is a small powershell wrapper to make generating a C# client from a web-hosted swagger doc easier
https://github.com/wndrr/swaggerclientpowershellgenerator
csharp swagger swagger-codegen
Last synced: 8 months ago
JSON representation
This is a small powershell wrapper to make generating a C# client from a web-hosted swagger doc easier
- Host: GitHub
- URL: https://github.com/wndrr/swaggerclientpowershellgenerator
- Owner: Wndrr
- License: wtfpl
- Created: 2019-09-11T12:20:17.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-11T12:45:12.000Z (about 6 years ago)
- Last Synced: 2025-01-03T06:11:46.743Z (9 months ago)
- Topics: csharp, swagger, swagger-codegen
- Language: PowerShell
- Size: 12.3 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SwaggerClientPowershellGenerator
This is a small powershell wrapper to make generating a C# client from a web-hosted swagger doc easierThis tool is simple to use, but very restrictive. It is a wrapper aroung the original java swagger-codegen utility meant to hide away some of the boilerplate necessary to run it. But, since I'm lazy, I only added the functionality that I needed to use right away ... Pull requests are always welcome.
## What it does
This utility script requires three parameters:
- The path to the output folder for the generated swagger client
- The URL to the web-hosted swagger document
- The URL to the swagger-codegene java utilityThe first and third parameters can be specified as either absolute or relative file path and must represent the full path, including location and name of the file.
Running this tool will create a complete project, `.csproj` included.
## Usage
To change the name of the generated project, update the `config.json` file.
``` Powershell
// Include generator class
. "absolute/path/to/SwaggerClientGenerator.ps1"
// Instanciate utility classe
$SwaggerGenerator = [SwaggerGenerator]::new("path/to/output/folder", "https://url-to-swagger.doc", "path/to/swagger/codegen/tool");
// Run generator
$SwaggerGenerator.Generate();
```
## Example
You can find a pre-build execution script names `ExampleExecution.ps1`. In this script you will only need to change the path used to include the `SwaggerClientGenerator.ps1` script because I couldn't be bother to findout how to include a script through a relative path.