Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 0.14.0

- **Breaking:** Remove the `IntoBody` trait. Unwrap body types directly instead, either by pattern matching in the handler arguments (eg `|Capped(FromJson(body)): Capped<FromJson<T>, N>| ...`) or via `.0`.
- **Breaking:** `Option<T>` is now described as `OneOf [T, Null]` (ie `T | null`) rather than `Optional`, since serde serializes `None` as `null`. Previously, clients generated from the info would wrongly expect the key to be omitted.
- Add `#[api_body(optional)]` for `Option<T>` fields in `ApiBody` structs and enum variants. The field is described as `Optional` (ie `{ key?: T }`), is omitted from the JSON when `None`, and is treated as `None` when missing.
- `#[api_body(flatten)]` on an enum variant field is now a clear compile error rather than a confusing one.
- **Breaking:** `HandlerBody::handler_method()` no longer defaults to POST and must be implemented by every `HandlerBody` type. Custom body types that relied on the default should add `fn handler_method() -> Method { Method::POST }`.
- Fix `Capped<T, N>` always reporting POST as its handler method; it now uses `T`'s method, so wrapping a body type that expects eg PUT no longer changes the route.
- **Breaking:** Responses can now be streamed. `Api::handle()` and `HandlerResponse::handler_response()` now produce an `http::Response<seamless::handler::response::Body>` rather than an `http::Response<Vec<u8>>`. A `Body` is either a complete set of bytes (use `Body::as_bytes()` or `Body::into_bytes()` to get at them without streaming) or a stream of `bytes::Bytes` chunks (use `Body::into_stream()` to obtain a `BodyStream`, which implements `futures::Stream`). Code which previously used `res.into_body()` as a `Vec<u8>` can use `res.into_body().into_vec()` instead, though it's better to pass streaming bodies on to your HTTP framework as streams (see the Axum and Hyper examples).
- Add a `ToBinary` response type, which responds with arbitrary bytes, optionally streamed from a `futures::Stream` or `futures::AsyncRead`, and which allows the `content-type` and `content-length` headers to be set. The `content-length` is set automatically when the body is already in memory.
- `ToJson` no longer panics if the value fails to serialize (eg a map with non-string keys, or a custom `Serialize` impl that errors). A 500 `ApiError` is returned instead, with the serialization error in its `internal_message`.

# 0.13.0

- Upgrade to syn 3.
Expand Down
Loading
Loading