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.
10
11
12
13
|
# File 'lib/openapi_first/error_response.rb', line 10
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.
17
18
19
|
# File 'lib/openapi_first/error_response.rb', line 17
def env
@env
end
|
#request_validation_error ⇒ Object
Returns the value of attribute request_validation_error.
17
18
19
|
# File 'lib/openapi_first/error_response.rb', line 17
def request_validation_error
@request_validation_error
end
|
Instance Method Details
#body ⇒ Object
43
44
45
|
# File 'lib/openapi_first/error_response.rb', line 43
def body
raise NotImplementedError
end
|
#content_type ⇒ Object
41
|
# File 'lib/openapi_first/error_response.rb', line 41
def content_type = 'application/json'
|
#data ⇒ Object
29
30
31
|
# File 'lib/openapi_first/error_response.rb', line 29
def data
schema_validation&.data
end
|
#message ⇒ Object
33
34
35
|
# File 'lib/openapi_first/error_response.rb', line 33
def message
request_validation_error.message
end
|
#render ⇒ Object
37
38
39
|
# File 'lib/openapi_first/error_response.rb', line 37
def render
Rack::Response.new(body, status, Rack::CONTENT_TYPE => content_type).finish
end
|
#schema ⇒ Object
25
26
27
|
# File 'lib/openapi_first/error_response.rb', line 25
def schema
schema_validation&.schema
end
|
#validation_output ⇒ Object
21
22
23
|
# File 'lib/openapi_first/error_response.rb', line 21
def validation_output
schema_validation&.output
end
|