I cannot set in .rr.yml Proto which includes other protos
oneslash opened this issue · comments
I cannot set in .rr.yml Proto which includes other protos.
It does not work for some reason
Can you attach sample proto file and describe the issue in more details.
Category.proto
syntax = "proto3";
package pim.v1;
message Category {
uint32 id = 1;
string name = 2;
}
Product.proto
syntax = "proto3";
package product;
import "v1/category.proto";
message Product {
uint32 id = 1;
string name = 2;
Category primary_category = 3;
}
and my .rr.yml is
grpc:
listen: "tcp://:9001"
proto: "./vendor/app/product.proto"
workers:
command: "php app.php"
pool:
numWorkers: 4
What is the error you experiencing? I'm not seeing any services defined in your proto files, have you generated your service code?
@wolfy-j yes, I have services, in both files.
service CategoryService {
rpc CreateCategory (CategoryCreateRequest) returns (CategoryCreateResponse) {};
rpc ReadCategory (CategoryReadRequest) returns (CategoryReadResponse) {};
}
ProductService {
// Price Related
rpc UpdatePrice (ProductPriceRequest) returns (ProductPriceResponse) {}
}
error is it cannot find the service in category
It would be hard for me to identify the issue this way. If you can post the minimal reproducible version of your code it would help a lot.
When you saying "error is it cannot find the service in category", do you mean it is not able to generate the code for this service or this service does not respond on GPRC request?
the error was
{
“error”: “12 UNIMPLEMENTED: unknown service pim.v1.CategoryService”
}
If it is not enough we can try to send a small code
Yes, please submit the code sample. Thank you
so there is the commit with changes https://github.com/oneslash/php-grpc/commit/3b878bb5b4df94fba5174e3c40a252d8ff0b784a
the test TestParseFile
will fail since it can't find two services
func TestParseFile(t *testing.T) {
services, err := File("test.proto")
assert.NoError(t, err)
assert.Len(t, services, 2)
assert.Equal(t, "app.namespace", services[0].Package)
}
Thank you, this helps a lot.
Fixed in 1.0.4
Thank you, I will check soon and report back if it works