diff --git a/lib/grape-swagger.rb b/lib/grape-swagger.rb index 5647e01b..0eac1aa8 100644 --- a/lib/grape-swagger.rb +++ b/lib/grape-swagger.rb @@ -32,7 +32,11 @@ def add_swagger_documentation(options = {}) options = { target_class: self }.merge(options) @target_class = options[:target_class] - use options[:endpoint_auth_wrapper] if !options[:endpoint_auth_wrapper].nil? && options[:endpoint_auth_wrapper].method_defined?(:before) + if !options[:endpoint_auth_wrapper].nil? && + options[:endpoint_auth_wrapper].method_defined?(:before) && + !middleware.flatten.include?(options[:endpoint_auth_wrapper]) + use options[:endpoint_auth_wrapper] + end documentation_class.setup(options) mount(documentation_class)