22
33# Zen Generator 🚀
44
5+ ![ PyPI version] ( https://badge.fury.io/py/zen-generator.svg )] ( https://badge.fury.io/py/zen-generator )
6+ [ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-yellow.svg )] ( https://opensource.org/licenses/MIT )
7+ [ ![ Python Version] ( https://img.shields.io/badge/python-3.10+-blue.svg )] ( https://www.python.org/downloads/release/python-3100/ )
8+ [ ![ Downloads] ( https://pepy.tech/badge/zen-generator )] ( https://pepy.tech/project/zen-generator )
9+ [ ![ Code Style: Ruff] ( https://img.shields.io/badge/code%20style-ruff-000000.svg )] ( https://github.com/charliermarsh/ruff )
10+
11+
512A bidirectional Python code generator that converts between AsyncAPI 3.0 specifications and Python code (pure Python or FastAPI implementations).
613
714## Features ✨
815
9- - Bidirectional conversion between [ AsyncAPI 3.0] ( https://www.asyncapi.com/docs/reference/specification/v3.0.0 ) and Python code
10- - Generate Python code from AsyncAPI 3.0 specifications:
11- - Pure Python implementations with type hints
12- - FastAPI endpoints with Pydantic models
13- - Generate AsyncAPI 3.0 specifications from Python code
14- - Automatic type inference and mapping
15- - Support for both async and sync functions
16+ - 🔄 Bidirectional conversion between [ AsyncAPI 3.0] ( https://www.asyncapi.com/docs/reference/specification/v3.0.0 ) and Python code
17+ - 🐍 Generate Python code from AsyncAPI 3.0 specifications:
18+ - 🐍 Pure Python implementations with type hints
19+ - ⚡ FastAPI endpoints with Pydantic models
20+ - 📄 Generate AsyncAPI 3.0 specifications from Python code
21+ - 🧠 Automatic type inference and mapping
22+ - ⚡ Support for both async and sync functions
1623
1724## Installation 📦
1825
1926``` bash
2027pip install zen-generator
2128```
29+
2230> [ !IMPORTANT]
23- > Currently, only model and function definitions in the ` components ` block of the AsyncAPI file are supported.
31+ > Currently, only model and function definitions in the ` components ` block of the AsyncAPI file are supported.
2432> Inline definitions are not supported.
2533
2634> [ !NOTE]
27- > This code snippet includes a custom definition for > declaring required parameters in model/function > definitions.
35+ > This code snippet includes a custom definition for declaring required parameters in model/function definitions.
2836> Specifically, the ` required ` keyword is used to specify mandatory fields, as shown below:
2937
3038``` yaml
@@ -33,8 +41,6 @@ required:
3341` ` `
3442> This ensures that the ` user_id` parameter is always provided when the model or function is utilized.
3543
36-
37-
3844# # Quick Start 🏃
3945
4046Convert between AsyncAPI 3.0 specifications and Python code :
@@ -124,7 +130,6 @@ $ fastapi [OPTIONS]
124130
125131# # Generated Code Examples 📝
126132
127-
128133# ## Pure Python Implementation (models.py)
129134
130135` ` ` python
@@ -153,7 +158,7 @@ def get_user(user_id: int) -> UserModel:
153158# ## FastAPI Implementation (models.py)
154159
155160` ` ` python
156- from __future__ import annotations
161+ from __future__annotations
157162
158163from pydantic import BaseModel
159164
@@ -166,7 +171,7 @@ class UserModel(BaseModel):
166171# ## FastAPI Implementation (functions.py)
167172
168173` ` ` python
169- from __future__ import annotations
174+ from __future__annotations
170175
171176from fastapi import FastAPI
172177
@@ -179,7 +184,6 @@ async def get_user(user_id: int) -> UserModel:
179184 ...
180185` ` `
181186
182-
183187# ## Asyncapi documentation (asyncapi.yaml)
184188
185189` ` ` yaml
0 commit comments