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": "[email protected]",
"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"
}
]
}
]
}
]
}
- Property and class names should be camelCase. Casing will be set in the generated code according to the type of file generated. In C# PascalCase will be used, in TypeScript property names will remain camelCase.
- Array names should be plural nouns, everything else should be in singular form. In the generated code the fitting plural or singular form of names will be used.
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 aCreated
and anUpdated
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": "[email protected]",
"friends": [
//class:user
//manyToMany
{
"userName": "Test User 2",
"email": "[email protected]"
}
]
}
]
}