Skip to content

Commit 49e33ba

Browse files
committed
give all top-level-ish headers the JSONAPI prefix
1 parent f2a9b5a commit 49e33ba

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Note that Playground support for importing non-system Frameworks is still a bit
8080

8181
In this documentation, in order to draw attention to the difference between the `JSONAPI` framework (this Swift library) and the **JSON API Spec** (the specification this library helps you follow), the specification will consistently be referred to below as simply the **SPEC**.
8282

83-
### `EntityDescription`
83+
### `JSONAPI.EntityDescription`
8484

8585
An `EntityDescription` is the `JSONAPI` framework's representation of what the **SPEC** calls a *Resource Object*. You might create the following `EntityDescription` to represent a person in a network of friends:
8686

@@ -136,7 +136,7 @@ This readme doesn't go into detail on the **SPEC**, but the following *Resource
136136
}
137137
```
138138

139-
### `Entity`
139+
### `JSONAPI.Entity`
140140

141141
Once you have an `EntityDescription`, you _create_, _encode_, and _decode_ `Entities` that "fit the description". If you have a `CreatableRawIdType` (see the section on `RawIdType`s below) then you can create new `Entities` that will automatically be given unique Ids, but even without a `CreatableRawIdType` you can encode, decode and work with entities.
142142

@@ -182,7 +182,7 @@ typealias NewPerson = NewEntity<PersonDescription, NoMetadata, NoLinks>
182182

183183
Note that I am assuming an unidentified person is a "new" person. I suspect that is generally an acceptable conflation because the only time the **SPEC** allows a *Resource Object* to be encoded without an `Id` is when a client is requesting the given *Resource Object* be created by the server and the client wants the server to create the `Id` for that object.
184184

185-
### `Relationships`
185+
### `JSONAPI.Relationships`
186186

187187
There are two types of `Relationships`: `ToOneRelationship` and `ToManyRelationship`. An `EntityDescription`'s `Relationships` type can contain any number of `Relationship` properties of either of these types. Do not store anything other than `Relationship` properties in the `Relationships` struct of an `EntityDescription`.
188188

@@ -201,7 +201,7 @@ typealias Relationships = NoRelationships
201201
let friendIds: [Person.Identifier] = person ~> \.friends
202202
```
203203

204-
### `Attributes`
204+
### `JSONAPI.Attributes`
205205

206206
The `Attributes` of an `EntityDescription` can contain any JSON encodable/decodable types as long as they are wrapped in an `Attribute`, `ValidatedAttribute`, or `TransformedAttribute` `struct`.
207207

@@ -271,13 +271,13 @@ public var fullName: Attribute<String> {
271271
}
272272
```
273273

274-
### `JSONAPIDocument`
274+
### `JSONAPI.Document`
275275

276-
The entirety of a JSON API request or response is encoded or decoded from- or to a `JSONAPIDocument`. As an example, a JSON API response containing one `Person` and no included entities could be decoded as follows:
276+
The entirety of a JSON API request or response is encoded or decoded from- or to a `Document`. As an example, a JSON API response containing one `Person` and no included entities could be decoded as follows:
277277
```
278278
let decoder = JSONDecoder()
279279
280-
let responseStructure = JSONAPIDocument<SingleResourceBody<Person>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self
280+
let responseStructure = JSONAPI.Document<SingleResourceBody<Person>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self
281281
282282
let document = try decoder.decode(responseStructure, from: data)
283283
```

0 commit comments

Comments
 (0)