You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/general/adapters.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,7 @@
3
3
AMS does this through two components: **serializers** and **adapters**.
4
4
Serializers describe _which_ attributes and relationships should be serialized.
5
5
Adapters describe _how_ attributes and relationships should be serialized.
6
-
You can use one of the built-in adapters (```FlattenJSON``` is the default one) or create one by your one but you won't need to implement an adapter unless you wish to use a new format or
7
-
media type with AMS.
6
+
You can use one of the built-in adapters (```FlattenJSON``` is the default one) or create one by yourself, but you won't need to implement an adapter unless you wish to use a new format or media type with AMS.
8
7
9
8
## Built in Adapters
10
9
@@ -15,12 +14,12 @@ Doesn't follow any specifc convention.
15
14
16
15
### JSON
17
16
18
-
It also generates a json response but always with a root key. The root key **can't be overridden**, and will be automatically defined accordingly with the objects being serialized.
17
+
It also generates a json response but always with a root key. The root key **can't be overridden**, and will be automatically defined accordingly to the objects being serialized.
19
18
Doesn't follow any specifc convention.
20
19
21
20
### JSONAPI
22
21
23
-
This adapter follows 1.0 of the format specified in
22
+
This adapter follows **version 1.0** of the format specified in
24
23
[jsonapi.org/format](http://jsonapi.org/format). It will include the associated
25
24
resources in the `"included"` member when the resource names are included in the
26
25
`include` option.
@@ -31,9 +30,9 @@ resources in the `"included"` member when the resource names are included in the
31
30
render @posts, include:'authors,comments'
32
31
```
33
32
34
-
## Choose an Adapter
33
+
## Choosing an adapter
35
34
36
-
If you want to use a different adapter, such as a JsonApi, you can change this in an initializer:
35
+
If you want to use a different adapter, such as JsonApi, you can change this in an initializer:
Copy file name to clipboardExpand all lines: docs/howto/add_root_key.md
+5-10Lines changed: 5 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# How to use add root key
1
+
# How to add root key
2
2
3
3
Add the root key to your API is quite simple with AMS. The **Adapter** is what determines the format of your JSON response. The default adapter is the ```FlattenJSON``` which doesn't have the root key, so your response is something similar to:
4
4
@@ -10,19 +10,14 @@ Add the root key to your API is quite simple with AMS. The **Adapter** is what d
10
10
}
11
11
```
12
12
13
-
In order to add the correspondent root key you need to use the ```JSON``` Adapter, you can change this in an initializer:
13
+
In order to add the root key you need to use the ```JSON``` Adapter, you can change this in an initializer:
0 commit comments