-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nice format for JSON-API #308
Comments
I want to add that now it is not easy to declare information about relationship. For example, to create a Comment I need to specify its Post and User:
And in my request I have: post "comments" do
parameter :text, "String", required: true, scope: [:data, :attributes]
parameter :id, "Integer", required: true, scope: [:data, :relationships, :post, :data]
parameter :id, "Integer", required: true, scope: [:data, :relationships, :user, :data]
let(:id) { post.id } # goes in both id parameters
... Maybe it will be convenient to specify a |
@sineed I think a method addition would be great, that would solve a good deal of recurring issues. If you have the time, I would gladly look at a PR. I am not sure when I'll be able to get to this myself. |
@oestrich yes, I think I can find some time to implement this |
I found here that I can use the following declaration to accomplish my case: let(:data_relationships_user_data_id) { user.id }
let(:data_relationships_post_data_id) { post.id } Looks quite heavy but I think that this is problem of JSON API =) Also from docs:
For me it is more than enough |
@oestrich I can make a PR anyway if you wish |
I think having the ability to specify a method is still valuable to have. It would solve issues where someone has |
FYI, in #313 (adds APIB support), I had to have a |
Hey all,
Thanks for your great work on this. I'm interested in documenting a JSON-API implementation using the
jsoinapi-resources
gem, and I'm wondering about the fact that attributes and relationships include a lot of repeated boilerplate, e.g. if I wanted to document some attributes on a user object:I end up with a lot of repetition in my parameters, e.g.
["data", "attributes"][email]
,["data", "attributes"][first_name]
,["data", "attributes"][last_name]
, etc. rather than just listing e.g. ("email", "first_name", "last_name") and having it be understood that they were all stored in data[attributes] following the JSON-API schema. Is there a way to simplify the presentation?Thanks,
The text was updated successfully, but these errors were encountered: