Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsonapi-rb/jsonapi-parser
Validate JSON API documents.
https://github.com/jsonapi-rb/jsonapi-parser
api deserialization json json-api jsonapi jsonapi-rb validation
Last synced: 13 days ago
JSON representation
Validate JSON API documents.
- Host: GitHub
- URL: https://github.com/jsonapi-rb/jsonapi-parser
- Owner: jsonapi-rb
- License: mit
- Created: 2016-10-26T01:47:08.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-09T01:25:47.000Z (over 6 years ago)
- Last Synced: 2024-09-19T09:21:40.730Z (about 2 months ago)
- Topics: api, deserialization, json, json-api, jsonapi, jsonapi-rb, validation
- Language: Ruby
- Homepage: http://jsonapi-rb.org
- Size: 8.79 KB
- Stars: 27
- Watchers: 4
- Forks: 10
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsonapi-parser
Ruby gem for validating [JSON API](http://jsonapi.org) documents.## Status
[![Gem Version](https://badge.fury.io/rb/jsonapi-parser.svg)](https://badge.fury.io/rb/jsonapi-parser)
[![Build Status](https://secure.travis-ci.org/jsonapi-rb/jsonapi-parser.svg?branch=master)](http://travis-ci.org/jsonapi-rb/parser?branch=master)
[![codecov](https://codecov.io/gh/jsonapi-rb/jsonapi-parser/branch/master/graph/badge.svg)](https://codecov.io/gh/jsonapi-rb/parser)
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/jsonapi-rb/Lobby)## Resources
* Chat: [gitter](http://gitter.im/jsonapi-rb)
* Twitter: [@jsonapirb](http://twitter.com/jsonapirb)
* Docs: [jsonapi-rb.org](http://jsonapi-rb.org)## Installation
```ruby
# In Gemfile
gem 'jsonapi-parser'
```
then
```
$ bundle
```
or manually via
```
$ gem install jsonapi-parser
```## Usage
First, require the gem:
```ruby
require 'jsonapi/parser'
```
Then simply parse a document:
```ruby
# This will raise JSONAPI::Parser::InvalidDocument if an error is found.
JSONAPI.parse_response!(document_hash)
```
or a resource create/update payload:
```ruby
JSONAPI.parse_resource!(document_hash)
```
or a relationship update payload:
```ruby
JSONAPI.parse_relationship!(document_hash)
```## License
jsonapi-parser is released under the [MIT License](http://www.opensource.org/licenses/MIT).