-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Optional nested array not validated #1636
Labels
Comments
The problem was inserted with this commit: 9a08358#diff-edc185e941279b3909ef50156ef72cd5 It doesn't validate fields in the params do
requires :root, type: Hash do
optional :some_things, type: Array do
requires :foo
optional :options, type: Array do
requires :name, type: String
requires :value, type: String
end
end
end
end
get '/nested_optional_array' do
{ root: params[:root] }
end
it 'allows optional arrays to be omitted' do
params = { some_things:
[{ foo: 'one', options: [{ value: 'nope' }] },
{ foo: 'two' },
{ foo: 'three', options: [{ name: 'wooop', value: 'yap' }] }] }
get '/nested_optional_array', root: params
expect(last_response.status).to eq(200)
expect(last_response.body).to eq({ root: params }.to_json)
end |
I'll do a PR for fixing that. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Branch:
master
Works under version :
0.13.0
Hard to explain so here are 2 specs that should pass but the last one is failing :
The
nested_array
is optional but when there's at least one element in the parent array that doesn't have it, all other elements with anested_array
aren't validatedI'll try to figure it out.
Thanks
The text was updated successfully, but these errors were encountered: