Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JiarongGu/BanBrick.TypeScript.CodeGenerator
C# to TypeScript Code Generator Libarary for WebApi
https://github.com/JiarongGu/BanBrick.TypeScript.CodeGenerator
Last synced: about 2 months ago
JSON representation
C# to TypeScript Code Generator Libarary for WebApi
- Host: GitHub
- URL: https://github.com/JiarongGu/BanBrick.TypeScript.CodeGenerator
- Owner: JiarongGu
- License: mit
- Created: 2018-09-29T06:55:44.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-01T06:29:39.000Z (almost 5 years ago)
- Last Synced: 2024-07-11T08:40:08.071Z (3 months ago)
- Language: C#
- Size: 159 KB
- Stars: 12
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BanBrick.TypeScript.CodeGenerator
C# to TypeScript Code Generator Libarary for WebApi Request/Response Model## Getting Started
https://www.nuget.org/packages/BanBrick.TypeScript.CodeGenerator/
PM > Install-Package BanBrick.TypeScript.CodeGenerator -Version 1.2.3
### Prerequisites
```
.net standard
```## How To Use
#### Generate typescript code from list of types.
```
using BanBrick.TypeScript.CodeGenerator;var types = new List() { type1, type2, type3, ...};
var codeProcesser = new TypeScriptProcesser();
var code = codeProcesser.GenerateTypeScript(types);
```#### Generate typescript types from annotation configs.
current support typescript enum, interface, class, count generation using annotation
#### Output type inherit use annotation
```
using BanBrick.TypeScript.CodeGenerator.Annotation;[TypeScriptObject(Type = TypeScriptObjectType.Interface, Inherit = true)]
public class Request
{
public RequestDetail Details { get; set; }
}public class RequestDetail
{
public string Name { get; set; }
}
```this will output both Request and RequestDetail in Interface format of Typescript
## Roadmap
- [x] Generate const value output instead of class
- [x] Support for Interface generation
- [x] Auto-Indenting to multiple-layered tree structure values
- [x] Support Auto-Resolve for Type Name Duplication
- [x] Support for Inherit of Generation Types
- [x] Auto-Indenting to multiple-layered tree structure types
- [ ] Support for external config instead of only annotation
- [ ] Support for Generictypes generation## Code Generation Workflow
![alt text](/Code%20Generation%20Work%20Flow%20v3.png)