Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resources referenced by name but not used directly generate helper methods #637

Closed
software-dov opened this issue Oct 6, 2020 · 0 comments · Fixed by #642 or #1133
Closed

Resources referenced by name but not used directly generate helper methods #637

software-dov opened this issue Oct 6, 2020 · 0 comments · Fixed by #642 or #1133
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@software-dov
Copy link
Contributor

Consider the following:

message Squid {
  option (google.api.resource) = {
    type: "animalia.cephalopoda.com/Squid"
    pattern: "zones/{zone}/squids/{squid}"
  };
  string name = 1;
}

message CreateSquidRequest {
  string name = 1 {
    (google.api.resource_reference) = {
      type: "animalia.cephalopoda.com/Squid"
    }
  };
}

message CreateSquidResponse {}

service SquidService {
  rpc CreateSquid(CreateSquidResponse) returns CreateSquidResponse {
    option (google.api.method_signature) = "name";
  }
}

The Squid resource is never directly referenced as an input or output message type or one of their fields, but we still want to generate resource helper methods for Squid.

Tracking issue for following resource_reference annotations in fields.

@software-dov software-dov added priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Oct 6, 2020
software-dov added a commit to software-dov/gapic-generator-python that referenced this issue Oct 8, 2020
File level resources are defined as options for the proto file, not
for a message type.
Indirectly used resources are resources backed by a message type, but
the message type is not a field type referenced by a service.

E.g.

message Squid {
  option (google.api.resource) = {
    type: "animalia.mollusca.com/Squid"
    pattern: "zones/{zone}/squids/{squid}"
  };
}
message CreateSquidRequest{
    string name = 1 [
	(google.api.resource_reference) = {
	    type: "animalia.mollusca.com/Squid"
	}
	];
}
message CreateSquidResponse{}

Both file level and indirectly used resources generate helper methods
in service clients that need them.

Closes googleapis#637
software-dov added a commit that referenced this issue Oct 9, 2020
#642)

* feat: file_level and indirectly used resources generate helper methods

File level resources are defined as options for the proto file, not
for a message type.
Indirectly used resources are resources backed by a message type, but
the message type is not a field type referenced by a service.

E.g.

message Squid {
  option (google.api.resource) = {
    type: "animalia.mollusca.com/Squid"
    pattern: "zones/{zone}/squids/{squid}"
  };
}
message CreateSquidRequest{
    string name = 1 [
	(google.api.resource_reference) = {
	    type: "animalia.mollusca.com/Squid"
	}
	];
}
message CreateSquidResponse{}

Both file level and indirectly used resources generate helper methods
in service clients that need them.

Closes #637
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment