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
Are there any options to trigger error responses if extra parameters are provided? I'd like to get errors by default if a caller provides fields beyond my specification. I understand that I can strip them with declared but I want to tell people when they're calling my API incorrectly and I'd prefer not to have to write boilerplate to compare params and declared(params) for every route.
To be clear, I'm looking for this configuration:
params do
requires :user, type: Hash do
requires :name, type: String
end
end
This is a dup of #810, so I am going to close it, but this is a great feature! Would love to see someone contribute a solution for it. There are some ideas in that issue about how this could be implemented.
Are there any options to trigger error responses if extra parameters are provided? I'd like to get errors by default if a caller provides fields beyond my specification. I understand that I can strip them with
declared
but I want to tell people when they're calling my API incorrectly and I'd prefer not to have to write boilerplate to compareparams
anddeclared(params)
for every route.To be clear, I'm looking for this configuration:
to return a 400 if I provide the following JSON:
The text was updated successfully, but these errors were encountered: