Repository navigation
Add proto message options to attach resource metadata. - #2454
Open
Julian Gutierrez Oschmann (juli4n) wants to merge 3 commits into
Open
Julian Gutierrez Oschmann (juli4n) wants to merge 3 commits into
Julian Gutierrez Oschmann (juli4n) wants to merge 3 commits into
Conversation
Julian Gutierrez Oschmann (juli4n)
force-pushed
the
apitool_subresources
branch
6 times, most recently
from
October 12, 2026 16:01
e77b9e3 to
8bde9ea
Compare
Julian Gutierrez Oschmann (juli4n)
force-pushed
the
apitool_subresources
branch
3 times, most recently
from
October 12, 2026 18:31
2f6e930 to
3c6df32
Compare
Julian Gutierrez Oschmann (juli4n)
requested review from
Eitan Yarmush (EItanya) and
Tim Hockin (thockin)
October 12, 2026 18:32
Julian Gutierrez Oschmann (juli4n)
marked this pull request as ready for review
October 12, 2026 18:33
Define a (resource) message option, which marks a message as an API resource and records its parents, whether it is a singleton, and its scope, and a (method) option, which names the resource an RPC operates on. Tools can then read the resource model from the proto instead of inferring it from names. Document how to use them in a new "Annotations" section of the API style guide.
Mark every resource message in ateapi.proto with the (resource) option and every Control RPC with the (method) option naming the resource it operates on.
apitool no longer hardcodes the list of resources or uses a heuristic to
detect them, which was broken: it reads the resource model from the
(resource) and (method) options instead, so subresources and singletons
are linted correctly.
Also rework the linter rules to be less verbose and more declarative,
add a rule that custom methods return a {MethodName}Response, and
tighten the API style guide where the rules enforce it: Get and Update
requests have no other fields, DeleteOptions has a closed set of
fields, and nested enum values are prefixed too.
Julian Gutierrez Oschmann (juli4n)
force-pushed
the
apitool_subresources
branch
from
October 12, 2026 20:24
3c6df32 to
4ce2ae0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
apitooltool used to guess the resource model from names. It kept a hard-coded list of resource names and assigned each RPC to whichever one appeared longest in the method name.That list is stale and subresource methods were therefore attributed to their parent. For example,
GetActorEgressPolicycounted as an Actor method andListWorkerActorAssignmentsas aWorkermethod. Because of that, subresources and singletons were linted against the wrong resource or not at all.This change records the resource model in the proto itself and makes apitool read it from there.
Changes
The PR has three commits, which can be reviewed one at a time:
Lint rule changes:
New:
standard-method-naming: the verb, then for a subresource one of its parents (or Global), then the resource. List uses the plural.subresource-naming: a subresource's message is named without its parent type.singleton-no-list: a singleton has no List method.custom-response-name-matches-method: a custom method returns {MethodName}Response, not the resource.Changed:
get-request-single-objectrefis now get-request-shape, and it covers subresources: the parent's ObjectRef plus name.