Skip to content

Is it possible to include resource level meta information? #73

@kbsanders

Description

@kbsanders

The JSON API spec states that resources can contain their own meta information:

https://jsonapi.org/format/#document-resource-objects

meta: a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship.

Note that this is different than top level (root) meta or relationship level meta. This is meta information that appears on each resource object.

I don't see a way to include resource meta using the serializer.

Trying to include a meta object or function when I register my type throws an error:

serializer.register( "Activity", {
    id: "activityId",
    whitelist: [ "name" ],
    topLevelMeta: { ... }, // <- Not the same as resource level meta
    meta: { ... } // <- Throws an error
});

Error: ValidationError: "meta" is not allowed

Is it possible to include resource level meta information?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions