File tree 1 file changed +55
-1
lines changed
1 file changed +55
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ If you set the `resource_name` property on the object to `False` the data
55
55
will be returned without modification.
56
56
57
57
58
- ### Inflecting object keys
58
+ ### Inflecting object and relation keys
59
59
60
60
This package includes the ability (off by default) to automatically convert json
61
61
requests and responses from the python/rest_framework's preferred underscore to
@@ -120,6 +120,60 @@ Example - With format conversion set to `dasherize`:
120
120
}
121
121
```
122
122
123
+ #### Relationship types
124
+
125
+ A similar option to JSON\_ API\_ FORMAT\_ KEYS can be set for the relationship names:
126
+
127
+ ``` python
128
+ JSON_API_FORMAT_RELATION_KEYS = ' dasherize'
129
+ ```
130
+
131
+ Example without format conversion:
132
+
133
+ ``` js
134
+ {
135
+ " data" : [{
136
+ " type" : " identities" ,
137
+ " id" : 3 ,
138
+ " attributes" : {
139
+ ...
140
+ },
141
+ " relationships" : {
142
+ " home_town" : {
143
+ " data" : [{
144
+ " type" : " home_town" ,
145
+ " id" : 3
146
+ }]
147
+ }
148
+ }
149
+ }]
150
+ }
151
+ ```
152
+
153
+ When set to dasherize:
154
+
155
+
156
+ ``` js
157
+ {
158
+ " data" : [{
159
+ " type" : " identities" ,
160
+ " id" : 3 ,
161
+ " attributes" : {
162
+ ...
163
+ },
164
+ " relationships" : {
165
+ " home_town" : {
166
+ " data" : [{
167
+ " type" : " home-town" ,
168
+ " id" : 3
169
+ }]
170
+ }
171
+ }
172
+ }]
173
+ }
174
+ ```
175
+
176
+
123
177
<!--
124
178
### Relationships
125
179
### Links
You can’t perform that action at this time.
0 commit comments