Skip to content

Commit 2681e4d

Browse files
authored
feat(AIP-217): reformat guidance and explicitly state name format (#1393)
1 parent 29862f4 commit 2681e4d

1 file changed

Lines changed: 61 additions & 14 deletions

File tree

aip/general/0217.md

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,44 @@ message ListBooksResponse {
3838

3939
- The field **must** be a repeated string, and **should** be named
4040
`unreachable`.
41-
- The field **must** be set to the names of the resources which are the cause
42-
of the issue, such as the parent or individual resources that could not be
43-
reached. The objects listed as unreachable **may** be _parents_ (or higher
44-
ancestors) rather than the individual resources being requested. For example,
45-
if a location is unreachable, the location is listed.
46-
- The response **must not** provide any other information about the issue,
47-
such as error details or codes. To discover what the underlying issue is,
48-
users **should** send a more specific request.
49-
- The service **must** provide a way for the user to get an error with
50-
additional information, and **should** allow the user to repeat the
51-
original call with more restrictive parameters in order to do so.
52-
- The resource names provided in this field **may** be heterogeneous. The
53-
field **should** document what potential resources may be provided in this
54-
field, and note that it might expand later.
41+
- The field **must** contain the resource names of the resources that are
42+
unreachable or those that impede reaching the requested collection, such as
43+
the parent resource of the collection that could not be reached.
44+
- For example, if an entire location is unreachable, preventing access to the
45+
localized collection of resources requested, the location resource is
46+
included.
47+
- The field **must** contain _service-relative_ resource names, and **must not**
48+
contain full resource names, resource URIs, or simple resource IDs. See
49+
[AIP-122][aip-122] for definitions.
50+
- For example, if a `Book` resource is unreachable, the _service-relative_
51+
resource name `"shelves/scifi1/books/starwars4"` is included in
52+
`unreachable`, as opposed to the _full_ resource name
53+
`"//library.googleapis.com/shelves/scifi1/books/starwars4"`, the
54+
_parent-relative_ resource `"books/starwars4"`, the resource ID
55+
`"starwars4"`, or the resource URI.
56+
- The response **must not** provide any other information about the issue(s)
57+
that made the listed resources unreachable.
58+
- For example, the response cannot contain an extra field with error reasons
59+
for each `unreachable` entry.
60+
- The service **must** provide a way for the user to make a more specific
61+
request and receive an error with additional information e.g. via a Standard
62+
Get or a Standard List targeted at the unreachable collection parent.
63+
- The service **must** also allow the user to repeat the original call with
64+
more restrictive parameters.
65+
- The resource names that appear in `unreachable` **may** be heterogeneous.
66+
- The `unreachable` field definition **should** document what potential
67+
resources could be provided in this field, and note that it might expand
68+
later.
69+
- For example, if both an entire location and a specific resource in a
70+
different location are unreachable, the unreachable location's name
71+
e.g. `"projects/example123/locations/us-east1"` and the unreachable
72+
resource's name e.g.
73+
`"projects/example123/locations/europe-west2/instances/example456"` will
74+
both appear in `unreachable`.
75+
76+
[aip-122]: ./0122.md
77+
[aip-160]: ./0160.md
78+
5579

5680
**Important:** If a single unreachable location or resource prevents returning
5781
any data by definition (for example, a list request for a single publisher
@@ -146,6 +170,27 @@ resource collection. The supported granularity **must** be documented on the
146170

147171
## Rationale
148172

173+
### Using service-relative resource names
174+
175+
In general, relative resource names, as defined in AIP-122, are the best
176+
practice for referring to resources by name _within_ a service and in other
177+
services when that other service is obvious. The full resource name format is
178+
strictly less consumable (e.g., requires extra parsing client side), and
179+
over-specified for the uses of `unreachable`. Resource URIs are not transport
180+
agnostic, as they are unusable in standard methods for gRPC users, and simple
181+
resource IDs do not provide enough information about exactly which resource
182+
was unreachable in a heterogenous list of resources.
183+
184+
### Minimizing extra error details in response
185+
186+
The context in which an unreachable resource is discovered may be sensitive and
187+
the state of the system fluid between calls. As such, it is preferred to defer
188+
to the service by making a more specific RPC to get more details about a
189+
specific resource or parent. This allows the parent to handle all necessary RPC
190+
checks and system state resolution on at time of request, rather than by
191+
shoehorning potentially privileged or stale information into the broader list
192+
call it was unreachable for.
193+
149194
### Using request field to opt-in
150195

151196
Introducing a new request field as means of opting into the partial success
@@ -182,6 +227,8 @@ requests that cannot be fulfilled preemptively.
182227

183228
## Changelog
184229

230+
- **2024-07-29**: Reformat guidance, add explicit resource name format
231+
requirement.
185232
- **2024-07-19**: Add guidance for brownfield adoption of partial success.
186233

187234
[aip-159]: ./0159.md

0 commit comments

Comments
 (0)