@@ -135,33 +135,44 @@ class DocumentedHashAndArrayModel < Grape::Entity
135
135
136
136
let ( :swagger_definitions_models ) do
137
137
{
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 ] }
143
143
}
144
144
end
145
145
146
146
let ( :swagger_nested_type ) do
147
147
{
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' }
151
151
}
152
152
end
153
153
154
154
let ( :swagger_entity_as_response_object ) do
155
155
{
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' }
159
159
}
160
160
end
161
161
162
162
let ( :swagger_params_as_response_object ) do
163
163
{
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
+ }
165
176
}
166
177
end
167
178
@@ -310,6 +321,7 @@ class DocumentedHashAndArrayModel < Grape::Entity
310
321
'ApiError' => {
311
322
'type' => 'object' ,
312
323
'properties' => { 'code' => { 'type' => 'integer' , 'format' => 'int32' , 'description' => 'status code' } , 'message' => { 'type' => 'string' , 'description' => 'error message' } } ,
324
+ 'required' => %w[ code message ] ,
313
325
'description' => 'ApiError model'
314
326
} ,
315
327
'Something' => {
@@ -320,6 +332,7 @@ class DocumentedHashAndArrayModel < Grape::Entity
320
332
'links' => { 'type' => 'array' , 'items' => { 'type' => 'link' } } ,
321
333
'others' => { 'type' => 'text' }
322
334
} ,
335
+ 'required' => %w[ id text links others ] ,
323
336
'description' => 'Something model'
324
337
}
325
338
}
0 commit comments