Invalid Swagger Schema - Delete
The following example method creates an invalid schema:
params do
options :test_ids, type: Array[String], documentation: { param_type: 'body' }
options :rest_ids, type: Array[String], documentation: { param_type: 'body' }
end
delete do
# ...
end
The schema contains multiple in: "body" records, which is invalid for the swagger schema. It should have been extracted out to a ref.
I added the following monkey patch to my app, and it appears to resolve the invalid schema issues. It seems the logic is simply flawed in these existing methods:
module GrapeSwagger
module DocMethods
class MoveParams
class << self
def can_be_moved?(params, http_verb)
includes_body_param?(params)
end
def should_expose_as_array?(params)
false
end
def should_correct_array?(param)
false
end
end
end
end
end
@lstanden The multiple in: 'body' are combined in GrapeSwagger::DocMethods::MoveParams , which not support delete method. https://github.com/ruby-grape/grape-swagger/blob/8e4a39cea858ea336f27814d433ee5b3996108a2/lib/grape-swagger/doc_methods/move_params.rb#L218-L220
Yes, I'm aware of this @darren987469 ... by not having DELETE included, it is generating invalid swagger schema.