-
Notifications
You must be signed in to change notification settings - Fork 151
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
AIP-133 parent detection shouldn't trigger for top-level resources #906
Comments
Any updates on this? Top level rules relating to 133 seems broken in general. This should be perfectly fine according to the specification: service SessionService {
rpc CreateSession(CreateSessionRequest) returns (Session) {
option (google.api.http) = {
post: "/v1/sessions"
body: "session"
};
option (google.api.method_signature) = "session";
}
}
message CreateSessionRequest {
Session session = 1 [(google.api.field_behavior) = REQUIRED];
} But it complains about |
Hey @Catgroove these have been poked at a few times. It was actually supposed to have been fixed by #1439 (in v1.67.4). There are a number of issues in this repo and this one should've been closed by that. Are you using a sufficiently new version of api-linter? If using a sufficiently recent release, if you don't mind sharing the definition of
This one is unrelated to where it the resource to be created is top-level or not. It was introduced some time ago to fulfill requirements in AIP-133: If this is guidance that doesn't apply to your usage of api-linter, please disable the rule. |
Thanks for the reply. I'm using the latest version, v1.68.0 and it's still causing the same issue. I do not think that the shape of session matters much but you can reproduce it with: message Session {
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
}
I think this still matters as there's some interplay with this rule and the top level rules. If I enable it, I get the following:
But that's not part of the method signature of the create request, as demonstrated by your library example here. But even if I add that to the request message and ignore the library example, I ge the following:
But since it's a top level resource, why do I need a parent? From AIP-133:
|
Sorry, I should've been more specific: If you don't mind, please share the
There is no interplay, the rules are run independently from each other, and this specific rule is not influenced by existence of a parent or not. That said, they may share implementation utilities that result in the same behavior happening in multiple rules.
I would not consider that example authoritative, rather the contents of https://google.aip.dev is the authority. That said, the example there should be updated. |
I've got a fix/refactor open for this. Feel free to checkout the PR to build and test locally if you want. |
https://linter.aip.dev/133/request-parent-required will show a warning whenever there is no
parent
field. AIP-133 specifically mentions:A parent field must be included unless the resource being created is a top-level resource
(since top-level resources don't have a parent, by definition).It would be better if the linter could try to detect probable top-level resources. It would also be better if the language of the linter warning specifically called out the possibility that this is a top-level resource, and gave guidance on what to do (e.g. standard language for disabling the linter warning for that resource).
The text was updated successfully, but these errors were encountered: