Class: OpenAPIParser::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_parser/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Config

Returns a new instance of Config.



2
3
4
# File 'lib/openapi_parser/config.rb', line 2

def initialize(config)
  @config = config
end

Instance Method Details

#coerce_valueObject



10
11
12
# File 'lib/openapi_parser/config.rb', line 10

def coerce_value
  @config[:coerce_value]
end

#datetime_coerce_classObject



6
7
8
# File 'lib/openapi_parser/config.rb', line 6

def datetime_coerce_class
  @config[:datetime_coerce_class]
end

#expand_referenceObject



14
15
16
# File 'lib/openapi_parser/config.rb', line 14

def expand_reference
  @config.fetch(:expand_reference, true)
end

#request_validator_optionsOpenAPIParser::SchemaValidator::Options Also known as: request_body_options, path_params_options



27
28
29
30
31
# File 'lib/openapi_parser/config.rb', line 27

def request_validator_options
  @request_validator_options ||= OpenAPIParser::SchemaValidator::Options.new(coerce_value: coerce_value,
                                                                             datetime_coerce_class: datetime_coerce_class,
                                                                             validate_header: validate_header)
end

#response_validate_optionsOpenAPIParser::SchemaValidator::ResponseValidateOptions



37
38
39
40
# File 'lib/openapi_parser/config.rb', line 37

def response_validate_options
  @response_validate_options ||= OpenAPIParser::SchemaValidator::ResponseValidateOptions.
                                   new(strict: strict_response_validation, validate_header: validate_header)
end

#strict_response_validationObject



18
19
20
# File 'lib/openapi_parser/config.rb', line 18

def strict_response_validation
  @config.fetch(:strict_response_validation, false)
end

#validate_headerObject



22
23
24
# File 'lib/openapi_parser/config.rb', line 22

def validate_header
  @config.fetch(:validate_header, true)
end