Class: FaradayMiddleware::OpenAPI::RequestValidator::RequestOperation
- Inherits:
-
Object
- Object
- FaradayMiddleware::OpenAPI::RequestValidator::RequestOperation
- Defined in:
- lib/faraday_middleware/openapi/request_validator.rb
Instance Method Summary collapse
-
#initialize(env:, schema_path:) ⇒ RequestOperation
constructor
A new instance of RequestOperation.
- #validate_request_body ⇒ Object
- #validate_request_parameter ⇒ Object
Constructor Details
#initialize(env:, schema_path:) ⇒ RequestOperation
Returns a new instance of RequestOperation.
31 32 33 34 |
# File 'lib/faraday_middleware/openapi/request_validator.rb', line 31 def initialize(env:, schema_path:) @env = env @schema_path = schema_path end |
Instance Method Details
#validate_request_body ⇒ Object
42 43 44 45 46 |
# File 'lib/faraday_middleware/openapi/request_validator.rb', line 42 def validate_request_body request_operation.validate_request_body(content_type, request_body) rescue OpenAPIParser::OpenAPIError => e raise ::FaradayMiddleware::OpenAPI::Error.new(e.) end |
#validate_request_parameter ⇒ Object
36 37 38 39 40 |
# File 'lib/faraday_middleware/openapi/request_validator.rb', line 36 def validate_request_parameter request_operation.validate_request_parameter(env.params || {}, {}) rescue OpenAPIParser::OpenAPIError => e raise ::FaradayMiddleware::OpenAPI::Error.new(e.) end |