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

Q: AIP-151: dont error on custom operation method #1428

Closed
loeffel-io opened this issue Sep 9, 2024 · 3 comments
Closed

Q: AIP-151: dont error on custom operation method #1428

loeffel-io opened this issue Sep 9, 2024 · 3 comments

Comments

@loeffel-io
Copy link
Contributor

As mentioned here you can add custom bindings. This sounds to me that we can create our own GetOperation/ListOperations method inside our own GrpcService like:

  rpc GetOperation(GetOperationRequest) returns (google.longrunning.Operation) {
    option (google.api.http) = {
      get: "/v1/{name=projects/*/emails/*/operations/*}"
    };
    option (google.api.method_signature) = "name";
  }

but this will fail with

- file_path: mindful/earth/email/v1/email.proto
  problems:
    - message: Methods returning an LRO must include the operation_info annotation.
      location:
        start_position:
            line_number: 77
            column_number: 3
        end_position:
            line_number: 82
            column_number: 3
        path: mindful/earth/email/v1/email.proto
      rule_id: core::0151::operation-info
      rule_doc_uri: https://linter.aip.dev/151/operation-info

Maybe i can get some insights here, thank you 🙏

@loeffel-io
Copy link
Contributor Author

I think i am wrong here, sounds like i must use just implement the whole longrunning service

@noahdietz
Copy link
Collaborator

I think i am wrong here, sounds like i must use just implement the whole longrunning service

You are on the right track here.

Google services do not redefine the google.longrunning.Operations service directly in their own service protos. Instead, they implement it, and register their google.longrunning.Operations server implementation on their endpoint, just like one would do with implementing & registering their own gRPC service implementation.

As such, we don't see the proto definition you've included above in the .proto files being linted, so the assumption is that if an RPC returns a google.longrunning.Operation, it is leveraging the Operations service, not implementing it, and needs to conform to AIP-151.

Closing, but feel free to follow up with questions!

@loeffel-io
Copy link
Contributor Author

Thank you very much @noahdietz for your answer!

Google services do not redefine the google.longrunning.Operations service directly in their own service protos. Instead, they implement it, and register their google.longrunning.Operations server implementation on their endpoint, just like one would do with implementing & registering their own gRPC service implementation.

Just did this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants