lib/open_api/dsl.rb in zero-rails_openapi-1.5.7 vs lib/open_api/dsl.rb in zero-rails_openapi-1.5.8

- old
+ new

@@ -25,20 +25,22 @@ end def components &block doc_tag if @doc_info.nil? structure = %i[ schemas responses parameters examples requestBodies securitySchemes ].map { |k| [k, { }] }.to_h - current_doc = @doc_info[:components] = Components.new.merge!(structure) + current_doc = Components.new.merge!(structure) current_doc.instance_exec(&block) current_doc.process_objs + + (@doc_info[:components] ||= { }).deep_merge!(current_doc) end def api action, summary = '', http: http_method = nil, skip: [ ], use: [ ], &block doc_tag if @doc_info.nil? # select the routing info (corresponding to the current method) from routing list. action_path = "#{@route_base ||= controller_path}##{action}" routes = ctrl_routes_list&.select { |api| api[:action_path].match?(/^#{action_path}$/) } - return puts ' ZRO'.red + " Route mapping failed: #{@route_base}##{action}" if routes.blank? + return puts ' ZRO'.red + " Route mapping failed: #{action_path}" if routes.blank? api = Api.new(action_path, skip: Array(skip), use: Array(use)) .merge! description: '', summary: summary, operationId: action, tags: [@doc_tag], parameters: [ ], requestBody: '', responses: { }, callbacks: { }, links: { }, security: [ ], servers: [ ]