Class: OpenapiFirst::Schema::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/openapi_first/definition/schema/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



5
6
7
# File 'lib/openapi_first/definition/schema/result.rb', line 5

def data
  @data
end

#outputObject

Returns the value of attribute output

Returns:

  • (Object)

    the current value of output



5
6
7
# File 'lib/openapi_first/definition/schema/result.rb', line 5

def output
  @output
end

#schemaObject

Returns the value of attribute schema

Returns:

  • (Object)

    the current value of schema



5
6
7
# File 'lib/openapi_first/definition/schema/result.rb', line 5

def schema
  @schema
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


7
# File 'lib/openapi_first/definition/schema/result.rb', line 7

def error? = !output['valid']

#messageObject

Returns a message that is used in exception messages.



10
11
12
13
14
# File 'lib/openapi_first/definition/schema/result.rb', line 10

def message
  return if valid?

  (output['errors']&.map { |e| e['error'] }&.join('. ') || output['error'])
end

#valid?Boolean

Returns:

  • (Boolean)


6
# File 'lib/openapi_first/definition/schema/result.rb', line 6

def valid? = output['valid']