https://github.com/jsonapi-rb/jsonapi-renderer
Efficiently render JSON API documents.
https://github.com/jsonapi-rb/jsonapi-renderer
Keywords
api json json-api jsonapi jsonapi-rb serialization
Last synced: about 21 hours ago
JSON representation
Repository metadata
Efficiently render JSON API documents.
- Host: GitHub
- URL: https://github.com/jsonapi-rb/jsonapi-renderer
- Owner: jsonapi-rb
- License: mit
- Created: 2016-10-26T01:47:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-08-31T15:08:03.000Z (over 2 years ago)
- Last Synced: 2026-02-08T08:40:21.040Z (23 days ago)
- Topics: api, json, json-api, jsonapi, jsonapi-rb, serialization
- Language: Ruby
- Homepage: http://jsonapi-rb.org
- Size: 47.9 KB
- Stars: 29
- Watchers: 4
- Forks: 12
- Open Issues: 11
- Releases: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
jsonapi-renderer
Ruby gem for rendering JSON API documents.
Status
Resources
- Chat: gitter
- Twitter: @jsonapirb
- Docs: jsonapi-rb.org
Installation
# In Gemfile
gem 'jsonapi-renderer'
then
$ bundle
or manually via
$ gem install jsonapi-renderer
Usage
First, require the gem:
require 'jsonapi/renderer'
Rendering resources
A resource here is any class that implements the following interface:
class ResourceInterface
# Returns the type of the resource.
# @return [String]
def jsonapi_type; end
# Returns the id of the resource.
# @return [String]
def jsonapi_id; end
# Returns a hash containing, for each included relationship, an array of the
# resources to be included from that one.
# @param included_relationships [Array<Symbol>] The keys of the relationships
# to be included.
# @return [Hash{Symbol => Array<#ResourceInterface>}]
def jsonapi_related(included_relationships); end
# Returns a JSON API-compliant representation of the resource as a hash.
# @param options [Hash]
# @option fields [Set<Symbol>, Nil] The requested fields, or nil.
# @option include [Set<Symbol>] The requested relationships to
# include (defaults to []).
# @return [Hash]
def as_jsonapi(options = {}); end
end
Rendering a single resource
JSONAPI.render(data: resource,
include: include_string,
fields: fields_hash,
meta: meta_hash,
links: links_hash)
This returns a JSON API compliant hash representing the described document.
Rendering a collection of resources
JSONAPI.render(data: resources,
include: include_string,
fields: fields_hash,
meta: meta_hash,
links: links_hash)
This returns a JSON API compliant hash representing the described document.
Rendering a relationship
JSONAPI.render(data: resource,
relationship: :posts,
include: include_string,
fields: fields_hash,
meta: meta_hash,
links: links_hash)
This returns a JSON API compliant hash representing the described document.
Rendering errors
JSONAPI.render_errors(errors: errors,
meta: meta_hash,
links: links_hash)
where errors is an array of objects implementing the as_jsonapi method, that
returns a JSON API-compliant representation of the error.
This returns a JSON API compliant hash representing the described document.
Caching
The generated JSON fragments can be cached in any cache implementation
supporting the fetch_multi method.
When using caching, the serializable resources must implement an
additional jsonapi_cache_key method:
# Returns a cache key for the resource, parameterized by the `include` and
# `fields` options.
# @param options [Hash]
# @option fields [Set<Symbol>, Nil] The requested fields, or nil.
# @option include [Set<Symbol>] The requested relationships to
# include (defaults to []).
# @return [String]
def jsonapi_cache_key(options = {}); end
The cache instance must be passed to the renderer as follows:
JSONAPI.render(data: resources,
include: include_string,
fields: fields_hash,
cache: cache_instance)
License
jsonapi-renderer is released under the MIT License.
Owner metadata
- Name: jsonapi-rb
- Login: jsonapi-rb
- Email:
- Kind: organization
- Description: Efficient and convenient JSON API framework for ruby.
- Website: http://jsonapi-rb.org
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/23066863?v=4
- Repositories: 10
- Last ynced at: 2024-12-30T12:45:26.069Z
- Profile URL: https://github.com/jsonapi-rb
GitHub Events
Total
- Pull request event: 1
- Fork event: 1
- Watch event: 3
Last Year
- Watch event: 1
Committers metadata
Last synced: 2 days ago
Total Commits: 42
Total Committers: 6
Avg Commits per committer: 7.0
Development Distribution Score (DDS): 0.143
Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Lucas Hosseini | l****i@g****m | 36 |
| Dmytro Koval | d****l@m****l | 2 |
| Yann Berthou | f****n@g****m | 1 |
| Jonathan Mast | j****n@j****m | 1 |
| Dmytro Koval | d****f@m****u | 1 |
| Andrew Rove (Rover) | r****r@m****m | 1 |
Committer domains:
- mac.com: 1
- mail.ru: 1
- jonmast.com: 1
- medical-tribune.pl: 1
Issue and Pull Request metadata
Last synced: about 1 month ago
Total issues: 16
Total pull requests: 26
Average time to close issues: 4 months
Average time to close pull requests: 6 months
Total issue authors: 13
Total pull request authors: 10
Average comments per issue: 2.0
Average comments per pull request: 1.42
Merged pull request: 18
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 1
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 0.0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- beauby (3)
- NullVoxPopuli (2)
- zhouqing86 (1)
- arefaslani (1)
- caseyprovost (1)
- tappleby (1)
- hectorsq (1)
- kinopyo (1)
- quickdudley (1)
- vasilakisfil (1)
- samnang (1)
- SirRawlins (1)
- wizardone (1)
Top Pull Request Authors
- beauby (16)
- rovermicrover (2)
- FiloSpaTeam (2)
- kinopyo (1)
- alchimere (1)
- olleolleolle (1)
- ViliusLuneckas (1)
- jonmast (1)
- dawidof (1)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 12
-
Total downloads:
- rubygems: 186,668,614 total
- Total docker downloads: 34,514,992
- Total dependent packages: 8 (may contain duplicates)
- Total dependent repositories: 17,066 (may contain duplicates)
- Total versions: 28
- Total maintainers: 3
gem.coop: jsonapi-renderer
Efficiently render JSON API documents.
- Homepage: https://github.com/jsonapi-rb/jsonapi-renderer
- Documentation: http://www.rubydoc.info/gems/jsonapi-renderer/
- Licenses: MIT
- Latest release: 0.2.2 (published over 6 years ago)
- Last Synced: 2026-02-28T12:03:17.939Z (3 days ago)
- Versions: 9
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 93,334,307 Total
- Docker Downloads: 17,257,496
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Downloads: 0.285%
- Average: 0.327%
- Docker downloads count: 1.023%
- Maintainers (3)
rubygems.org: jsonapi-renderer
Efficiently render JSON API documents.
- Homepage: https://github.com/jsonapi-rb/jsonapi-renderer
- Documentation: http://www.rubydoc.info/gems/jsonapi-renderer/
- Licenses: MIT
- Latest release: 0.2.2 (published over 6 years ago)
- Last Synced: 2026-02-28T12:03:17.822Z (3 days ago)
- Versions: 9
- Dependent Packages: 8
- Dependent Repositories: 17,066
- Downloads: 93,334,307 Total
- Docker Downloads: 17,257,496
-
Rankings:
- Dependent repos count: 0.272%
- Downloads: 0.335%
- Docker downloads count: 1.116%
- Dependent packages count: 2.044%
- Average: 3.679%
- Forks count: 8.314%
- Stargazers count: 9.992%
- Maintainers (3)
ubuntu-22.04: ruby-jsonapi-renderer
- Homepage: https://github.com/jsonapi-rb/jsonapi-renderer
- Licenses:
- Latest release: 0.1.3-1.1 (published 18 days ago)
- Last Synced: 2026-02-13T13:19:29.005Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.10: ruby-jsonapi-renderer
- Homepage: https://github.com/jsonapi-rb/jsonapi-renderer
- Licenses:
- Latest release: 0.1.3-1.1 (published 18 days ago)
- Last Synced: 2026-02-13T18:24:14.644Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-11: ruby-jsonapi-renderer
- Homepage: https://github.com/jsonapi-rb/jsonapi-renderer
- Documentation: https://packages.debian.org/bullseye/ruby-jsonapi-renderer
- Licenses:
- Latest release: 0.1.3-1.1 (published 20 days ago)
- Last Synced: 2026-02-13T08:21:44.714Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-10: ruby-jsonapi-renderer
- Homepage: https://github.com/jsonapi-rb/jsonapi-renderer
- Documentation: https://packages.debian.org/buster/ruby-jsonapi-renderer
- Licenses:
- Latest release: 0.1.3-1 (published 20 days ago)
- Last Synced: 2026-02-13T04:22:38.579Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-20.04: ruby-jsonapi-renderer
- Homepage: https://github.com/jsonapi-rb/jsonapi-renderer
- Licenses:
- Latest release: 0.1.3-1 (published 18 days ago)
- Last Synced: 2026-02-13T07:16:37.571Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
ubuntu-23.04: ruby-jsonapi-renderer
- Homepage: https://github.com/jsonapi-rb/jsonapi-renderer
- Licenses:
- Latest release: 0.1.3-1.1 (published 20 days ago)
- Last Synced: 2026-02-11T06:42:19.653Z (20 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-jsonapi-renderer
- Homepage: https://github.com/jsonapi-rb/jsonapi-renderer
- Documentation: https://packages.debian.org/bookworm/ruby-jsonapi-renderer
- Licenses:
- Latest release: 0.1.3-1.1 (published 18 days ago)
- Last Synced: 2026-02-12T23:33:50.749Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
debian-13: ruby-jsonapi-renderer
- Homepage: https://github.com/jsonapi-rb/jsonapi-renderer
- Documentation: https://packages.debian.org/trixie/ruby-jsonapi-renderer
- Licenses:
- Latest release: 0.1.3-1.1 (published 19 days ago)
- Last Synced: 2026-02-13T13:17:08.725Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- rake ~> 11.3 development
- rspec ~> 3.5 development
- simplecov >= 0 development
Score: 24.69522062526882
