Module: SwaggerDocumentationAdder
- Includes:
- SwaggerRouting
- Defined in:
- lib/grape-swagger.rb
Instance Attribute Summary collapse
-
#combined_namespace_routes ⇒ Object
Returns the value of attribute combined_namespace_routes.
-
#combined_namespaces ⇒ Object
Returns the value of attribute combined_namespaces.
-
#combined_routes ⇒ Object
Returns the value of attribute combined_routes.
Instance Method Summary collapse
Instance Attribute Details
#combined_namespace_routes ⇒ Object
Returns the value of attribute combined_namespace_routes.
144 145 146 |
# File 'lib/grape-swagger.rb', line 144 def combined_namespace_routes @combined_namespace_routes end |
#combined_namespaces ⇒ Object
Returns the value of attribute combined_namespaces.
144 145 146 |
# File 'lib/grape-swagger.rb', line 144 def combined_namespaces @combined_namespaces end |
#combined_routes ⇒ Object
Returns the value of attribute combined_routes.
144 145 146 |
# File 'lib/grape-swagger.rb', line 144 def combined_routes @combined_routes end |
Instance Method Details
#add_swagger_documentation(options = {}) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/grape-swagger.rb', line 148 def add_swagger_documentation( = {}) documentation_class = create_documentation_class version_for() = { target_class: self }.merge() @target_class = [:target_class] auth_wrapper = [:endpoint_auth_wrapper] || Class.new use auth_wrapper if auth_wrapper.method_defined?(:before) && !middleware.flatten.include?(auth_wrapper) documentation_class.setup() mount(documentation_class) combined_routes = combine_routes(@target_class, documentation_class) combined_namespaces = combine_namespaces(@target_class) combined_namespace_routes = combine_namespace_routes(combined_namespaces, combined_routes) exclusive_route_keys = combined_routes.keys - combined_namespaces.keys @target_class.combined_namespace_routes = combined_namespace_routes.merge( combined_routes.slice(*exclusive_route_keys) ) @target_class.combined_routes = combined_routes @target_class.combined_namespaces = combined_namespaces documentation_class end |