- 📃 Generate payload representations from your AsyncAPI document (including Protobuf, RAML, OpenAPI Schema)
- 📊 Customize the generators output to your hearts desire
- 💫 Regenerate once the input changes
- 👀 Integrate it into any project (such as Next.JS, etc.)
- 💅 Create custom generators (read more)
- 🗄️ Protocol agnostic generator (docs)
- ⭐ And much more...
The Codegen Project is a generator that is built to live along side your projects to help you save time in the development phase, ensuring you spend as much time on the business logic as possible. It works by using your configuration file to know what it needs to generate.
Each input has different generates and all of them can be customized, or you can build your own generator right in the configuration file.
export default {
inputType: 'asyncapi',
inputPath: './asyncapi.json',
language: 'typescript',
generators: [
{
preset: 'payloads',
outputPath: './src/payloads',
serializationType: 'json',
},
...
]
};
In this example, the generator will read the AsyncAPI document located in same directory as the configuration file, and generate TypeScript models for all the payload including code to serialize the models to JSON.
Its simple, install the CLI into your project or machine, setup the Codegen configuration file to include all the code your heart desire, customize it, and generate it at build time or whenever you feel like it.
Installing the CLI can be done inside a project or within your system.
Package manager | MacOS x64 | MacOS arm64 | Windows x64 | Windows x32 | Linux (Debian) | Linux (Others) |
---|---|---|---|---|---|---|
You can find all the possible commands in the usage documentation.
Add a configuration file, either manually or through the CLI;
codegen init
With your configuration file in hand, time to generate the code and use it! This can be done manually or integrate into your build process. Checkout all the examples for inspiration how to do it.
codegen generate
Besides the milestones, we have certain goals that we want to reach for various reasons;
- ⭐ Reach 50 stars - So we can publish the CLI on Brew and Chocolatey
- 📃 3 Published resources (blog post, video, etc)
People who have been so kind to write or talk about The Codegen Project;
- Write one!
We have made quite a comprehensive contribution guide to give you a lending hand in how the project is structured and how to contribute to it.
Thanks go out to these wonderful people (emoji key):
Jonas Lagoni 🐛 💻 📖 🤔 🚧 💬 |
Lagoni 🐛 🚧 📆 👀 |
This project follows the all-contributors specification. Contributions of any kind are welcome!