spec/support/model_parsers/representable_parser.rb in grape-swagger-0.24.0 vs spec/support/model_parsers/representable_parser.rb in grape-swagger-0.25.0
- old
+ new
@@ -89,10 +89,19 @@
property :code, documentation: { type: Integer, desc: 'status code' }
property :message, documentation: { type: String, desc: 'error message' }
end
+ module NestedModule
+ class ApiResponse < Representable::Decorator
+ include Representable::JSON
+
+ property :status, documentation: { type: String }
+ property :error, documentation: { type: ::Entities::ApiError }
+ end
+ end
+
class SecondApiError < Representable::Decorator
include Representable::JSON
property :code, documentation: { type: Integer }
property :severity, documentation: { type: String }
@@ -234,11 +243,11 @@
'prop_double' => { 'description' => 'prop_double description', 'type' => 'number', 'format' => 'double' },
'prop_email' => { 'description' => 'prop_email description', 'type' => 'string', 'format' => 'email' },
'prop_file' => { 'description' => 'prop_file description', 'type' => 'file' },
'prop_float' => { 'description' => 'prop_float description', 'type' => 'number', 'format' => 'float' },
'prop_integer' => { 'description' => 'prop_integer description', 'type' => 'integer', 'format' => 'int32' },
- 'prop_json' => { 'description' => 'prop_json description', 'type' => 'Representable::JSON' },
+ 'prop_json' => { 'description' => 'prop_json description', 'type' => 'JSON' },
'prop_long' => { 'description' => 'prop_long description', 'type' => 'integer', 'format' => 'int64' },
'prop_password' => { 'description' => 'prop_password description', 'type' => 'string', 'format' => 'password' },
'prop_string' => { 'description' => 'prop_string description', 'type' => 'string' },
'prop_symbol' => { 'description' => 'prop_symbol description', 'type' => 'string' },
'prop_time' => { 'description' => 'prop_time description', 'type' => 'string', 'format' => 'date-time' }
@@ -365,15 +374,17 @@
}
},
'definitions' => {
'QueryInput' => {
'type' => 'object',
+ 'required' => ['elements'],
'properties' => { 'elements' => { 'type' => 'array', 'items' => { '$ref' => '#/definitions/QueryInputElement' }, 'description' => 'Set of configuration' } },
'description' => 'nested route inside namespace'
},
'QueryInputElement' => {
'type' => 'object',
+ 'required' => %w(key value),
'properties' => { 'key' => { 'type' => 'string', 'description' => 'Name of parameter' }, 'value' => { 'type' => 'string', 'description' => 'Value of parameter' } }
},
'ApiError' => {
'type' => 'object',
'properties' => { 'code' => { 'type' => 'integer', 'format' => 'int32', 'description' => 'status code' }, 'message' => { 'type' => 'string', 'description' => 'error message' } },
@@ -395,7 +406,7 @@
let(:http_verbs) { %w(get post put delete) }
end
def mounted_paths
- %w( /thing /other_thing /dummy )
+ %w(/thing /other_thing /dummy)
end