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
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,25 @@ jobs:
- uses: Swatinem/rust-cache@v2
# Unit, integration (incl. trybuild compile tests), examples and doc tests.
- run: cargo test --workspace --all-features

no_std:
name: no_std (seamless_info, seamless_ts)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
targets: thumbv7em-none-eabi
- uses: Swatinem/rust-cache@v2
# thumbv7em-none-eabi has no std, so this fails if seamless_info or seamless_ts
# (or any of their dependencies, for any combination of features) start relying on std.
- name: Build (no features)
run: cargo build -p seamless_info --target thumbv7em-none-eabi
- name: Build (serialize)
run: cargo build -p seamless_info --target thumbv7em-none-eabi --features serialize
- name: Build (deserialize)
run: cargo build -p seamless_info --target thumbv7em-none-eabi --features deserialize
- name: Build (all features)
run: cargo build -p seamless_info --target thumbv7em-none-eabi --all-features
- name: Build seamless_ts
run: cargo build -p seamless_ts --target thumbv7em-none-eabi
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# 0.15.0

- Add a `no_std` `seamless-ts` crate, whose `generate_types()` function takes the JSON serialized info for an API (from `Api::info()`) and writes TypeScript to any `core::fmt::Write`, exporting an `Api` type which describes the method, params and result type of every route, and a readonly `methods` object holding the method of every route for use at runtime.
- Add a `seamless_ts_bin` crate providing a `seamless-ts` CLI tool, which reads the JSON serialized info for an API from stdin (or a file given with `--file`, or a URL given with `--url`, optionally sending headers given with `-H`/`--header`) and writes the generated TypeScript to stdout.

# 0.14.0

- **Breaking:** `Api::add()` now panics if given an empty path (or one made up only of slashes).
- **Breaking:** `ApiBodyType::Object { keys }` is now a `BTreeMap<String, ApiBodyInfo>` rather than a `HashMap`, since `HashMap` isn't available in `no_std`. Object keys are now serialized in a stable (sorted) order as a result.
- `ApiBody` is now implemented for `BTreeMap<String, T>`.
- **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.
Expand Down
Loading
Loading