api-linter icon indicating copy to clipboard operation
api-linter copied to clipboard

AIP-121 Linter does not verify uniformness of resource across methods

Open apodznoev opened this issue 1 year ago • 0 comments

Hello!

As of AIP-121 definition for resource-oriented design,

If the request to or the response from a standard method (or a custom method in the same service) is the resource or contains the resource, the resource schema for that resource across all methods must be the same.

However, having a mixed service defined like:

service BookService {
    rpc CreateBook(CreateBookRequest) returns (Book);

    rpc GetBook(GetBookRequest) returns (Book);

    rpc ListBooks(ListBooksRequest) returns (ListBooksResponse){
        option (google.api.method_signature) = "parent";
    }

    rpc CreateFoo(CreateFooRequest) returns (Foo);

    rpc GetFoo(GetFooRequest) returns (Foo);

    rpc ListFoos(ListFoosRequest) returns (ListFoosResponse){
        option (google.api.method_signature) = "parent";
    }
}

will be totally valid yielding no issues from AIP linter in regards to AIP-121 rules.

Expectation would be, that AIP reject such a service as violating same-resource schema.

I attached the full service definition which didn't produce any warning from AIP linter as of version v1.65.1. book_service.txt

apodznoev avatar Apr 15 '24 16:04 apodznoev