Ruby gem for validating JSON API documents.
# In Gemfile
gem 'jsonapi-parser'
then
$ bundle
or manually via
$ gem install jsonapi-parser
First, require the gem:
require 'jsonapi/parser'
Then simply parse a document:
# This will raise JSONAPI::Parser::InvalidDocument if an error is found.
JSONAPI.parse_response!(document_hash)
or a resource create/update payload:
JSONAPI.parse_resource!(document_hash)
or a relationship update payload:
JSONAPI.parse_relationship!(document_hash)
jsonapi-parser is released under the MIT License.