Skip to content

v0.1.397

Choose a tag to compare

@Tuntii Tuntii released this 26 Feb 08:53
· 55 commits to main since this release
Immutable release. Only release title and notes can be modified.

[0.1.397] - 2026-02-26

Added

Compile-Time Extractor Safety (rustapi-macros)

  • Body-consuming extractor ordering enforced at compile time: Json<T>, Body, ValidatedJson<T> must now be the last handler parameter — otherwise you get a clear compiler error instead of a silent runtime failure.
  • Descriptive error messages: "Body-consuming extractors must be the last parameter".
  • Detects multiple body-consuming extractors in the same handler.

Typed Error Responses — OpenAPI Integration (rustapi-macros, rustapi-core)

  • New #[errors(404 = "Not found", 403 = "Forbidden")] attribute macro for route handlers.
  • Error types are automatically reflected in the OpenAPI spec with ErrorSchema references.
  • Route::error_response() builder method for programmatic error response registration.
  • Swagger UI now displays all possible error responses per endpoint.

Pagination & HATEOAS Helpers (rustapi-core)

  • Paginate extractor: ?page=2&per_page=20 with sensible defaults (page=1, per_page=20, max=100).
  • Paginated<T> response wrapper: JSON body with items/meta/_links, RFC 8288 Link header, X-Total-Count & X-Total-Pages headers.
  • CursorPaginate extractor: ?cursor=abc&limit=20 for cursor-based pagination.
  • CursorPaginated<T> response wrapper: items + next_cursor + has_more.
  • Helper methods: offset(), limit(), paginate(), after(), is_first_page().
  • All types re-exported in the rustapi-rs prelude.

Built-in Caching Layer (rustapi-extras)

  • Full rewrite of the caching system with production-grade features:
    • In-memory response cache with LRU eviction and configurable max_entries (default: 10,000).
    • ETag generation via FNV-1a hash + automatic If-None-Match → 304 Not Modified.
    • Cache-Control header awareness (no-cache, no-store).
    • Vary-by-header cache key strategy.
    • CacheHandle for programmatic invalidation (by path prefix, exact key, or clear all).
    • CacheBuilder for ergonomic middleware configuration.

Event System & Lifecycle Hooks (rustapi-core)

  • EventBus: In-process pub/sub with sync and async handlers.
    • on() for sync handlers, on_async() for async handlers.
    • emit() (fire-and-forget) and emit_await() (wait for all handlers).
    • handler_count() and topics() introspection.
  • Lifecycle hooks on RustApi builder:
    • .on_start(async { ... }) — runs before the server starts accepting connections.
    • .on_shutdown(async { ... }) — runs on graceful shutdown.
    • Integrated into both run() and run_with_shutdown().
  • EventBus re-exported in the rustapi-rs prelude.

Native Hot Reload / Watch Mode (cargo-rustapi, rustapi-core)

  • Complete rewrite of cargo rustapi watch using notify + notify-debouncer-mini — no more cargo-watch dependency.
    • 300ms debounce, configurable extension filter, smart ignore paths.
    • Build-before-restart: only restarts the server if cargo build succeeds.
    • Graceful process shutdown (kill + 5s timeout), crash detection with "watching for changes" recovery.
  • .hot_reload(true) builder API on RustApi — prints a dev-mode banner with watcher hints.
  • cargo rustapi run --watch / --reload / --hot delegates to the native watcher.

gRPC Support Published (rustapi-grpc)

  • First crates.io release of rustapi-grpc v0.1.397.
  • run_rustapi_and_grpc() for dual HTTP + gRPC server execution.
  • Re-exports tonic and prost for ergonomic proto service integration.
  • protocol-grpc feature flag in rustapi-rs.

What's Changed

  • fix: address review feedback - validate pagination size and update doc status by @Copilot in #110
  • docs: sync to v0.1.335, add pagination recipe, and improve learning path by @Tuntii in #109
  • docs: enhance learning path and fix cookbook recipes by @Tuntii in #112
  • Add optional rustapi-grpc crate (tonic/prost) by @Tuntii in #118
  • docs: Add Background Jobs recipe and update Learning Path by @Tuntii in #120
  • docs: Enterprise Learning Path & Testing Recipe by @Tuntii in #121
  • core: stabilize facade API surface, feature taxonomy, and public-api CI gate by @Tuntii in #122
  • docs: Add Phase 5 (Specialized Skills) and recipes for gRPC, SSR, and AI by @Tuntii in #123
  • docs: Fix SSR recipe and update cookbook index by @Tuntii in #124
  • docs: improve cookbook and learning path by @Tuntii in #125
  • docs: Cookbook and Learning Path Improvements by @Tuntii in #126
  • docs: continuous improvement and accuracy fixes by @Tuntii in #129
  • docs: cookbook expansion and learning path improvements by @Tuntii in #132
  • Fix review feedback: deduplication, pagination validation, lifecycle error handling, cache correctness by @Copilot in #140
  • Add lifecycle hooks, pagination, and cache by @Tuntii in #139

Full Changelog: v0.1.335...v0.1.397