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: README.md
+17-18Lines changed: 17 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,7 +117,7 @@ Whether the component should be enabled or disabled. Defaults to `true`, flip it
117
117
118
118
### handleErrors
119
119
When true, the component will unregister all other error handling and
120
-
register a custom error handler which always returns errors in jsonapi compliant
120
+
register a custom error handler which always returns errors in JSON API compliant
121
121
format. Validation errors include the correct properties in order to work
122
122
out of the box with EmberJS.
123
123
@@ -137,10 +137,10 @@ out of the box with EmberJS.
137
137
Allows blacklisting of models and methods.
138
138
Define an array of blacklist objects. Blacklist objects can contain "model" key
139
139
"methods" key or both. If just "model" is defined then all methods for the
140
-
specified model will not be serialized of deserialized using jsonapi. If just the "methods" key is defined then
141
-
all methods specified on all models will be serialized or deserialized using jsonapi. If a combination of
140
+
specified model will not be serialized of deserialized using JSON API. If just the "methods" key is defined then
141
+
all methods specified on all models will not be serialized or deserialized using JSON API. If a combination of
142
142
"model" and "methods" keys are used then the specific combination of model and methods
143
-
specified will not be serialized or deserialized using jsonapi.
143
+
specified will not be serialized or deserialized using JSON API.
144
144
145
145
#### example
146
146
```js
@@ -160,8 +160,7 @@ specified will not be serialized or deserialized using jsonapi.
160
160
- Default: `null`
161
161
162
162
#### Note
163
-
The default component behavior is to modify the output of the following CRUD model methods
164
-
methods on all models:
163
+
The default behavior is to modify (serialize to JSON API) the output of the following CRUD methods on all models:
165
164
-`find`
166
165
-`create`
167
166
-`updateAttributes`
@@ -172,20 +171,20 @@ In addition the following wild card method names are matched and the output is m
172
171
-`__get__.*`
173
172
-`__findRelationships__.*`
174
173
175
-
The default behavior for modifying input only applies to the following methods on all models:
174
+
The default behavior is to modify (deserialize from JSON API) the input to the following CRUD methods on all models:
176
175
-`create`
177
176
-`updateAttributes`
178
177
179
178
### include
180
179
Allows whitelisting of methods.
181
180
Define an array of whitelist objects. Whitelist objects can contain a "methods" key
182
181
or both a "models" key and a "methods" key. If just the "methods" key is defined then
183
-
the methods specified will be serialized or deserialized using jsonapi on all models that have
182
+
the methods specified will be serialized or deserialized using JSON API on all models that have
184
183
the specified methods. If a combination of
185
184
"model" and "methods" keys are used then the specific combination of model and methods
186
-
specified will be serialized or deserialized using jsonapi.
185
+
specified will be serialized or deserialized using JSON API.
187
186
188
-
Note: objects returned from a remote method that will be jsonapi serialized MUST include
187
+
Note: objects returned from a remote method that will be JSON API serialized MUST include
189
188
an id property. id property can be null.
190
189
191
190
#### example
@@ -206,7 +205,7 @@ an id property. id property can be null.
206
205
207
206
### hideIrrelevantMethods
208
207
By default, `loopback-component-jsonapi` disables a number of methods from each endpoint
209
-
that are not jsonapi relevant. These methods are:
208
+
that are not JSON API relevant. These methods are:
210
209
-`upsert`
211
210
-`exists`
212
211
-`findOne`
@@ -215,7 +214,7 @@ that are not jsonapi relevant. These methods are:
215
214
-`updateAll`
216
215
217
216
You can use this option to prevent `loopback-component-jsonapi` from doing so. These methods are not modified by the component. Their output
218
-
will not be in a jsonapi compliant format.
217
+
will not be in a JSON API compliant format.
219
218
220
219
#### example
221
220
```js
@@ -230,7 +229,7 @@ will not be in a jsonapi compliant format.
230
229
- Default: `true`
231
230
232
231
### attributes
233
-
By default, model properties will be converted to attributes in jsonapi terms.
232
+
By default, model properties will be converted to attributes in JSON API terms.
234
233
All model properties except the primary key and any foreign keys will be copied into
235
234
the attributes object before output. If you wish to limit which properties will
236
235
be output as attributes you can specify a whitelist of attributes for each type.
@@ -251,7 +250,7 @@ be output as attributes you can specify a whitelist of attributes for each type.
251
250
- Default: `null`
252
251
253
252
#### note
254
-
The attributes arrays are keyed by type not by model name. Type is the term used by json api to describe the resource type in question and while not required by json api it is usually plural. In `loopback-component-jsonapi` it is whatever the models `plural` is set to in `model.json`. So in our example above we defined: `"posts": ["title", "content"]` as the resource type for the `post` model is `posts`
253
+
The attributes arrays are keyed by type not by model name. Type is the term used by JSON API to describe the resource type in question and while not required by JSON API it is usually plural. In `loopback-component-jsonapi` it is whatever the models `plural` is set to in `model.json`. So in our example above we defined: `"posts": ["title", "content"]` as the resource type for the `post` model is `posts`
255
254
256
255
## Custom Serialization
257
256
For occasions where you need greater control over the serialization process, you can implement a custom serialization function for each model as needed. This function will be used instead of the regular serialization process.
@@ -312,7 +311,7 @@ module.exports = function (MyModel) {
312
311
313
312
###### `options.type`
314
313
Resource type. Originally calculated from a models plural. Is used in the default
315
-
serialization process to set the type property for each model in a jsonapi response.
314
+
serialization process to set the type property for each model in a JSON API response.
316
315
- eg. `posts`
317
316
318
317
###### `options.method`
@@ -342,11 +341,11 @@ The api prefix used before resource information. Can be used in conjunction with
342
341
- eg. `/api`
343
342
344
343
###### `options.topLevelLinks`
345
-
JSON API links object used at the top level of the JSON API response structure.
344
+
Links object used at the top level of the JSON API response structure.
0 commit comments