some non actual test
This commit is contained in:
parent
f84b496cc1
commit
711973e03e
22
src/proto/fixtures/address.proto
Normal file
22
src/proto/fixtures/address.proto
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// address.proto
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package address;
|
||||||
|
|
||||||
|
// Import the user.proto file to use User message
|
||||||
|
import "user.proto";
|
||||||
|
|
||||||
|
message Address {
|
||||||
|
string street = 1;
|
||||||
|
string city = 2;
|
||||||
|
string zip_code = 3;
|
||||||
|
// This field references the User message from user.proto
|
||||||
|
user.User user = 4; // Here we reference the User message
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define the AddressService service
|
||||||
|
service AddressService {
|
||||||
|
rpc AddAddress (Address) returns (Address);
|
||||||
|
rpc GetAddressForUser (user.User) returns (Address);
|
||||||
|
}
|
23
src/proto/fixtures/user.proto
Normal file
23
src/proto/fixtures/user.proto
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// user.proto
|
||||||
|
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package user;
|
||||||
|
|
||||||
|
// Define the User message
|
||||||
|
message User {
|
||||||
|
string id = 1;
|
||||||
|
string name = 2;
|
||||||
|
string email = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define the GetUserRequest message
|
||||||
|
message GetUserRequest {
|
||||||
|
string id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define the UserService service
|
||||||
|
service UserService {
|
||||||
|
rpc GetUser (GetUserRequest) returns (User);
|
||||||
|
rpc CreateUser (User) returns (User);
|
||||||
|
}
|
@ -49,4 +49,19 @@ mod t {
|
|||||||
resolve.push_str("foox.wit", &config.to_wit()).expect("TODO: panic message`");
|
resolve.push_str("foox.wit", &config.to_wit()).expect("TODO: panic message`");
|
||||||
println!("{:#?}", resolve);
|
println!("{:#?}", resolve);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn bar() {
|
||||||
|
let relative = format!("{}/src/proto/fixtures",env!("CARGO_MANIFEST_DIR"));
|
||||||
|
let x = std::fs::read_to_string(format!("{}/address.proto", relative)).unwrap();
|
||||||
|
let proto = protox::compile([format!("{}/address.proto", relative)], [relative]).unwrap();
|
||||||
|
let proto = Proto::new([proto]);
|
||||||
|
let config = proto.to_config().to_result().unwrap();
|
||||||
|
println!("{}", config.to_wit());
|
||||||
|
// print!("{:#?}", config);
|
||||||
|
|
||||||
|
let mut resolve = Resolve::new();
|
||||||
|
resolve.push_str("foox.wit", &config.to_wit()).expect("TODO: panic message`");
|
||||||
|
println!("{:#?}", resolve);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user