Class: Committee::Middleware::Options::ResponseValidation
- Defined in:
- lib/committee/middleware/options/response_validation.rb
Constant Summary collapse
- DEFAULTS =
Default values
{ strict: false, validate_success_only: true, parse_response_by_content_type: true, coerce_response_values: false }.freeze
Instance Attribute Summary collapse
-
#coerce_response_values ⇒ Object
readonly
Returns the value of attribute coerce_response_values.
-
#parse_response_by_content_type ⇒ Object
readonly
Returns the value of attribute parse_response_by_content_type.
-
#streaming_content_parsers ⇒ Object
readonly
Returns the value of attribute streaming_content_parsers.
-
#strict ⇒ Object
readonly
ResponseValidation specific options.
-
#validate_success_only ⇒ Object
readonly
Returns the value of attribute validate_success_only.
Attributes inherited from Base
#accept_request_filter, #error_class, #error_handler, #ignore_error, #prefix, #raise_error, #schema, #schema_path, #strict_reference_validation
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ResponseValidation
constructor
A new instance of ResponseValidation.
Methods inherited from Base
Constructor Details
#initialize(options = {}) ⇒ ResponseValidation
Returns a new instance of ResponseValidation.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/committee/middleware/options/response_validation.rb', line 17 def initialize( = {}) super() # Validation related @strict = .fetch(:strict, DEFAULTS[:strict]) @validate_success_only = .fetch(:validate_success_only, DEFAULTS[:validate_success_only]) @parse_response_by_content_type = .fetch(:parse_response_by_content_type, DEFAULTS[:parse_response_by_content_type]) @coerce_response_values = .fetch(:coerce_response_values, DEFAULTS[:coerce_response_values]) # Streaming @streaming_content_parsers = [:streaming_content_parsers] || {} end |
Instance Attribute Details
#coerce_response_values ⇒ Object (readonly)
Returns the value of attribute coerce_response_values.
11 12 13 |
# File 'lib/committee/middleware/options/response_validation.rb', line 11 def coerce_response_values @coerce_response_values end |
#parse_response_by_content_type ⇒ Object (readonly)
Returns the value of attribute parse_response_by_content_type.
10 11 12 |
# File 'lib/committee/middleware/options/response_validation.rb', line 10 def parse_response_by_content_type @parse_response_by_content_type end |
#streaming_content_parsers ⇒ Object (readonly)
Returns the value of attribute streaming_content_parsers.
12 13 14 |
# File 'lib/committee/middleware/options/response_validation.rb', line 12 def streaming_content_parsers @streaming_content_parsers end |
#strict ⇒ Object (readonly)
ResponseValidation specific options
8 9 10 |
# File 'lib/committee/middleware/options/response_validation.rb', line 8 def strict @strict end |
#validate_success_only ⇒ Object (readonly)
Returns the value of attribute validate_success_only.
9 10 11 |
# File 'lib/committee/middleware/options/response_validation.rb', line 9 def validate_success_only @validate_success_only end |