Skip to content

Commit 102ede6

Browse files
committed
Patch for OpenAPI registration Error
Add explicit OpenAPI component registration plumbing so handlers can register referenced schemas and avoid dangling $ref entries. Introduce a register_components(...) hook on OperationModifier/ResponseModifier (with defaults) and implement it for body/response/validation extractors (Json, ValidatedJson, AsyncValidatedJson, Query, Created, WithStatus, ApiError, etc.). Thread a component_registrar fn through Route and MethodRouter (collecting per-method registrars) and invoke registrars when routes and nested routers are added to RustApi, and when individual routes are registered. Update OpenApiSpec default jsonSchemaDialect to the OAS 3.1 dialect URL. Tests updated to assert the dialect and to add a snapshot test that verifies manually-registered routes populate components. Also update CHANGELOG and RELEASES with the new release notes describing these changes.
1 parent c8aa739 commit 102ede6

File tree

12 files changed

+569
-29
lines changed

12 files changed

+569
-29
lines changed

CHANGELOG.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,70 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.1.410] - 2026-03-09
11+
12+
### Added
13+
14+
#### Production Defaults Preset (`rustapi-core`)
15+
- **One-call production baseline**: `.production_defaults("service-name")` enables `RequestIdLayer`, `TracingLayer`, and built-in health probes in a single builder call.
16+
- `ProductionDefaultsConfig` for granular control: `.version()`, `.tracing_level()`, `.request_id()`, `.tracing()`, `.health_endpoints()`.
17+
- `.production_defaults_with_config(config)` for full customization.
18+
19+
#### Health Check System (`rustapi-core`)
20+
- **Built-in `/health`, `/ready`, `/live` endpoints** — Kubernetes-compatible probes out of the box.
21+
- `HealthCheckBuilder` with `.add_check(name, async_fn)` for custom dependency checks.
22+
- `HealthStatus` enum: `Healthy`, `Unhealthy { reason }`, `Degraded { reason }`.
23+
- `HealthCheckResult` response with per-component status, version, and ISO 8601 timestamp.
24+
- `HealthEndpointConfig` for custom endpoint paths.
25+
- `/health` returns aggregated status (200/503), `/ready` checks dependencies, `/live` is a lightweight process probe.
26+
- `.health_endpoints()`, `.health_endpoints_with_config()`, `.with_health_check()` on `RustApi` builder.
27+
- All types re-exported in `rustapi-rs` prelude.
28+
29+
#### Session Management (`rustapi-extras`)
30+
- **Cookie-backed session middleware** with `SessionLayer` and `Session` extractor.
31+
- `SessionConfig` with `.cookie_name()`, `.cookie_path()`, `.cookie_domain()`, `.secure()`, `.http_only()`, `.same_site()`, `.ttl()`, `.rolling()`.
32+
- `MemorySessionStore` — in-memory store with `.len()` and `.is_empty()`.
33+
- `SessionStore` trait for custom backends (`load`, `save`, `delete`).
34+
- `Session` extractor methods: `.get()`, `.insert()`, `.contains()`, `.destroy()`, `.cycle_id()`, `.id()`.
35+
- `SessionRecord` with expiration tracking (`.is_expired()`, `.ttl_seconds()`).
36+
- Secure defaults: `HttpOnly`, `Secure`, `SameSite=Lax`, 24h TTL, rolling refresh.
37+
- Re-exported under `rustapi_rs::extras::session`.
38+
39+
#### Rate Limiting Strategies (`rustapi-extras`)
40+
- **Three strategies** via `RateLimitStrategy`: `FixedWindow`, `SlidingWindow`, `TokenBucket`.
41+
- Per-IP tracking with `DashMap`.
42+
- Response headers: `X-RateLimit-Remaining`, `Retry-After`.
43+
- Returns 429 Too Many Requests on limit exceeded.
44+
- Re-exported under `rustapi_rs::extras::rate_limit`.
45+
46+
#### CLI: New Commands (`cargo-rustapi`)
47+
- **`cargo rustapi bench`** — run benchmark workflow with `--warmup` and `--iterations` options.
48+
- **`cargo rustapi observability`** — surface observability assets and check production readiness (`--check` for strict mode).
49+
- **`cargo rustapi doctor`** — expanded environment health checks with `--strict` mode.
50+
51+
#### Multipart Streaming Enhancements (`rustapi-core`)
52+
- `StreamingMultipartField`: `.bytes_read()` progress tracking, `.save_to()`, `.save_as()`, `.into_uploaded_file()`.
53+
- `StreamingMultipart` / `Multipart`: `.field_count()` method.
54+
55+
#### New Examples (`rustapi-rs`)
56+
- `auth_api.rs` — session-based authentication (login/logout/refresh/me).
57+
- `full_crud_api.rs` — complete CRUD API with stateful `Arc<RwLock<HashMap>>`.
58+
- `jobs_api.rs` — background job queue with `InMemoryBackend`.
59+
- `streaming_api.rs` — server-sent events (SSE) streaming.
60+
61+
#### Performance Snapshot (`rustapi-core`)
62+
- `crates/rustapi-core/examples/perf_snapshot.rs` — synthetic in-process benchmark measuring ultra fast, fast, and full execution paths.
63+
64+
### Changed
65+
- `scripts/bench.ps1` updated to run both `cargo bench --workspace` and the perf snapshot example.
66+
- Facade (`rustapi-rs`) now re-exports `ProductionDefaultsConfig`, health types, session module, and rate limit module.
67+
68+
### Documentation
69+
- **10+ new cookbook recipes**: session auth, observability, error handling, custom extractors, middleware debugging, Axum migration, Actix migration, OIDC/OAuth2 production, macro attributes reference, deployment expansion.
70+
- `docs/PERFORMANCE_BENCHMARKS.md` expanded with perf snapshot methodology.
71+
- `docs/GETTING_STARTED.md` updated.
72+
- `crates/rustapi-rs/examples/README.md` — example catalog and descriptions.
73+
1074
## [0.1.397] - 2026-02-26
1175

1276
### Added

Cargo.lock

Lines changed: 13 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ members = [
1717
]
1818

1919
[workspace.package]
20-
version = "0.1.410"
20+
version = "0.1.412"
2121
edition = "2021"
2222
authors = ["RustAPI Contributors, Tuntii"]
2323
license = "MIT OR Apache-2.0"
@@ -140,3 +140,4 @@ strip = false
140140

141141

142142

143+

0 commit comments

Comments
 (0)