You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+69-88Lines changed: 69 additions & 88 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,13 @@ cdd-rust: OpenAPI ↔ Rust
6
6
7
7
**Compiler Driven Development (CDD)** for Rust.
8
8
9
-
**cdd-rust**bridges the gap between your **Database**, **Rust Code**, and **OpenAPI Specifications**. Unlike traditional generators that produce untouchable code in a "generated" folder, `cdd-rust` uses advanced AST parsing to surgically patch your *existing* source files, strictly Typed handlers, and integration tests.
9
+
**cdd-rust**creates a symbiotic link between your **Database**, **Rust Code**, and **OpenAPI Specifications**. Unlike traditional generators that overwrite files or hide code in "generated" directories, `cdd-rust` uses advanced AST parsing (`ra_ap_syntax`) to surgically patch your *existing* source files, strictly typed handlers, and integration tests.
10
10
11
-
## ⚡️ The CDD Loop
11
+
It supports two distinct workflows:
12
+
1.**Scaffold | Patch (OpenAPI ➔ Rust):** Generate/update Actix handlers, routes, and Diesel models from OpenAPI.
13
+
2.**Reflect & Sync (Rust ➔ OpenAPI):** Generate OpenAPI specifications from your actual source code.
12
14
13
-
Automate the repetitive parts of building robust web services with **Actix Web**, **Diesel**, and **Postgres**.
15
+
## ⚡️ The CDD Loop
14
16
15
17
```mermaid
16
18
%%{init: {
@@ -25,95 +27,83 @@ Automate the repetitive parts of building robust web services with **Actix Web**
Diesel("<strong>Diesel Model (Rust)</strong><br/>#[derive(ToSchema)]<br/>struct User {<br/> id: Uuid,<br/> email: String<br/>}"):::green
Stop manually writing repetitive handler signatures. `cdd-rust` reads your spec and generates strictly typed code.
71
+
***Handler Scaffolding:** Transforms OpenAPI paths into `async fn` signatures with correct extractors:
72
+
* Path variables ➔ `web::Path<Uuid>`
73
+
* Query strings ➔ `web::Query<Value>`
74
+
* Request bodies ➔ `web::Json<T>`
75
+
***Route Registration:** Surgically injects `cfg.service(...)` calls into your `routes.rs` configuration using AST analysis, preserving existing logic.
76
+
***Non-Destructive Patching:** Uses [`ra_ap_syntax`](https://docs.rs/ra_ap_syntax/) (part of official [rust-lang/rust-analyzer](https://github.com/rust-lang/rust-analyzer)) to edit files safely. It respects your manual comments and formatting.
***`core/`**: The brain of the operation. Contains AST parsers (`ra_ap_syntax`), OpenAPI parsers, and code patching logic. It performs surgical updates on Rust source files.
130
-
***`cli/`**: The automation runner. Orchestrates `diesel`, `dsync`, and the core library to execute pipelines.
131
-
***`web/`**: The reference implementation. A standard Actix Web project that demonstrates how generated models and tests live alongside hand-written logic.
119
+
***`core/`**: The engine. Contains AST parsers, OpenAPI parsers, and the diff/patch logic.
0 commit comments