Skip to content
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

How to handle an array of embedded JSON Objects? #319

Open
jsmestad opened this issue Jan 3, 2017 · 3 comments
Open

How to handle an array of embedded JSON Objects? #319

jsmestad opened this issue Jan 3, 2017 · 3 comments

Comments

@jsmestad
Copy link
Contributor

jsmestad commented Jan 3, 2017

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" }
    ]
  }
}
@jsmestad jsmestad changed the title How to handle a embedded JSON Object? How to handle an array of embedded JSON Objects? Jan 3, 2017
@arronmabrey
Copy link

I'm also trying to figure out how to handle arrays. Did you ever come up with a solution to this?

@jsmestad
Copy link
Contributor Author

Nope

@zarapustra
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants