Verify that resource referenced in request field has pattern(s) present in google.api.http annotations
When an RPC has a resource name in its request, the name is often used as part of the HTTP binding. For example:
service FooService {
rpc GetFoo(GetFooRequest) returns (Foo) {
option (google.api.http) = {
get: "v1/{name=projects/*/foos/*}"
};
};
}
message GetFooRequest {
// Format: projects/{project}/foos/{foo}
string name = 1 [(google.api.resource_reference).type = "foo.googleapis.com/Foo"];
}
message Foo {
option (google.api.resource) = {
type: "foo.googleapis.com/Foo"
pattern: "projects/{project}/foos/{foo}"
};
string name = 1;
}
Here, GetFooRequest.name field is used to populate a section of the HTTP Request path. That field references a resource definition that defines a resource name pattern. The linter should enforce that the expected pattern(s) present in the google.api.http path can be found in the google.api.resource annotation for the referenced resource.
@acamadeo all yours!
Fixed by #1045. Will be in the next release. Closing this as the other case of child_type references in the google.api.http annotation is covered by #1047. Thank you @acamadeo