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

Add param validator for allowed values #471

Closed
vickychijwani opened this issue Sep 14, 2013 · 1 comment
Closed

Add param validator for allowed values #471

vickychijwani opened this issue Sep 14, 2013 · 1 comment

Comments

@vickychijwani
Copy link
Contributor

It would be great if a list of allowed values could be specified for a parameter, something like:

params do
  optional :status, :type => Symbol, :values => [:not_started, :in_process, :done]
end
get 'tasks' do
  # list tasks, optionally filtered by status
end

Then GET /tasks?status=done should return 200 OK, and GET /tasks?status=foobar should return 400 Bad Request.

I'm willing to try to implement this, if others are interested in such a feature.

@dblock
Copy link
Member

dblock commented Sep 26, 2013

e7c44e0

@dblock dblock closed this as completed Sep 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants