From f64c4497da1af0871461d1ff4a24e13747997f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Rodrigo?= Date: Tue, 26 Jul 2016 17:31:09 +0200 Subject: [PATCH] Check Array nested in Array and Hash --- ..._swagger_v2_param_type_body_nested_spec.rb | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb b/spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb index f988a7d8..7afd808d 100644 --- a/spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb +++ b/spec/swagger_v2/api_swagger_v2_param_type_body_nested_spec.rb @@ -17,7 +17,7 @@ class NestedBodyParamTypeApi < Grape::API requires :street, type: String, documentation: { desc: 'street', in: 'body' } requires :postcode, type: String, documentation: { desc: 'postcode', in: 'body' } requires :city, type: String, documentation: { desc: 'city', in: 'body' } - optional :country, type: String, documentation: { desc: 'country', in: 'body' } + optional :country, type: Array[String], documentation: { desc: 'country', in: 'body' } end end end @@ -36,7 +36,7 @@ class NestedBodyParamTypeApi < Grape::API optional :street, type: String, documentation: { desc: 'street', in: 'body' } optional :postcode, type: String, documentation: { desc: 'postcode', in: 'formData' } optional :city, type: String, documentation: { desc: 'city', in: 'body' } - optional :country, type: String, documentation: { desc: 'country', in: 'body' } + optional :country, type: Array[String], documentation: { desc: 'country', in: 'body' } end end @@ -55,13 +55,13 @@ class NestedBodyParamTypeApi < Grape::API optional :street, type: String, documentation: { desc: 'street', in: 'body' } requires :postcode, type: Integer, documentation: { desc: 'postcode', in: 'formData' } optional :city, type: String, documentation: { desc: 'city', in: 'body' } - optional :country, type: String, documentation: { desc: 'country', in: 'body' } + optional :country, type: Array[String], documentation: { desc: 'country', in: 'body' } end optional :delivery_address, type: Hash do optional :street, type: String, documentation: { desc: 'street', in: 'body' } optional :postcode, type: String, documentation: { desc: 'postcode', in: 'formData' } optional :city, type: String, documentation: { desc: 'city', in: 'body' } - optional :country, type: String, documentation: { desc: 'country', in: 'body' } + optional :country, type: Array[String], documentation: { desc: 'country', in: 'body' } end end end @@ -79,13 +79,13 @@ class NestedBodyParamTypeApi < Grape::API optional :street, type: String, documentation: { desc: 'street', in: 'body' } requires :postcode, type: String, documentation: { desc: 'postcode', in: 'formData' } optional :city, type: String, documentation: { desc: 'city', in: 'body' } - optional :country, type: String, documentation: { desc: 'country', in: 'body' } + optional :country, type: Array[String], documentation: { desc: 'country', in: 'body' } end optional :delivery_address, type: Hash do optional :street, type: String, documentation: { desc: 'street', in: 'body' } optional :postcode, type: String, documentation: { desc: 'postcode', in: 'formData' } optional :city, type: String, documentation: { desc: 'city', in: 'body' } - optional :country, type: String, documentation: { desc: 'country', in: 'body' } + optional :country, type: Array[String], documentation: { desc: 'country', in: 'body' } end end @@ -134,7 +134,7 @@ def app 'street' => { 'type' => 'string', 'description' => 'street' }, 'postcode' => { 'type' => 'string', 'description' => 'postcode' }, 'city' => { 'type' => 'string', 'description' => 'city' }, - 'country' => { 'type' => 'string', 'description' => 'country' } + 'country' => { 'type' => 'array', 'items' => { 'type' => 'string' }, 'description' => 'country' } }, 'required' => %w(street postcode city) } @@ -169,7 +169,7 @@ def app 'street' => { 'type' => 'string', 'description' => 'street' }, 'postcode' => { 'type' => 'string', 'description' => 'postcode' }, 'city' => { 'type' => 'string', 'description' => 'city' }, - 'country' => { 'type' => 'string', 'description' => 'country' } + 'country' => { 'type' => 'array', 'items' => { 'type' => 'string' }, 'description' => 'country' } } } }, @@ -215,7 +215,7 @@ def app 'street' => { 'type' => 'string', 'description' => 'street' }, 'postcode' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'postcode' }, 'city' => { 'type' => 'string', 'description' => 'city' }, - 'country' => { 'type' => 'string', 'description' => 'country' } + 'country' => { 'type' => 'array', 'items' => { 'type' => 'string' }, 'description' => 'country' } }, 'required' => ['postcode'] } @@ -226,7 +226,7 @@ def app 'street' => { 'type' => 'string', 'description' => 'street' }, 'postcode' => { 'type' => 'string', 'description' => 'postcode' }, 'city' => { 'type' => 'string', 'description' => 'city' }, - 'country' => { 'type' => 'string', 'description' => 'country' } + 'country' => { 'type' => 'array', 'items' => { 'type' => 'string' }, 'description' => 'country' } } } }, @@ -259,7 +259,7 @@ def app 'street' => { 'type' => 'string', 'description' => 'street' }, 'postcode' => { 'type' => 'string', 'description' => 'postcode' }, 'city' => { 'type' => 'string', 'description' => 'city' }, - 'country' => { 'type' => 'string', 'description' => 'country' } + 'country' => { 'type' => 'array', 'items' => { 'type' => 'string' }, 'description' => 'country' } }, 'required' => ['postcode'] }, @@ -269,7 +269,7 @@ def app 'street' => { 'type' => 'string', 'description' => 'street' }, 'postcode' => { 'type' => 'string', 'description' => 'postcode' }, 'city' => { 'type' => 'string', 'description' => 'city' }, - 'country' => { 'type' => 'string', 'description' => 'country' } + 'country' => { 'type' => 'array', 'items' => { 'type' => 'string' }, 'description' => 'country' } } } },