Class: OpenAPIParser::RequestOperation
- Inherits:
-
Object
- Object
- OpenAPIParser::RequestOperation
show all
- Defined in:
- lib/openapi_parser/request_operation.rb
Overview
binding request data and operation object
Defined Under Namespace
Classes: ValidatableResponseBody
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(http_method, result, config) ⇒ RequestOperation
Returns a new instance of RequestOperation.
33
34
35
36
37
38
39
40
|
# File 'lib/openapi_parser/request_operation.rb', line 33
def initialize(http_method, result, config)
@http_method = http_method.to_s
@original_path = result.original_path
@operation_object = result.operation_object
@path_params = result.path_params || {}
@path_item = result.path_item_object
@config = config
end
|
Instance Attribute Details
28
|
# File 'lib/openapi_parser/request_operation.rb', line 28
attr_reader :operation_object, :path_params, :config, :http_method, :original_path, :path_item
|
#http_method ⇒ String
28
|
# File 'lib/openapi_parser/request_operation.rb', line 28
attr_reader :operation_object, :path_params, :config, :http_method, :original_path, :path_item
|
28
29
30
|
# File 'lib/openapi_parser/request_operation.rb', line 28
def operation_object
@operation_object
end
|
#original_path ⇒ String
28
|
# File 'lib/openapi_parser/request_operation.rb', line 28
attr_reader :operation_object, :path_params, :config, :http_method, :original_path, :path_item
|
#path_item ⇒ Object
Returns the value of attribute path_item.
28
|
# File 'lib/openapi_parser/request_operation.rb', line 28
attr_reader :operation_object, :path_params, :config, :http_method, :original_path, :path_item
|
#path_params ⇒ Hash{String => String}
28
|
# File 'lib/openapi_parser/request_operation.rb', line 28
attr_reader :operation_object, :path_params, :config, :http_method, :original_path, :path_item
|
Class Method Details
.create(http_method, request_path, path_item_finder, config) ⇒ OpenAPIParser::RequestOperation?
8
9
10
11
12
13
|
# File 'lib/openapi_parser/request_operation.rb', line 8
def create(http_method, request_path, path_item_finder, config)
result = path_item_finder.operation_object(http_method, request_path)
return nil unless result
self.new(http_method, result, config)
end
|
Instance Method Details
#validate_path_params(options = nil) ⇒ Object
42
43
44
45
|
# File 'lib/openapi_parser/request_operation.rb', line 42
def validate_path_params(options = nil)
options ||= config.path_params_options
operation_object&.validate_path_params(path_params, options)
end
|
#validate_request_body(content_type, params, options = nil) ⇒ Object
50
51
52
53
|
# File 'lib/openapi_parser/request_operation.rb', line 50
def validate_request_body(content_type, params, options = nil)
options ||= config.request_body_options
operation_object&.validate_request_body(content_type, params, options)
end
|
#validate_request_parameter(params, headers, options = nil) ⇒ Object
66
67
68
69
|
# File 'lib/openapi_parser/request_operation.rb', line 66
def validate_request_parameter(params, , options = nil)
options ||= config.request_validator_options
operation_object&.validate_request_parameter(params, , options)
end
|
#validate_response_body(response_body, response_validate_options = nil) ⇒ Object
57
58
59
60
61
|
# File 'lib/openapi_parser/request_operation.rb', line 57
def validate_response_body(response_body, response_validate_options = nil)
response_validate_options ||= config.response_validate_options
operation_object&.validate_response(response_body, response_validate_options)
end
|