The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

JSON::API::v1 - A JSON API object according to jsonapi.org v1 specification

VERSION

version 0.002

SYNOPSIS

    use JSON::API::v1;

    my $object = JSON::API::v1->new(
        data => JSON::API::v1::Resource->new(
            ...
        );
    );

    $object->add_error(JSON::API::v1::Error->new(...));

    $object->add_relationship(JSON::API::v1::Error->new(...));

DESCRIPTION

This module attempts to make a Moose object behave like a JSON API object as defined by jsonapi.org. This object adheres to the v1 specification

ATTRIBUTES

data

This data object is there a JSON::API::v1::Resource lives.

errors

This becomes an array ref of JSON::API::v1::Error once you start adding errors to this object object via add_error.

included

This becomes an array ref of JSON::API::v1::Resource once you start adding additional resources to this object object via add_included.

is_set

This is to tell the object it is a set and you can add data to it via add_data. It will in turn JSON-y-fi the data to an array of the data you've added. If you don't set this via the constructer, please read the documentation of "add_data" in JSON::API::v1

METHODS

add_data

You can add individual JSON::API::v1::Resource objects to the toplevel object. If you have not set is_set the first call to this function will assume you're adding data and thus want to be a set.

add_error

You can add individual JSON::API::v1::Error objects to the toplevel object.

add_included

You can add individual JSON::API::v1::Resource objects to the toplevel object.

AUTHOR

Wesley Schwengle <waterkip@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2020 by Wesley Schwengle.

This is free software, licensed under:

  The (three-clause) BSD License