Sha256: ba5c933389c95811b67e888e22b7771795a9145519989622f2a797e60ae8aa8f

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require 'r2-oas/schema/v3/object/from_routes/public'
require_relative 'support/deprecation'

module R2OAS
  module PluggableConfiguration
    # rubocop:disable Style/MutableConstant
    DEFAULT_USE_OBJECT_CLASSES = {
      info_object: R2OAS::Schema::V3::InfoObject,
      paths_object: R2OAS::Schema::V3::PathsObject,
      path_item_object: R2OAS::Schema::V3::PathItemObject,
      external_document_object: R2OAS::Schema::V3::ExternalDocumentObject,
      components_object: R2OAS::Schema::V3::ComponentsObject,
      components_schema_object: R2OAS::Schema::V3::Components::SchemaObject,
      components_request_body_object: R2OAS::Schema::V3::Components::RequestBodyObject
    }
    # rubocop:enable Style/MutableConstant

    VALID_OPTIONS_KEYS = %i[
      use_object_classes
    ].freeze

    attr_reader *VALID_OPTIONS_KEYS

    private

    module_function

    def set_default(target)
      Deprecation.silence do
        target.use_object_classes = DEFAULT_USE_OBJECT_CLASSES
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
r2-oas-0.4.1 lib/r2-oas/pluggable_configuration.rb
r2-oas-0.4.0 lib/r2-oas/pluggable_configuration.rb