@@ -135,33 +135,44 @@ class DocumentedHashAndArrayModel < Grape::Entity
135135
136136 let ( :swagger_definitions_models ) do
137137 {
138- 'ApiError' => { 'type' => 'object' , 'properties' => { 'code' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'status code' } , 'message' => { 'type' => 'string' , 'description' => 'error message' } } } ,
139- 'ResponseItem' => { 'type' => 'object' , 'properties' => { 'id' => { 'type' => 'integer' , 'format' => 'int32' } , 'name' => { 'type' => 'string' } } } ,
140- 'UseResponse' => { 'type' => 'object' , 'properties' => { 'description' => { 'type' => 'string' } , '$responses' => { 'type' => 'array' , 'items' => { '$ref' => '#/definitions/ResponseItem' } } } } ,
141- 'RecursiveModel' => { 'type' => 'object' , 'properties' => { 'name' => { 'type' => 'string' , 'description' => 'The name.' } , 'children' => { 'type' => 'array' , 'items' => { '$ref' => '#/definitions/RecursiveModel' } , 'description' => 'The child nodes.' } } } ,
142- 'DocumentedHashAndArrayModel' => { 'type' => 'object' , 'properties' => { 'raw_hash' => { 'type' => 'object' , 'description' => 'Example Hash.' } , 'raw_array' => { 'type' => 'array' , 'description' => 'Example Array' } } }
138+ 'ApiError' => { 'type' => 'object' , 'properties' => { 'code' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'status code' } , 'message' => { 'type' => 'string' , 'description' => 'error message' } } , 'required' => %w[ code message ] } ,
139+ 'ResponseItem' => { 'type' => 'object' , 'properties' => { 'id' => { 'type' => 'integer' , 'format' => 'int32' } , 'name' => { 'type' => 'string' } } , 'required' => %w[ id name ] } ,
140+ 'UseResponse' => { 'type' => 'object' , 'properties' => { 'description' => { 'type' => 'string' } , '$responses' => { 'type' => 'array' , 'items' => { '$ref' => '#/definitions/ResponseItem' } } } , 'required' => [ 'description' , '$responses' ] } ,
141+ 'RecursiveModel' => { 'type' => 'object' , 'properties' => { 'name' => { 'type' => 'string' , 'description' => 'The name.' } , 'children' => { 'type' => 'array' , 'items' => { '$ref' => '#/definitions/RecursiveModel' } , 'description' => 'The child nodes.' } } , 'required' => %w[ name children ] } ,
142+ 'DocumentedHashAndArrayModel' => { 'type' => 'object' , 'properties' => { 'raw_hash' => { 'type' => 'object' , 'description' => 'Example Hash.' } , 'raw_array' => { 'type' => 'array' , 'description' => 'Example Array' } } , 'required' => %w[ raw_hash raw_array ] }
143143 }
144144 end
145145
146146 let ( :swagger_nested_type ) do
147147 {
148- 'ApiError' => { 'type' => 'object' , 'properties' => { 'code' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'status code' } , 'message' => { 'type' => 'string' , 'description' => 'error message' } } , 'description' => 'ApiError model' } ,
149- 'ResponseItem' => { 'type' => 'object' , 'properties' => { 'id' => { 'type' => 'integer' , 'format' => 'int32' } , 'name' => { 'type' => 'string' } } } ,
150- 'UseItemResponseAsType' => { 'type' => 'object' , 'properties' => { 'description' => { 'type' => 'string' } , 'responses' => { '$ref' => '#/definitions/ResponseItem' } } , 'description' => 'UseItemResponseAsType model' }
148+ 'ApiError' => { 'type' => 'object' , 'properties' => { 'code' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'status code' } , 'message' => { 'type' => 'string' , 'description' => 'error message' } } , 'required' => %w[ code message ] , ' description' => 'ApiError model' } ,
149+ 'ResponseItem' => { 'type' => 'object' , 'properties' => { 'id' => { 'type' => 'integer' , 'format' => 'int32' } , 'name' => { 'type' => 'string' } } , 'required' => %w[ id name ] } ,
150+ 'UseItemResponseAsType' => { 'type' => 'object' , 'properties' => { 'description' => { 'type' => 'string' } , 'responses' => { '$ref' => '#/definitions/ResponseItem' } } , 'required' => %w[ description responses ] , ' description' => 'UseItemResponseAsType model' }
151151 }
152152 end
153153
154154 let ( :swagger_entity_as_response_object ) do
155155 {
156- 'ApiError' => { 'type' => 'object' , 'properties' => { 'code' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'status code' } , 'message' => { 'type' => 'string' , 'description' => 'error message' } } , 'description' => 'ApiError model' } ,
157- 'ResponseItem' => { 'type' => 'object' , 'properties' => { 'id' => { 'type' => 'integer' , 'format' => 'int32' } , 'name' => { 'type' => 'string' } } } ,
158- 'UseResponse' => { 'type' => 'object' , 'properties' => { 'description' => { 'type' => 'string' } , '$responses' => { 'type' => 'array' , 'items' => { '$ref' => '#/definitions/ResponseItem' } } } , 'description' => 'UseResponse model' }
156+ 'ApiError' => { 'type' => 'object' , 'properties' => { 'code' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'status code' } , 'message' => { 'type' => 'string' , 'description' => 'error message' } } , 'required' => %w[ code message ] , ' description' => 'ApiError model' } ,
157+ 'ResponseItem' => { 'type' => 'object' , 'properties' => { 'id' => { 'type' => 'integer' , 'format' => 'int32' } , 'name' => { 'type' => 'string' } } , 'required' => %w[ id name ] } ,
158+ 'UseResponse' => { 'type' => 'object' , 'properties' => { 'description' => { 'type' => 'string' } , '$responses' => { 'type' => 'array' , 'items' => { '$ref' => '#/definitions/ResponseItem' } } } , 'required' => [ 'description' , '$responses' ] , ' description' => 'UseResponse model' }
159159 }
160160 end
161161
162162 let ( :swagger_params_as_response_object ) do
163163 {
164- 'ApiError' => { 'type' => 'object' , 'properties' => { 'code' => { 'description' => 'status code' , 'type' => 'integer' , 'format' => 'int32' } , 'message' => { 'description' => 'error message' , 'type' => 'string' } } , 'description' => 'ApiError model' }
164+ 'ApiError' => {
165+ 'type' => 'object' ,
166+ 'properties' => {
167+ 'code' => { 'description' => 'status code' , 'type' => 'integer' , 'format' => 'int32' } ,
168+ 'message' => { 'description' => 'error message' , 'type' => 'string' }
169+ } ,
170+ 'required' => %w[
171+ code
172+ message
173+ ] ,
174+ 'description' => 'ApiError model'
175+ }
165176 }
166177 end
167178
@@ -310,6 +321,7 @@ class DocumentedHashAndArrayModel < Grape::Entity
310321 'ApiError' => {
311322 'type' => 'object' ,
312323 'properties' => { 'code' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'status code' } , 'message' => { 'type' => 'string' , 'description' => 'error message' } } ,
324+ 'required' => %w[ code message ] ,
313325 'description' => 'ApiError model'
314326 } ,
315327 'Something' => {
@@ -320,6 +332,7 @@ class DocumentedHashAndArrayModel < Grape::Entity
320332 'links' => { 'type' => 'array' , 'items' => { 'type' => 'link' } } ,
321333 'others' => { 'type' => 'text' }
322334 } ,
335+ 'required' => %w[ id text links others ] ,
323336 'description' => 'Something model'
324337 }
325338 }
0 commit comments