Is there any approaches to auto-generate OpenAPI/Swagger metadata for WebApi methods or maybe even to generate client typescript models?
I found Swashbuckle and Swagger to JS & Typescript Codegen to be nice but I wonder to find out any other libs.
It would be perfect if you can give pros and cons of each approach.
You can also check out NSwag, a Swagger toolchain for .NET and TypeScript.
The tool generates Swagger specs from existing Web API controllers and client code based on these Swagger specs. You can generate TypeScript client code for JQuery with Callbacks or Promises, AngularJS or Angular2. The generated DTOs (request/response types) can either be interfaces or classes (with date conversion, lower camel casing, etc..)
The project can be used with a simple to use desktop GUI, build scripts or a command line tool.
Disclaimer: I'm one of the contributors of NSwag.
Please try Swagger-Codegen, which is a free and open-source code generator to generate REST API clients (e.g. C#, TypeScript, Javascript and more) or server stubs (ASP.NET5) given an OpenAPI/Swagger spec.
Here is a good starting point: https://github.com/swagger-api/swagger-codegen#getting-started
For typescript
, Swagger Codegen supports different libraries: typescript-node
, typescript-angular
, typescript-angular2
and typescript-fetch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With