Expand description
Vespera macro implementation crate.
This crate contains all the proc-macros for Vespera:
#[vespera::route(...)]- Mark a function as a route handler#[derive(Schema)]- Register a type forOpenAPIschema generationschema!(...)- GetOpenAPIschema at compile timevespera!(...)- Generate Axum router withOpenAPIexport_app!(...)- Export router for merging
§Architecture
┌─────────────────────────────────────────────────────────────────┐
│ Compile-time (vespera! macro) │
├─────────────────────────────────────────────────────────────────┤
│ 1. Scan src/routes/ for .rs files [collector] │
│ 2. Parse #[route] attributes [args, route] │
│ 3. Extract handler signatures [parser] │
│ 4. Convert Rust types → JSON Schema [parser/schema] │
│ 5. Build OpenAPI document [openapi_gen] │
│ 6. Write openapi.json to disk [vespera_impl] │
│ 7. Generate Axum Router TokenStream [router_codegen] │
│ 8. Inject Swagger/ReDoc HTML routes [router_codegen] │
└─────────────────────────────────────────────────────────────────┘
# Module Organization
- `args` - Parse `#[route(...)]` attribute arguments
- `collector` - Filesystem scanning and route discovery
- `error` - Unified error handling
- `http` - HTTP method constants and validation
- `macro_storage` - Shared per-crate storage for `#[route]` / `#[cron]` metadata
- `metadata` - Type definitions for collected metadata
- `method` - HTTP method token stream generation
- `openapi_generator` - OpenAPI spec assembly
- `parser` - Type extraction and schema generation
- `route` - Route information structures
- `route_impl` - Route attribute macro implementation
- `router_codegen` - Router and macro input parsing
- `schema_impl` - Schema derive macro implementation
- `schema_macro` - `schema_type!` macro implementation
- `vespera_impl` - Main macro orchestrationMacros§
- export_
app - Export a vespera app as a reusable component.
- schema
- Generate an
OpenAPISchema from a type with optional field filtering. - schema_
type - Generate a new struct type derived from an existing type with field filtering.
- vespera