File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,11 @@ You can define validations and coercion options for your parameters using `param
220220params do
221221 requires :id , type: Integer
222222 optional :name , type: String , regexp: /^[a-z] +$/
223+
224+ group :user do
225+ requires :first_name
226+ requires :last_name
227+ end
223228end
224229get ' :id' do
225230 # params[:id] is an Integer
229234When a type is specified an implicit validation is done after the coercion to ensure
230235the output type is the one declared.
231236
237+ Parameters can be nested using ` group ` . In the above example, this means both
238+ ` params[:user][:first_name] ` and ` params[:user][:last_name] ` are required next to ` params[:id] ` .
239+
232240### Namespace Validation and Coercion
233241Namespaces allow parameter definitions and apply to every method within the namespace.
234242
You can’t perform that action at this time.
0 commit comments