Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ Calling the `serialize` method on the returned object will serialize your `data`
#### Available serialization option (`opts` argument)

- **attributes**: An array of attributes to show. You can define an attribute as an option if you want to define some relationships (included or not).
- **ref**: If present, it's considered as a relationships.
- **included**: Consider the relationships as [compound document](http://jsonapi.org/format/#document-compound-documents). Default: true.
- **id**: Configurable identifier field for the resource. Default: `id`.
- **attributes**: An array of attributes to show.
- **topLevelLinks**: An object that describes the top-level links. Values can be *string* or a *function*
- **dataLinks**: An object that describes the links inside data. Values can be *string* or a *function* (see examples below)
- **dataMeta**: An object that describes the meta inside data. Values can be a plain value or a *function* (see examples below)
- **relationshipLinks**: An object that describes the links inside relationships. Values can be *string* or a *function*
- **relationshipMeta**: An object that describes the meta inside relationships. Values can be a plain value or a *function*
- **ignoreRelationshipData**: Do not include the `data` key inside the relationship. Default: false.
- **keyForAttribute**: A function or string to customize attributes. Functions are passed the attribute as a single argument and expect a string to be returned. Strings are aliases for inbuilt functions for common case conversions. Options include: `dash-case` (default), `lisp-case`, `spinal-case`, `kebab-case`, `underscore_case`, `snake_case`, `camelCase`, `CamelCase`.
- **nullIfMissing**: Set the attribute to null if missing from your data input. Default: false.
- **pluralizeType**: A boolean to indicate if the type must be pluralized or not. Default: true.
- **typeForAttribute**: A function that maps the attribute (passed as an argument) to the type you want to override. If it returns `undefined`, ignores the flag for that attribute. Option *pluralizeType* ignored if set.
- **meta**: An object to include non-standard meta-information. Values can be a plain value or a *function*
- **transform**: A function to transform each record before the serialization.
- **ref**: If present, it's considered as a relationships.
- **included**: Consider the relationships as [compound document](http://jsonapi.org/format/#document-compound-documents). Default: true.
- **id**: Configurable identifier field for the resource. Default: `id`.
- **attributes**: An array of attributes to show.
- **topLevelLinks**: An object that describes the top-level links. Values can be *string* or a *function*
- **dataLinks**: An object that describes the links inside data. Values can be *string* or a *function* (see examples below)
- **dataMeta**: An object that describes the meta inside data. Values can be a plain value or a *function* (see examples below)
- **relationshipLinks**: An object that describes the links inside relationships. Values can be *string* or a *function*
- **relationshipMeta**: An object that describes the meta inside relationships. Values can be a plain value or a *function*
- **ignoreRelationshipData**: Do not include the `data` key inside the relationship. Default: false.
- **keyForAttribute**: A function or string to customize attributes. Functions are passed the attribute as a single argument and expect a string to be returned. Strings are aliases for inbuilt functions for common case conversions. Options include: `dash-case` (default), `lisp-case`, `spinal-case`, `kebab-case`, `underscore_case`, `snake_case`, `camelCase`, `CamelCase`.
- **nullIfMissing**: Set the attribute to null if missing from your data input. Default: false.
- **pluralizeType**: A boolean to indicate if the type must be pluralized or not. Default: true.
- **typeForAttribute**: A function that maps the attribute (passed as an argument) to the type you want to override. If it returns `undefined`, ignores the flag for that attribute. Option *pluralizeType* ignored if set.
- **meta**: An object to include non-standard meta-information. Values can be a plain value or a *function*
- **transform**: A function to transform each record before the serialization.

**Examples**

Expand Down