File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -207,10 +207,14 @@ get ':id' do
207207end
208208```
209209
210- The coercion is handled by the [ Virtus ] ( https://github.com/solnic/virtus ) gem which will convert the value if possible but
211- in case of invalid input nothing will be done (ex: asking to coerce "ex" to Integer will return "ex" ).
212- Proper type validation could be added later when Virtus will get a way to tell us .
210+ Declaring a parameter type causes the value to be coerced into that type, where possible.
211+ There is now implicit validation meaning that invalid input such as "foo" for an Integer will be left unmodified and passed through into the API,
212+ this might change in a future release .
213213
214+ However validations are executed in the order defined which allows you to do this:
215+ ``` ruby
216+ requires :id , regexp: /^[0-9] +$/ , type: Integer
217+ ```
214218
215219## Headers
216220
You can’t perform that action at this time.
0 commit comments