Class: OpenAPIParser::Config
- Inherits:
-
Object
- Object
- OpenAPIParser::Config
- Defined in:
- lib/openapi_parser/config.rb
Instance Method Summary collapse
- #coerce_value ⇒ Object
- #datetime_coerce_class ⇒ Object
- #expand_reference ⇒ Object
-
#initialize(config) ⇒ Config
constructor
A new instance of Config.
- #request_validator_options ⇒ OpenAPIParser::SchemaValidator::Options (also: #request_body_options, #path_params_options)
- #response_validate_options ⇒ OpenAPIParser::SchemaValidator::ResponseValidateOptions
- #strict_response_validation ⇒ Object
- #validate_header ⇒ Object
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_value ⇒ Object
10 11 12 |
# File 'lib/openapi_parser/config.rb', line 10 def coerce_value @config[:coerce_value] end |
#datetime_coerce_class ⇒ Object
6 7 8 |
# File 'lib/openapi_parser/config.rb', line 6 def datetime_coerce_class @config[:datetime_coerce_class] end |
#expand_reference ⇒ Object
14 15 16 |
# File 'lib/openapi_parser/config.rb', line 14 def @config.fetch(:expand_reference, true) end |
#request_validator_options ⇒ OpenAPIParser::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 ||= OpenAPIParser::SchemaValidator::Options.new(coerce_value: coerce_value, datetime_coerce_class: datetime_coerce_class, validate_header: validate_header) end |
#response_validate_options ⇒ OpenAPIParser::SchemaValidator::ResponseValidateOptions
37 38 39 40 |
# File 'lib/openapi_parser/config.rb', line 37 def @response_validate_options ||= OpenAPIParser::SchemaValidator::ResponseValidateOptions. new(strict: strict_response_validation, validate_header: validate_header) end |
#strict_response_validation ⇒ Object
18 19 20 |
# File 'lib/openapi_parser/config.rb', line 18 def strict_response_validation @config.fetch(:strict_response_validation, false) end |
#validate_header ⇒ Object
22 23 24 |
# File 'lib/openapi_parser/config.rb', line 22 def validate_header @config.fetch(:validate_header, true) end |