Added non_empty parameter validator to validate non-empty strings#743
Added non_empty parameter validator to validate non-empty strings#743elado wants to merge 9 commits into
non_empty parameter validator to validate non-empty strings#743Conversation
…d code to new way or writing custom validators.
|
I am really not a fan of the |
|
The code looks good otherwise, could be squashed. Lets talk about how to call this option, I prefer "positive" names rather than negative names. |
|
I agree, Thanks |
|
You should squash too, please, we like single nice looking commits. LMK if you need help with that. |
|
Actually, Thoughts? Is |
|
Anyway, there is a little problem with optional group and params do
optional :user, type: Hash do
requires :name, non_empty: true
end
end
get '/allow_empty_in_optional_group'
it '...' do
get '/allow_empty_in_optional_group'
expect(last_response.status).to eq(200) # fails
endI think, this behaviour should be documented before someone provides a common solution. |
|
OK. Renamed Tried to use Let me know if it's good now, I'll squash. |
|
Perfect. Merged squashed via dfbeb22. |
|
@elado , thanks! |
|
Thank you guys! |
The
PresenceValidatorvalidates only that the param is sent, but not if it's empty. Using Regexp validator seems too cumbersome for such a common task.An additional NonEmpty validator is very useful.
Also, I allowed myself to reorganize README validation section. I hope it's fine.