Class: Openapi3Parser::NodeFactory::Field
- Inherits:
-
Object
- Object
- Openapi3Parser::NodeFactory::Field
show all
- Defined in:
- lib/openapi3_parser/node_factory/field.rb
Defined Under Namespace
Classes: ValidNodeBuilder
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(context, input_type: nil, validate: nil) ⇒ Field
Returns a new instance of Field.
8
9
10
11
12
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 8
def initialize(context, input_type: nil, validate: nil)
@context = context
@input_type = input_type
@validation = validate
end
|
Instance Attribute Details
Returns the value of attribute context.
6
7
8
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 6
def context
@context
end
|
Returns the value of attribute input_type.
6
7
8
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 6
def input_type
@input_type
end
|
#validation ⇒ Object
Returns the value of attribute validation.
6
7
8
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 6
def validation
@validation
end
|
Instance Method Details
14
15
16
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 14
def data
context.input
end
|
34
35
36
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 34
def default
nil
end
|
38
39
40
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 38
def errors
@errors ||= ValidNodeBuilder.errors(self)
end
|
47
48
49
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 47
def inspect
%{#{self.class.name}(#{context.source_location.inspect})}
end
|
26
27
28
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 26
def nil_input?
context.input.nil?
end
|
#node(node_context) ⇒ Object
42
43
44
45
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 42
def node(node_context)
data = ValidNodeBuilder.data(self)
data.nil? ? nil : build_node(data, node_context)
end
|
22
23
24
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 22
def raw_input
context.input
end
|
18
19
20
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 18
def resolved_input
context.input
end
|
#valid? ⇒ Boolean
30
31
32
|
# File 'lib/openapi3_parser/node_factory/field.rb', line 30
def valid?
errors.empty?
end
|