Skip to content

Commit 001f714

Browse files
soyukaalanpoulain
andauthored
Apply suggestions from code review
Co-authored-by: Alan Poulain <[email protected]>
1 parent 01ed8dd commit 001f714

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/adr/0001-resource-identifiers.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# Resource identifiers
1+
# Resource Identifiers
22

33
* Status: proposed
44
* Deciders: @dunglas @alanpoulain @soyuka
55

66
Technical Story: [#2126][pull/2126]
7-
Implementation: [#3825][pull/3825 ]
7+
Implementation: [#3825][pull/3825]
88

99
## Context and Problem Statement
1010

1111
In API Platform, a resource is identified by [IRIs][rfc/IRI], for example `/books/1`. Internally, this is also known as a route with an identifier parameter named `id`: `/books/{id}`. This `id` parameter is then matched to the resource identifiers, known by the `ApiProperty` metadata when `identifier` is true. When multiple identifiers are found, composite identifiers map the value of `id` to the resource identifiers (eg: `keya=value1;keyb=value2`, where `keya` and `keyb` are identifiers of the resource). This behavior is suggested by the [URI RFC][rfc/URI].
1212
Subresources IRIs have multiple parts, for example: `/books/{id}/author/{authorId}`. The router needs to know that `id` matches the `Book` resource, and `authorId` the `Author` resource. To do so, a Tuple representing the class and the property matching each parameter is linked to the route, for example: `id: [Book, id], authorId: [User, id]`.
13-
By normalizing the shape of (sub)-resources (see [0000-subresources-definition][0000-subresources-definition]), we need to normalize the resource identifiers.
13+
By normalizing the shape of (sub-)resources (see [0000-subresources-definition][0000-subresources-definition]), we need to normalize the resource identifiers.
1414

1515
## Decision Outcome
1616

1717
Declare explicit resource `identifiers` that will default to `id: [id, Resource]` with composite identifiers. Allow composite identifiers to be disabled if needed.
1818

1919
### Examples
2020

21-
Define a route `/users/{id}`
21+
Define a route `/users/{id}`:
2222

2323
```php
2424
/**

0 commit comments

Comments
 (0)