Apstory.TypescriptCodeGen.Swagger
1.1.0.33
Prefix Reserved
dotnet tool install --global Apstory.TypescriptCodeGen.Swagger --version 1.1.0.33
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local Apstory.TypescriptCodeGen.Swagger --version 1.1.0.33
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Apstory.TypescriptCodeGen.Swagger&version=1.1.0.33
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package Apstory.TypescriptCodeGen.Swagger --version 1.1.0.33
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Apstory Typescript Code Generator
Typescript code generator, generating typescript models and api service calls from a swagger.json endpoint
Usage
dotnet Apstory.TypescriptCodeGen.Swagger.dll -u http://localhost -v 1 -o c:\project\gen
Command Options
-u The base url of the swagger api endpoint -v The version of the swagger api endpoint -o The directory to write the generated models and services to
Prerequisites
Swaggers OperationId value must be populated in the JSON as its used as the method name in the typescript api service
Here is an example of how to achieve this in c#
public class AddActionNameAsOperationIdOperationFilter : IOperationFilter
{
public void Apply(OpenApiOperation operation, OperationFilterContext context)
{
if (operation.Parameters == null) operation.Parameters = new List<OpenApiParameter>();
var descriptor = context.ApiDescription.ActionDescriptor as ControllerActionDescriptor;
if (descriptor != null)
operation.OperationId = descriptor.ActionName;
}
}
Then in program.cs, add in the OperationFilter to your swagger documentation generation.
builder.Services.AddSwaggerGen(c =>
{
c.OperationFilter<AddActionNameAsOperationIdOperationFilter>();
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.