Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
sunli829 committed Sep 2, 2023
2 parents 8fac20d + 582329d commit 559f5d7
Show file tree
Hide file tree
Showing 34 changed files with 326 additions and 294 deletions.
12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"poem-derive",
"poem",
Expand All @@ -19,10 +20,10 @@ repository = "https://github.com/poem-web/poem"
rust-version = "1.64"

[workspace.dependencies]
poem = { path = "poem", version = "1.3.57", default-features = false }
poem-derive = { path = "poem-derive", version = "1.3.57" }
poem-openapi-derive = { path = "poem-openapi-derive", version = "3.0.2" }
poem-grpc-build = { path = "poem-grpc-build", version = "0.2.20" }
poem = { path = "poem", version = "1.3.58", default-features = false }
poem-derive = { path = "poem-derive", version = "1.3.58" }
poem-openapi-derive = { path = "poem-openapi-derive", version = "3.0.4" }
poem-grpc-build = { path = "poem-grpc-build", version = "0.2.22" }

proc-macro-crate = "1.1.0"
proc-macro2 = "1.0.29"
Expand All @@ -40,9 +41,10 @@ bytes = "1.1.0"
futures-util = "0.3.17"
tokio-stream = "0.1.8"
serde_yaml = "0.9"
quick-xml = { version = "0.29.0", features = ["serialize"] }
quick-xml = { version = "0.30.0", features = ["serialize"] }
base64 = "0.21.0"
serde_urlencoded = "0.7.1"
indexmap = "2.0.0"

# rustls, update together
hyper-rustls = { version = "0.24.0", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion examples/poem/embed-files/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ publish.workspace = true
poem = { workspace = true, features = ["embed"] }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
tracing-subscriber.workspace = true
rust-embed = "6.3"
rust-embed = "8.0"
8 changes: 4 additions & 4 deletions examples/poem/opentelemetry-jaeger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ edition.workspace = true
publish.workspace = true

[dependencies]
poem = { workspace = true, features = ["opentelemetry", "prometheus"] }
poem = { workspace = true, features = ["opentelemetry"] }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
tracing-subscriber.workspace = true
opentelemetry = { version = "0.19.0", features = ["metrics"] }
opentelemetry-http = { version = "0.8.0" }
opentelemetry-jaeger = { version = "0.18.0", features = [
opentelemetry = { version = "0.20.0", features = ["metrics"] }
opentelemetry-http = { version = "0.9.0" }
opentelemetry-jaeger = { version = "0.19.0", features = [
"rt-tokio",
"collector_client",
"hyper_collector_client",
Expand Down
2 changes: 0 additions & 2 deletions examples/poem/opentelemetry-jaeger/src/server1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use opentelemetry::{
};
use opentelemetry_http::HeaderInjector;
use poem::{
endpoint::PrometheusExporter,
get, handler,
http::Method,
listener::TcpListener,
Expand Down Expand Up @@ -77,7 +76,6 @@ async fn main() -> Result<(), std::io::Error> {

let app = Route::new()
.at("/api1", get(index))
.at("/metrics", PrometheusExporter::new())
.data(tracer.clone())
.with(OpenTelemetryMetrics::new())
.with(OpenTelemetryTracing::new(tracer));
Expand Down
2 changes: 0 additions & 2 deletions examples/poem/opentelemetry-jaeger/src/server2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use opentelemetry::{
sdk::{propagation::TraceContextPropagator, trace::Tracer},
};
use poem::{
endpoint::PrometheusExporter,
get, handler,
listener::TcpListener,
middleware::{OpenTelemetryMetrics, OpenTelemetryTracing},
Expand Down Expand Up @@ -36,7 +35,6 @@ async fn main() -> Result<(), std::io::Error> {

let app = Route::new()
.at("/api2", get(index))
.at("/metrics", PrometheusExporter::new())
.data(tracer.clone())
.with(OpenTelemetryMetrics::new())
.with(OpenTelemetryTracing::new(tracer));
Expand Down
2 changes: 1 addition & 1 deletion poem-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-derive"
version = "1.3.57"
version = "1.3.58"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion poem-grpc-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-grpc-build"
version = "0.2.21"
version = "0.2.22"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
106 changes: 48 additions & 58 deletions poem-grpc-build/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ impl Config {
///
/// ```rust
/// # let mut config = poem_grpc_build::Config::new();
/// config.codec("::poem_grpc::codec::ProstCodec");
/// config.codec("::poem_grpc::codec::JsonCodec");
/// config
/// .codec("::poem_grpc::codec::ProstCodec")
/// .codec("::poem_grpc::codec::JsonCodec");
/// ```
pub fn codec(mut self, path: impl Into<String>) -> Self {
self.grpc_config.codec_list.push(path.into());
Expand Down Expand Up @@ -107,29 +108,23 @@ impl Config {
/// ```rust
/// # let mut config = poem_grpc_build::Config::new();
/// // Match a specific field in a message type.
/// config.btree_map(&[".my_messages.MyMessageType.my_map_field"]);
///
/// // Match all map fields in a message type.
/// config.btree_map(&[".my_messages.MyMessageType"]);
///
/// // Match all map fields in a package.
/// config.btree_map(&[".my_messages"]);
///
/// // Match all map fields. Specially useful in `no_std` contexts.
/// config.btree_map(&["."]);
///
/// // Match all map fields in a nested message.
/// config.btree_map(&[".my_messages.MyMessageType.MyNestedMessageType"]);
///
/// // Match all fields named 'my_map_field'.
/// config.btree_map(&["my_map_field"]);
///
/// // Match all fields named 'my_map_field' in messages named 'MyMessageType', regardless of
/// // package or nesting.
/// config.btree_map(&["MyMessageType.my_map_field"]);
///
/// // Match all fields named 'my_map_field', and all fields in the 'foo.bar' package.
/// config.btree_map(&["my_map_field", ".foo.bar"]);
/// config
/// .btree_map(&[".my_messages.MyMessageType.my_map_field"])
/// // Match all map fields in a message type.
/// .btree_map(&[".my_messages.MyMessageType"])
/// // Match all map fields in a package.
/// .btree_map(&[".my_messages"])
/// // Match all map fields. Specially useful in `no_std` contexts.
/// .btree_map(&["."])
/// // Match all map fields in a nested message.
/// .btree_map(&[".my_messages.MyMessageType.MyNestedMessageType"])
/// // Match all fields named 'my_map_field'.
/// .btree_map(&["my_map_field"])
/// // Match all fields named 'my_map_field' in messages named 'MyMessageType', regardless of
/// // package or nesting.
/// .btree_map(&["MyMessageType.my_map_field"])
/// // Match all fields named 'my_map_field', and all fields in the 'foo.bar' package.
/// .btree_map(&["my_map_field", ".foo.bar"]);
/// ```
///
/// [1]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html
Expand Down Expand Up @@ -166,29 +161,23 @@ impl Config {
/// ```rust
/// # let mut config = poem_grpc_build::Config::new();
/// // Match a specific field in a message type.
/// config.bytes(&[".my_messages.MyMessageType.my_bytes_field"]);
///
/// // Match all bytes fields in a message type.
/// config.bytes(&[".my_messages.MyMessageType"]);
///
/// // Match all bytes fields in a package.
/// config.bytes(&[".my_messages"]);
///
/// // Match all bytes fields. Specially useful in `no_std` contexts.
/// config.bytes(&["."]);
///
/// // Match all bytes fields in a nested message.
/// config.bytes(&[".my_messages.MyMessageType.MyNestedMessageType"]);
///
/// // Match all fields named 'my_bytes_field'.
/// config.bytes(&["my_bytes_field"]);
///
/// // Match all fields named 'my_bytes_field' in messages named 'MyMessageType', regardless of
/// // package or nesting.
/// config.bytes(&["MyMessageType.my_bytes_field"]);
///
/// // Match all fields named 'my_bytes_field', and all fields in the 'foo.bar' package.
/// config.bytes(&["my_bytes_field", ".foo.bar"]);
/// config
/// .bytes(&[".my_messages.MyMessageType.my_bytes_field"])
/// // Match all bytes fields in a message type.
/// .bytes(&[".my_messages.MyMessageType"])
/// // Match all bytes fields in a package.
/// .bytes(&[".my_messages"])
/// // Match all bytes fields. Specially useful in `no_std` contexts.
/// .bytes(&["."])
/// // Match all bytes fields in a nested message.
/// .bytes(&[".my_messages.MyMessageType.MyNestedMessageType"])
/// // Match all fields named 'my_bytes_field'.
/// .bytes(&["my_bytes_field"])
/// // Match all fields named 'my_bytes_field' in messages named 'MyMessageType', regardless of
/// // package or nesting.
/// .bytes(&["MyMessageType.my_bytes_field"])
/// // Match all fields named 'my_bytes_field', and all fields in the 'foo.bar' package.
/// .bytes(&["my_bytes_field", ".foo.bar"]);
/// ```
///
/// [1]: https://docs.rs/bytes/latest/bytes/struct.Bytes.html
Expand Down Expand Up @@ -227,16 +216,17 @@ impl Config {
/// ```rust
/// # let mut config = poem_grpc_build::Config::new();
/// // Nothing around uses floats, so we can derive real `Eq` in addition to `PartialEq`.
/// config.type_attribute(".", "#[derive(Eq)]");
/// // Some messages want to be serializable with serde as well.
/// config.type_attribute(
/// "my_messages.MyMessageType",
/// "#[derive(Serialize)] #[serde(rename-all = \"snake_case\")]",
/// );
/// config.type_attribute(
/// "my_messages.MyMessageType.MyNestedMessageType",
/// "#[derive(Serialize)] #[serde(rename-all = \"snake_case\")]",
/// );
/// config
/// .type_attribute(".", "#[derive(Eq)]")
/// // Some messages want to be serializable with serde as well.
/// .type_attribute(
/// "my_messages.MyMessageType",
/// "#[derive(Serialize)] #[serde(rename-all = \"snake_case\")]",
/// )
/// .type_attribute(
/// "my_messages.MyMessageType.MyNestedMessageType",
/// "#[derive(Serialize)] #[serde(rename-all = \"snake_case\")]",
/// );
/// ```
///
/// # Oneof fields
Expand Down
2 changes: 1 addition & 1 deletion poem-grpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-grpc"
version = "0.2.23"
version = "0.2.24"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion poem-lambda/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-lambda"
version = "1.3.57"
version = "1.3.58"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions poem-openapi-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "poem-openapi-derive"
version = "3.0.2"
version = "3.0.4"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand All @@ -22,7 +22,7 @@ proc-macro2.workspace = true
quote.workspace = true
syn = { workspace = true, features = ["full", "visit-mut"] }
thiserror.workspace = true
indexmap = "2.0.0"
indexmap.workspace = true
regex.workspace = true
http = "0.2.5"
mime.workspace = true
Expand Down
Loading

0 comments on commit 559f5d7

Please sign in to comment.