lib/grape-swagger/endpoint.rb in grape-swagger-0.31.0 vs lib/grape-swagger/endpoint.rb in grape-swagger-0.31.1
- old
+ new
@@ -170,10 +170,11 @@
SUPPORTS_CONSUMES = %i[post put patch].freeze
def consumes_object(route, format)
return unless SUPPORTS_CONSUMES.include?(route.request_method.downcase.to_sym)
+
GrapeSwagger::DocMethods::ProducesConsumes.call(route.settings.dig(:description, :consumes) || format)
end
def params_object(route, options, path)
parameters = partition_params(route, options).map do |param, value|
@@ -319,10 +320,11 @@
def expose_params_from_model(model)
model = model.is_a?(String) ? model.constantize : model
model_name = model_name(model)
return model_name if @definitions.key?(model_name)
+
@definitions[model_name] = nil
parser = GrapeSwagger.model_parsers.find(model)
raise GrapeSwagger::Errors::UnregisteredParser, "No parser registered for #{model_name}." unless parser
@@ -343,9 +345,10 @@
def hidden?(route, options)
route_hidden = route.settings.try(:[], :swagger).try(:[], :hidden)
route_hidden = route.options[:hidden] if route.options.key?(:hidden)
return route_hidden unless route_hidden.is_a?(Proc)
+
options[:token_owner] ? route_hidden.call(send(options[:token_owner].to_sym)) : route_hidden.call
end
end
end