rspec_api_documentation
rspec_api_documentation copied to clipboard
How to handle an array of embedded JSON Objects?
Given the following example POST payload, how would you configure rspec_api_documentation for the authors key given it is an Array of N-objects?
{
"book" : {
"id": "2",
"name": "Awesome",
"authors": [
{ "first_name": "Justin", "last_name": "Smestad" }
]
}
}
I'm also trying to figure out how to handle arrays. Did you ever come up with a solution to this?
Nope
something like that:
...
parameter :authors, scope: :book
let(:authors) do
[{
first_name: 'Justin',
last_name: 'Smestad'
}]
end
route_description <<-DESC
authors:
first_name: :string, :required
last_name: :string, :required
DESC