Skip to content

Commit 3d0cd84

Browse files
authored
Merge branch 'main' into update-prost
2 parents 149d213 + 95bb8b1 commit 3d0cd84

File tree

14 files changed

+148
-41
lines changed

14 files changed

+148
-41
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
test:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v5
2121
- name: Install protoc
2222
run: script/install-protoc
2323
- name: Build
@@ -28,7 +28,7 @@ jobs:
2828
lint:
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@v4
31+
- uses: actions/checkout@v5
3232
- name: Install protoc
3333
run: script/install-protoc
3434
- name: Lint

.github/workflows/create-release-pr.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Launch this workflow with the "Run workflow" button in the Actions tab of the repository.
2+
#
3+
# See https://github.com/github/twirp-rs/blob/main/CONTRIBUTING.md#releasing for more details.
14
name: Create release PR
25

36
permissions:
@@ -20,7 +23,7 @@ jobs:
2023
cancel-in-progress: false
2124
steps:
2225
- name: Checkout repository
23-
uses: actions/checkout@v4
26+
uses: actions/checkout@v5
2427
with:
2528
fetch-depth: 0
2629
- name: Install Rust toolchain

.github/workflows/publish-release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
name: Release and unpublished twirp/twirp-build packages
1+
# This workflow only publishes releases for PR's created by create-release-pr.yml
2+
#
3+
# See https://github.com/github/twirp-rs/blob/main/CONTRIBUTING.md#releasing for more details.
4+
name: Release any unpublished twirp/twirp-build packages
25

36
permissions:
47
contents: write
@@ -17,7 +20,7 @@ jobs:
1720
contents: write
1821
steps:
1922
- name: Checkout repository
20-
uses: actions/checkout@v4
23+
uses: actions/checkout@v5
2124
with:
2225
fetch-depth: 0
2326
- name: Install Rust toolchain

Cargo.lock

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

crates/twirp-build/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.9.0](https://github.com/github/twirp-rs/compare/twirp-build-v0.8.0...twirp-build-v0.9.0) - 2025-07-31
11+
12+
- See [the changelog for twirp](https://github.com/github/twirp-rs/blob/main/crates/twirp/CHANGELOG.md) for this release.

crates/twirp-build/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "twirp-build"
3-
version = "0.11.0"
3+
version = "0.9.0"
44
edition = "2021"
55
description = "Code generation for async-compatible Twirp RPC interfaces."
66
readme = "README.md"

crates/twirp-build/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![doc = include_str!("../README.md")]
2+
13
use quote::{format_ident, quote};
24

35
/// Generates twirp services for protobuf rpc service definitions.

crates/twirp/CHANGELOG.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.9.1](https://github.com/github/twirp-rs/compare/twirp-v0.9.0...twirp-v0.9.1) - 2025-08-14
11+
12+
### Fixed
13+
14+
- Preserve HTTP version in twirp client response ([#235](https://github.com/github/twirp-rs/pull/235))
15+
16+
### Other
17+
18+
- Bump tokio from 1.46.1 to 1.47.1 ([#231](https://github.com/github/twirp-rs/pull/231))
19+
20+
## [0.9.0](https://github.com/github/twirp-rs/compare/twirp-build-v0.8.0...twirp-build-v0.9.0) - 2025-07-31
21+
22+
### Breaking
23+
24+
- Remove `SERVICE_FQN` to avoid upgrade confusion ([#222](https://github.com/github/twirp-rs/pull/222))
25+
26+
#### Breaking: Allow custom headers and extensions for twirp clients and servers; unify traits; unify error type ([#212](https://github.com/github/twirp-rs/pull/212))
27+
28+
- No more `Context`. The same capabilities now exist via http request and response [Extensions](https://docs.rs/http/latest/http/struct.Extensions.html) and [Headers](https://docs.rs/http/latest/http/header/struct.HeaderMap.html).
29+
- Clients and servers now share a single trait (the rpc interface).
30+
- It is possible to set custom headers on requests (client side) and it's possible for server handlers to read request headers and set custom response headers.
31+
- The same ☝🏻 is true for extensions to allow interactivity with middleware.
32+
- All the above is accomplished by using `http::request::Request<In>` and `http::response::Response<Out>` where `In` and `Out` are the individual rpc message types.
33+
- We have unifyied and simplified the error types. There is now just `TwirpErrorResponse` which models the [twirp error response spec](https://twitchtv.github.io/twirp/docs/spec_v7.html#error-codes).
34+
35+
36+
#### Breaking: Generate service fqn ([#221](https://github.com/github/twirp-rs/pull/221))
37+
38+
Applications will need to remove any manual service nesting they are doing today.
39+
40+
In 0.8.0, server consumers of this library have to know how to properly construct the fully qualified service path by using `nest` on an `axum` `Router` like so:
41+
42+
```rust
43+
let twirp_routes = Router::new()
44+
.nest(haberdash::SERVICE_FQN, haberdash::router(api_impl));
45+
```
46+
47+
This is unnecessary in 0.9.0 (the generated `router` function for each service does that for you). Instead, you would write:
48+
49+
``` rust
50+
let twirp_routes = haberdash::router(api_impl);
51+
```
52+
53+
It is still canonical (but not required) to then nest with a `/twirp` prefix (the examples show this).
54+
55+
### Other
56+
57+
- Allow mocking out requests ([#220](https://github.com/github/twirp-rs/pull/220))
58+
- Swap twirp and twirp-build readmes. Replace the repo readme with a symlink to twirp's readme. ([#215](https://github.com/github/twirp-rs/pull/215))
59+
- Update the content of the readme ([#216](https://github.com/github/twirp-rs/pull/216))
60+
- Include the readme in rustdoc ([#225](https://github.com/github/twirp-rs/pull/225))

crates/twirp/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "twirp"
3-
version = "0.11.0"
3+
version = "0.9.1"
44
edition = "2021"
55
description = "An async-compatible library for Twirp RPC in Rust."
66
readme = "README.md"
@@ -29,6 +29,6 @@ reqwest = { version = "0.12", default-features = false }
2929
serde = { version = "1.0", features = ["derive"] }
3030
serde_json = "1.0"
3131
thiserror = "2.0"
32-
tokio = { version = "1.46", default-features = false }
32+
tokio = { version = "1.47", default-features = false }
3333
tower = { version = "0.5", default-features = false }
3434
url = { version = "2.5" }

crates/twirp/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# `twirp-build`
1+
# `twirp`
22

33
[Twirp is an RPC protocol](https://twitchtv.github.io/twirp/docs/spec_v7.html) based on HTTP and Protocol Buffers (proto). The protocol uses HTTP URLs to specify the RPC endpoints, and sends/receives proto messages as HTTP request/response bodies. Services are defined in a [.proto file](https://developers.google.com/protocol-buffers/docs/proto3), allowing easy implementation of RPC services with auto-generated clients and servers in different languages.
44

@@ -34,7 +34,11 @@ prost-build = "0.13"
3434

3535
Add a `build.rs` file to your project to compile the protos and generate Rust code:
3636

37-
```rust
37+
<!--
38+
`rust` gets syntax highlighting in GitHub UI and Rustdoc contexts
39+
` ,ignore` (including the space) makes rust tests ignore the code without breaking syntax highlighting
40+
-->
41+
```rust ,ignore
3842
fn main() {
3943
let proto_source_files = ["./service.proto"];
4044

@@ -55,7 +59,11 @@ This generates code that you can find in `target/build/your-project-*/out/exampl
5559

5660
Include the generated code, create a router, register your service, and then serve those routes in the hyper server:
5761

58-
```rust
62+
<!--
63+
`rust` gets syntax highlighting in GitHub UI and Rustdoc contexts
64+
` ,ignore` (including the space) makes rust tests ignore the code without breaking syntax highlighting
65+
-->
66+
```rust ,ignore
5967
mod haberdash {
6068
include!(concat!(env!("OUT_DIR"), "/service.haberdash.v1.rs"));
6169
}
@@ -93,7 +101,11 @@ This code creates an `axum::Router`, then hands it off to `axum::serve()` to han
93101

94102
On the client side, you also get a generated twirp client (based on the rpc endpoints in your proto). Include the generated code, create a client, and start making rpc calls:
95103

96-
``` rust
104+
<!--
105+
`rust` gets syntax highlighting in GitHub UI and Rustdoc contexts
106+
` ,ignore` (including the space) makes rust tests ignore the code without breaking syntax highlighting
107+
-->
108+
```rust ,ignore
97109
mod haberdash {
98110
include!(concat!(env!("OUT_DIR"), "/service.haberdash.v1.rs"));
99111
}

0 commit comments

Comments
 (0)