Code Generator Toolkit for C# and TypeScript
$ dotnet add package BootGen
Customizable code generator library for rapid application prototyping.
See a live demo at bootgen.com!
C#, TypeScript, Swagger (OAS3)
From a set of sample data given JSON format BootGen will determine a data model. Using this data model and a set of Scriban templates it will generate a server and a client application.
An example set of Scriban templates can be found here.
{
"users": [
{
"userName": "Test User",
"email": "example@email.com",
"tasks": [
//timestamps
{
"title": "Task Title",
"description": "Task description",
"isOpen": true,
"dueDate": "2021-12-30T12:00:05",
"estimatedHours": 1.5,
"priority": 1,
"tags": [
//manyToMany
{
"name": "important",
"color": "red"
}
]
}
]
}
]
}
Although comments are non-standard feature in JSON, many JSON processing libraries support it. We use them as annotations. Annotations can be placed at the beginning of arrays. Possible annotations:
timestamps: Adds a Created and an Updated timestamp property to the class.manyToMany: Declears that the given relation is a Many-To-Many relation, as opposed to the default One-To-Many relation.class:[name]: Substitute [name] with the intended name of the class. Example:{
"users": [
{
"userName": "Test User",
"email": "example@email.com",
"friends": [
//class:user
//manyToMany
{
"userName": "Test User 2",
"email": "example2@email.com"
}
]
}
]
}