Skip to content

Commit

Permalink
Incorporate consensus feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sneeringer committed Sep 7, 2021
1 parent 8b58693 commit 19fb876
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions aip/general/0159/aip.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,39 @@ what collection it is in.

## Guidance

APIs **may** support reading resources across multiple collections by allowing
users to specify a `-` (the hyphen or dash character) as a wildcard character
in a standard [`List`][aip-132] operation:
There are two potential approaches for reading resources across multiple
collections. Groups of related services **should**, as a unit, select a
preferred approach and apply it consistently.

### Promoting Resources

One approach is to evade the problem entirely by promoting resources above
their erstwhile parents in the event that reading across collections is likely
to be a requirement.

In this approach, the parent becomes a field on the resource:

```typescript
interface Book {
// The ID of the book's publisher
publisherId: string;

// Other fields...
}
```

Similarly, the parent is removed from the URI:

```
GET /v1/books?filter...
```

### Wildcards

The other approach is to use a wildcard character. Services **may** support
reading resources across multiple collections by allowing users to specify a
`-` (the hyphen or dash character) as a wildcard character in a standard
[`List`][aip-132] operation:

```
GET /v1/publishers/-/books?filter=...
Expand Down

0 comments on commit 19fb876

Please sign in to comment.