Skip to content

Commit ddeada3

Browse files
committed
Update documentation
1 parent 18ad8e0 commit ddeada3

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ Example:
7676
"hideIrrelevantMethods": true,
7777
"attributes": {
7878
"posts": ["title"]
79-
}
79+
},
80+
"include": [
81+
{"methods": "customMethod"},
82+
{"model": "post", "methods": "customMethod"},
83+
{"model": "person", "methods": ["customMethod1", "customMethod2"]}
84+
]
8085
}
8186
}
8287
```
@@ -171,6 +176,31 @@ The default behavior for modifying input only applies to the following methods o
171176
- `create`
172177
- `updateAttributes`
173178

179+
### include
180+
Allows whitelisting of methods.
181+
Define an array of whitelist objects. Whitelist objects can contain a "methods" key
182+
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
184+
the specified methods. If a combination of
185+
"model" and "methods" keys are used then the specific combination of model and methods
186+
specified will be serialized or deserialized using jsonapi.
187+
188+
#### example
189+
```js
190+
{
191+
...
192+
"include": [
193+
{"methods": "customMethod"},
194+
{"model": "post", "methods": "customMethod"},
195+
{"model": "person", "methods": ["customMethod1", "customMethod2"]}
196+
],
197+
...
198+
}
199+
```
200+
201+
- Type: `array`
202+
- Default: `null`
203+
174204
### hideIrrelevantMethods
175205
By default, `loopback-component-jsonapi` disables a number of methods from each endpoint
176206
that are not jsonapi relevant. These methods are:

0 commit comments

Comments
 (0)