struct JSONAPI::ResourceInput

Overview

Validated input resource extracted from an incoming JSON:API request body.

Defined in:

jsonapi/deserializer.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(type : String, id : String | Nil = nil, attributes : Hash(String, JSON::Any) = Hash(String, JSON::Any).new, relationships : Hash(String, RelationshipInput) = Hash(String, RelationshipInput).new) #

[View source]

Instance Method Detail

def attribute(name : String) : JSON::Any #

[View source]
def attribute?(name : String) : JSON::Any | Nil #

[View source]
def attributes : Hash(String, JSON::Any) #

[View source]
def attributes_as(klass : T.class) : T forall T #

Maps #attributes into a JSON::Serializable Crystal struct or class.


[View source]
def id : String | Nil #

[View source]
def relationship_id(name : String) : String | Nil #

[View source]
def relationship_ids(name : String) : Array(String) #

[View source]
def relationships : Hash(String, RelationshipInput) #

[View source]
def type : String #

[View source]