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
Improves the serialization of errors to be compliant with the JSON:API
spec:
* Remove explicit check for `Error` instances and, instead, validate
both instances of `Error` and POJOs using `validateError`
* Restrict `links` object properties to `about`
* Restrict `links.about` object property type to string
* Restrict `source` object properties to `pointer` and `parameter`
* Restrict `meta` object property type to object
* Add function for validating `status` against a list of known HTTP
status codes
* Restrict `status` object property type to number
* Support both `status` and `statusCode` properties
* Add tests for new functionality
* Update tests for changed functionality
* Update README.md with additional usage examples
closes#110closes#111
***deserialize** (optional): Describes the function which should be used to deserialize a related property which is not included in the JSON:API document. It should be:
55
55
* A _function_ with one argument `function(data) { ... }`which defines the format to which a relation should be deserialized. By default, the ID of the related object is returned, which would be equal to `function(data) {return data.id}`. See [issue #65](https://github.com/danivek/json-api-serializer/issues/65).
56
56
***convertCase** (optional): Case conversion for serializing data. Value can be : `kebab-case`, `snake_case`, `camelCase`
57
-
***beforeSerialize** (optional): A _function_ with one argument `beforeSerialize(data) => newData` to transform data before serialization.
57
+
***beforeSerialize** (optional): A _function_ with one argument `beforeSerialize(data) => newData` to transform data before serialization.
Serializes any error into a JSON API error document.
428
428
429
429
Input data can be:
430
-
- An instance of Error or an array of instance of Error.
431
-
- A [JSON API error object](http://jsonapi.org/format/#error-objects) or an array of [JSON API error object](http://jsonapi.org/format/#error-objects).
430
+
- An instance of `Error` or an array of `Error` instances.
431
+
- A [JSON API error object](http://jsonapi.org/format/#error-objects) or an array of [JSON API error objects](http://jsonapi.org/format/#error-objects).
0 commit comments