You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
with_options scope: [:data, :attributes] do
parameter :email
end
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?
post"comments"doparameter: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 method option of parameter, because now I can't use let mapping feature
@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.
Looks quite heavy but I think that this is problem of JSON API =)
Also from docs:
The value of scoped parameters can be set with both scoped (let(:order_item_item_id)) and unscoped (let(:item_id)) methods. It always searches for the scoped method first and falls back to the unscoped method.
I think having the ability to specify a method is still valuable to have. It would solve issues where someone has client as a parameter, RAD is not happy in those cases. I would still love to see a PR for this.
FYI, in #313 (adds APIB support), I had to have a method somehow because APIB specs group docs by that. So I made it work but only for .apib documents though. Adding general support shouldn't be hard.
Activity
sineed commentedon Nov 10, 2016
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:
Maybe it will be convenient to specify a
methodoption of parameter, because now I can't useletmapping featureoestrich commentedon Nov 10, 2016
@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.
sineed commentedon Nov 10, 2016
@oestrich yes, I think I can find some time to implement this
sineed commentedon Nov 10, 2016
I found here that I can use the following declaration to accomplish my case:
Looks quite heavy but I think that this is problem of JSON API =)
Also from docs:
For me it is more than enough
sineed commentedon Nov 10, 2016
@oestrich I can make a PR anyway if you wish
oestrich commentedon Nov 10, 2016
I think having the ability to specify a method is still valuable to have. It would solve issues where someone has
clientas a parameter, RAD is not happy in those cases. I would still love to see a PR for this.kurko commentedon Dec 6, 2016
FYI, in #313 (adds APIB support), I had to have a
methodsomehow because APIB specs group docs by that. So I made it work but only for.apibdocuments though. Adding general support shouldn't be hard.