Giter Site home page Giter Site logo

jsonapi-rb / jsonapi-rb Goto Github PK

View Code? Open in Web Editor NEW
236.0 12.0 4.0 9 KB

Efficiently produce and consume JSON API documents.

Home Page: http://jsonapi-rb.org

License: MIT License

Ruby 100.00%
json api ruby jsonapi serialization deserialization json-api

jsonapi-rb's Introduction

jsonapi-rb

Ruby gem for building and consuming JSON API documents.

Status

Gem Version Gitter chat

Resources

Code

jsonapi-rb is simply a bundle of:

For framework integrations, see:

Installation

# In Gemfile
gem 'jsonapi-rb'

then

$ bundle

or manually via

$ gem install jsonapi-rb

Usage and documentation

See jsonapi-rb.org/guides.

License

jsonapi-rb is released under the MIT License.

jsonapi-rb's People

Contributors

beauby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsonapi-rb's Issues

Abandoned?

Just wondering if this has been abandoned or not. Not seeing a commit in about 2 years and there is still a fair bit of documentation missing.

Demo on website doesn't say what to import

class SerializablePost < JSONAPI::Serializable::Resource
  type 'posts'

  attributes :title, :body

  attribute :date do
    @object.created_at
  end

  belongs_to :author

  has_many :comments do
    data do
      @object.published_comments
    end

    link :related do
      @url_helpers.user_posts_url(@object.id)
    end

    meta do
      { count: @object.published_comments.count }
    end
  end

  link :self do
    @url_helpers.post_url(@object.id)
  end

  meta do
    { featured: true }
  end
end

What do I pass to require to get that class loaded into ruby? I can't figure it out.

Add minitest and rspec matchers

Really awesome project, good work!

Perhaps a new sub repo could include helper methods for testing with Minitest and RSpec or is that out of the scope for the project?

Error handling with alias

Is there a way to make the errors pointer match the alias used in the serializer ?

serializer :

     attribute :reply do
        @object.content
    end

response when there is an error :
{"errors":[{"title":"Invalid content","detail":"Nouveau commentaire est trop court (au moins 16 caractères)","source":{}}],"jsonapi":{"version":"1.0"}}

Idealy source should contain a pointer to reply.
How can the errors be correctly serialized ?

Bring in jsonapi-renderer bugfix

I'm encountering the following error:

#<NoMethodError: undefined method `merge!' for #<Set: {}> Did you mean?  merge>
jsonapi-renderer (0.1.1) lib/jsonapi/renderer/resources_processor.rb:51:in `traverse_resource'
jsonapi-renderer (0.1.1) lib/jsonapi/renderer/resources_processor.rb:43:in `traverse_queue'
jsonapi-renderer (0.1.1) lib/jsonapi/renderer/resources_processor.rb:29:in `traverse_resources'

This appears to be fixed here: jsonapi-rb/jsonapi-renderer@8fa349b

Can you bring this into the jsonapi-rb and jsonapi-rails master branches? I'm having trouble installing.

Bundler could not find compatible versions for gem "jsonapi-renderer":
  In Gemfile:
    jsonapi-renderer (~> 0.1.2)

    jsonapi-rails was resolved to 0.1.1, which depends on
      jsonapi-rb (= 0.1.1) was resolved to 0.1.1, which depends on
        jsonapi-serializable (= 0.1.1) was resolved to 0.1.1, which depends on
          jsonapi-renderer (= 0.1.1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.