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.
Direct Known Subclasses
Constant Summary collapse
- HOOKS =
i[ after_request_validation after_response_validation after_request_parameter_property_validation after_request_body_property_validation after_response_body_property_validation ].freeze
Instance Attribute Summary collapse
-
#hooks ⇒ Object
readonly
Returns the value of attribute hooks.
-
#path ⇒ Object
Returns the value of attribute path.
-
#request_validation_error_response ⇒ Object
Returns the value of attribute request_validation_error_response.
- #request_validation_raise_error ⇒ Object deprecated Deprecated.
- #response_validation_raise_error ⇒ Object deprecated Deprecated.
Instance Method Summary collapse
-
#child ⇒ Object
Return a child configuration that still receives updates of global hooks.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register(path_or_definition, as: :default) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 |
# File 'lib/openapi_first/configuration.rb', line 14 def initialize @request_validation_error_response = OpenapiFirst.find_error_response(:default) @request_validation_raise_error = false @response_validation_raise_error = true @hooks = HOOKS.to_h { [_1, Set.new] } @path = nil end |
Instance Attribute Details
#hooks ⇒ Object (readonly)
Returns the value of attribute hooks.
26 27 28 |
# File 'lib/openapi_first/configuration.rb', line 26 def hooks @hooks end |
#path ⇒ Object
Returns the value of attribute path.
27 28 29 |
# File 'lib/openapi_first/configuration.rb', line 27 def path @path end |
#request_validation_error_response ⇒ Object
Returns the value of attribute request_validation_error_response.
26 27 28 |
# File 'lib/openapi_first/configuration.rb', line 26 def request_validation_error_response @request_validation_error_response end |
#request_validation_raise_error ⇒ Object
Deprecated.
30 31 32 |
# File 'lib/openapi_first/configuration.rb', line 30 def request_validation_raise_error @request_validation_raise_error end |
#response_validation_raise_error ⇒ Object
Deprecated.
32 33 34 |
# File 'lib/openapi_first/configuration.rb', line 32 def response_validation_raise_error @response_validation_raise_error end |
Instance Method Details
#child ⇒ Object
Return a child configuration that still receives updates of global hooks.
35 36 37 |
# File 'lib/openapi_first/configuration.rb', line 35 def child ChildConfiguration.new(parent: self) end |
#register(path_or_definition, as: :default) ⇒ Object
22 23 24 |
# File 'lib/openapi_first/configuration.rb', line 22 def register(path_or_definition, as: :default) OpenapiFirst.register(path_or_definition, as:) end |