Skip to content

Commit cc9f523

Browse files
committed
Add a note about typealiases to the relationship section of the readme.
1 parent 314891e commit cc9f523

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

documentation/usage.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ typealias Relationships = NoRelationships
176176
let friendIds: [Person.Id] = person ~> \.friends
177177
```
178178

179+
🗒You will likely find relationship types more ergonomic and easier to read if you create typealiases. For example, if your project never uses Relationship metadata or links, you can create a typealias like `typealias ToOne<T: JSONAPI.JSONAPIIdentifiable> = JSONAPI.ToOneRelationship<T, NoIdMetadata, NoMetadata, NoLinks>`.
180+
179181
#### Relationship Metadata
180182
In addition to identifying resource objects by ID and type, `Relationships` can contain `Meta` or `Links` that follow the same rules as [`Meta`](#jsonapimeta) and [`Links`](#jsonapilinks) elsewhere in the JSON:API Document.
181183

0 commit comments

Comments
 (0)