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
207
207
end
208
208
```
209
209
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 .
213
213
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
+ ```
214
218
215
219
## Headers
216
220
You can’t perform that action at this time.
0 commit comments