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

Array of object is not built properly #88

Open
bekicot opened this issue Dec 21, 2018 · 0 comments
Open

Array of object is not built properly #88

bekicot opened this issue Dec 21, 2018 · 0 comments
Labels

Comments

@bekicot
Copy link

bekicot commented Dec 21, 2018

I have this definition in my API

params do
requires :daycare_attributes, type: Hash do
  requires :departments_attributes, type: Array do
    requires :name
  end
end

The UI shows
image

Which is fine. But when I try it, it doesn't build the array properly. In the curl, it built something like

curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d \
'daycare_attributes[departments_attributes]%5Bname%5D=Math&daycare_attributes[departments_attributes]%5Bname%5D=Phsyics' \
'http://localhost:3000/api/'

To pass the grape parameter validation. It must be

curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d \
'daycare_attributes[departments_attributes][][name]=Math&daycare_attributes[departments_attributes][][name]=Phsyics'\
 'http://localhost:3000/api/'

Both curl and UI xhr failed to pass the validation.

@dblock dblock added the bug? label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants