Class: OpenapiFirst::ErrorResponse
- Inherits:
-
Object
- Object
- OpenapiFirst::ErrorResponse
show all
- Extended by:
- Forwardable
- Defined in:
- lib/openapi_first/error_response.rb
Overview
This is the base class for error responses
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(env, request_validation_error) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
8
9
10
11
|
# File 'lib/openapi_first/error_response.rb', line 8
def initialize(env, request_validation_error)
@env = env
@request_validation_error = request_validation_error
end
|
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
15
16
17
|
# File 'lib/openapi_first/error_response.rb', line 15
def env
@env
end
|
#request_validation_error ⇒ Object
Returns the value of attribute request_validation_error.
15
16
17
|
# File 'lib/openapi_first/error_response.rb', line 15
def request_validation_error
@request_validation_error
end
|
Instance Method Details
#body ⇒ Object
41
42
43
|
# File 'lib/openapi_first/error_response.rb', line 41
def body
raise NotImplementedError
end
|
#content_type ⇒ Object
39
|
# File 'lib/openapi_first/error_response.rb', line 39
def content_type = 'application/json'
|
#data ⇒ Object
27
28
29
|
# File 'lib/openapi_first/error_response.rb', line 27
def data
schema_validation&.data
end
|
#message ⇒ Object
31
32
33
|
# File 'lib/openapi_first/error_response.rb', line 31
def message
request_validation_error.message
end
|
#render ⇒ Object
35
36
37
|
# File 'lib/openapi_first/error_response.rb', line 35
def render
Rack::Response.new(body, status, Rack::CONTENT_TYPE => content_type).finish
end
|
#schema ⇒ Object
23
24
25
|
# File 'lib/openapi_first/error_response.rb', line 23
def schema
schema_validation&.schema
end
|
#validation_output ⇒ Object
19
20
21
|
# File 'lib/openapi_first/error_response.rb', line 19
def validation_output
schema_validation&.output
end
|