lib/oas_rails/configuration.rb in oas_rails-0.3.0 vs lib/oas_rails/configuration.rb in oas_rails-0.4.0

- old
+ new

@@ -1,39 +1,51 @@ module OasRails class Configuration - attr_accessor :info, :default_tags_from, :autodiscover_request_body, :autodiscover_responses, :api_path, :security_schemas, :authenticate_all_routes_by_default + attr_accessor :info, + :default_tags_from, + :autodiscover_request_body, + :autodiscover_responses, + :api_path, + :security_schemas, + :authenticate_all_routes_by_default, + :set_default_responses, + :possible_default_responses, + :response_body_of_default attr_reader :servers, :tags, :security_schema def initialize - @info = Info.new + @info = Spec::Info.new @servers = default_servers @tags = [] @swagger_version = '3.1.0' @default_tags_from = "namespace" @autodiscover_request_body = true @autodiscover_responses = true @api_path = "/" @authenticate_all_routes_by_default = true @security_schema = nil @security_schemas = {} + @set_default_responses = true + @possible_default_responses = [:not_found, :unauthorized, :forbidden] + @response_body_of_default = { message: String } end def security_schema=(value) return unless (security_schema = DEFAULT_SECURITY_SCHEMES[value]) @security_schemas = { value => security_schema } end def default_servers - [Server.new(url: "http://localhost:3000", description: "Rails Default Development Server")] + [Spec::Server.new(url: "http://localhost:3000", description: "Rails Default Development Server")] end def servers=(value) - @servers = value.map { |s| Server.new(url: s[:url], description: s[:description]) } + @servers = value.map { |s| Spec::Server.new(url: s[:url], description: s[:description]) } end def tags=(value) - @tags = value.map { |t| Tag.new(name: t[:name], description: t[:description]) } + @tags = value.map { |t| Spec::Tag.new(name: t[:name], description: t[:description]) } end def excluded_columns_incoming %i[id created_at updated_at deleted_at] end