Class: OpenapiFirst::Configuration
- Inherits:
-
Object
- Object
- OpenapiFirst::Configuration
- Defined in:
- lib/openapi_first/configuration.rb
Overview
Global configuration. Currently only used for the request validation middleware.
Constant Summary collapse
- HOOKS =
%i[ after_request_validation after_response_validation after_request_parameter_property_validation after_request_body_property_validation ].freeze
Instance Attribute Summary collapse
-
#hooks ⇒ Object
readonly
Returns the value of attribute hooks.
-
#request_validation_error_response ⇒ Object
Returns the value of attribute request_validation_error_response.
-
#request_validation_raise_error ⇒ Object
Returns the value of attribute request_validation_raise_error.
-
#response_validation_raise_error ⇒ Object
Returns the value of attribute response_validation_raise_error.
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 16 17 18 |
# File 'lib/openapi_first/configuration.rb', line 13 def initialize @request_validation_error_response = OpenapiFirst.find_error_response(:default) @request_validation_raise_error = false @response_validation_raise_error = true @hooks = (HOOKS.map { [_1, []] }).to_h end |
Instance Attribute Details
#hooks ⇒ Object (readonly)
Returns the value of attribute hooks.
20 21 22 |
# File 'lib/openapi_first/configuration.rb', line 20 def hooks @hooks end |
#request_validation_error_response ⇒ Object
Returns the value of attribute request_validation_error_response.
20 21 22 |
# File 'lib/openapi_first/configuration.rb', line 20 def request_validation_error_response @request_validation_error_response end |
#request_validation_raise_error ⇒ Object
Returns the value of attribute request_validation_raise_error.
21 22 23 |
# File 'lib/openapi_first/configuration.rb', line 21 def request_validation_raise_error @request_validation_raise_error end |
#response_validation_raise_error ⇒ Object
Returns the value of attribute response_validation_raise_error.
21 22 23 |
# File 'lib/openapi_first/configuration.rb', line 21 def response_validation_raise_error @response_validation_raise_error end |
Instance Method Details
#clone ⇒ Object
23 24 25 26 27 |
# File 'lib/openapi_first/configuration.rb', line 23 def clone copy = super copy.instance_variable_set(:@hooks, @hooks&.transform_values(&:clone)) copy end |