https://github.com/valadas/webapitoopenapireflector
A dotnet tool that can use reflection to generate OpenApi from .NetFramework assemblies
https://github.com/valadas/webapitoopenapireflector
Last synced: 2 months ago
JSON representation
A dotnet tool that can use reflection to generate OpenApi from .NetFramework assemblies
- Host: GitHub
- URL: https://github.com/valadas/webapitoopenapireflector
- Owner: valadas
- License: mit
- Created: 2024-01-08T08:30:38.000Z (over 2 years ago)
- Default Branch: develop
- Last Pushed: 2026-03-10T22:47:34.000Z (3 months ago)
- Last Synced: 2026-03-11T00:06:02.812Z (3 months ago)
- Language: C#
- Size: 86.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/WebApiToOpenApiReflector)
# WebApiToOpenApiReflector
A dotnet tool that can use reflection to generate OpenApi from .NetFramework assemblies
## Intent of this tool
This tool is to help with the recent removal of the `webapi2openapi` command from NSwag.
This tool does not replace NSwag, but is a pre-processor utility to
generate the swagger specifications using reflection on .NET Framework assemblies.
This tool is not recommended for .NET Core assemblies, as the NSwag CLI already supports it.
## Installation
```bash
dotnet tool install -g WebApiToOpenApiReflector
```
## Usage
```
Usage: WebApiToOpenApiReflector [--controller-names ...] [--default-url-template ] [--add-missing-path-parameters] [--default-response-reference-type-null-handling ] [--generate-original-parameter-names=] [--title ] [--description ] [--info-version ] [--document-template ] [--output ] [--help] [--version] assembly-paths0 ... assembly-pathsN
Generates a Swagger/OpenAPI specification for a controller or controllers contained in a .NET Web API assembly.
Arguments:
0: assembly-paths The assembly or assemblies to process. (Required)
Options:
-c, --controller-names ... Can optionally be used to limit the results to some controllers.
-u, --default-url-template The Web API default URL template: (default for Web API: 'api/{controller}/{id}'; (default for MVC: '{controller}/{action}/{id?}'). (Default: api/{controller}/{id})
-a, --add-missing-path-parameters If true, adds missing path parameters which are missing in the action method.
-n, --default-response-reference-type-null-handling Specifies the default null handling for reference types when no nullability information is available. NotNull (default) or Null. (Default: Null) (Allowed values: Null, NotNull)
-g, --generate-original-parameter-names= Generate x-originalName properties when parameter name is different in .NET and HTTP. (Default: True)
-t, --title Specifies the title of the Swagger specification, ignored when the document template is provided.
-d, --description Specifies the description of the Swagger specification, ignored when the document template is provided.
-v, --info-version Specifies the version of the Swagger specification (default: 1.0.0). (Default: 1.0.0)
--document-template Specifies the Swagger document template (may be a path or JSON, default: none).
-o, --output The path to the file to write the specifications to. (Default: swagger.json)
-h, --help Show help message
--version Show version
```