-
-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Is your feature request related to a problem? *
From my current point of view, this library does not allow to add other links, besides pagination, then self or related to the document or resource. The JSON:API specification does not describe a restriction to this.
As an example, it is not possible to describe an API entry point that only contains links and might also contain document metadata.
Describe the solution you'd like*
I could imagine, that the properties document and resource in the linkers option will allow a map containing the link names, self as an example, as the key, and the Linker as the value.
Example:
return new Serializer('', {
version: null,
linkers: {
document: {
self: new Linker(() => 'https://example.com/api'),
resource: new Linker() => 'https://example.com/api/resources').
},
},
metaizers: {
document: new Metaizer(() => ({
foo: 'bar',
})),
},
}).serialize(undefined);
Another solution might be that the Linker could return a map of links:
Example:
return new Serializer('', {
version: null,
linkers: {
document: new Linker(() => ({
self: 'https://example.com/api',
resource: 'https://example.com/api/resources'
})),
},
metaizers: {
document: new Metaizer(() => ({
foo: 'bar',
})),
},
}).serialize(undefined);
Describe alternatives you've considered*
Serializing resources with other links by hand or amending the serialization result.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers