Skip to content

Commit

Permalink
fix: don't change the service name early (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
Millione authored Sep 19, 2024
1 parent 196fe4c commit 8402807
Show file tree
Hide file tree
Showing 5 changed files with 2,942 additions and 572 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pilota-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pilota-build"
version = "0.11.18"
version = "0.11.19"
edition = "2021"
description = "Compile thrift and protobuf idl into rust code at compile-time."
documentation = "https://docs.rs/pilota-build"
Expand Down
22 changes: 4 additions & 18 deletions pilota-build/src/parser/thrift/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,8 @@ impl ThriftLower {
result.push(self.mk_item(kind, tags.into()));

if !exception.is_empty() {
let name: Ident = format!(
"{}{}Exception",
service.name.to_upper_camel_case().as_str(),
method_name
)
.into();
let name: Ident =
format!("{}{}Exception", service.name.as_str(), method_name).into();
let kind = ir::ItemKind::Enum(ir::Enum {
name: name.clone(),
variants: exception,
Expand All @@ -243,12 +239,7 @@ impl ThriftLower {
result.push(self.mk_item(kind, tags.into()));
}

let name: Ident = format!(
"{}{}ArgsSend",
service.name.to_upper_camel_case().as_str(),
method_name
)
.into();
let name: Ident = format!("{}{}ArgsSend", service.name.as_str(), method_name).into();
let kind = ir::ItemKind::Message(ir::Message {
name: name.clone(),
fields: f.arguments.iter().map(|a| self.lower_field(a)).collect(),
Expand All @@ -258,12 +249,7 @@ impl ThriftLower {
tags.insert(crate::tags::KeepUnknownFields(false));
result.push(self.mk_item(kind, tags.into()));

let name: Ident = format!(
"{}{}ArgsRecv",
service.name.to_upper_camel_case().as_str(),
method_name
)
.into();
let name: Ident = format!("{}{}ArgsRecv", service.name.as_str(), method_name).into();
let kind = ir::ItemKind::Message(ir::Message {
name: name.clone(),
fields: f
Expand Down
Loading

0 comments on commit 8402807

Please sign in to comment.