Class: Openapi3Parser::NodeFactory::Object
Direct Known Subclasses
Components, Contact, Discriminator, Encoding, Example, ExternalDocumentation, Header, Info, License, Link, MediaType, OauthFlow, OauthFlows, Openapi, Operation, Parameter, PathItem, Reference, RequestBody, Response, Schema, SecurityScheme, Server, ServerVariable, Tag, Xml
Instance Attribute Summary collapse
Instance Method Summary
collapse
allow_extensions, allowed_extensions?, field, field_configs, mutually_exclusive, mutually_exclusive_fields, validate, validations
Constructor Details
#initialize(context) ⇒ Object
Returns a new instance of Object.
24
25
26
27
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 24
def initialize(context)
@context = context
@data = build_data(context.input)
end
|
Instance Attribute Details
Returns the value of attribute context.
22
23
24
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 22
def context
@context
end
|
Returns the value of attribute data.
22
23
24
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 22
def data
@data
end
|
Instance Method Details
#allowed_fields ⇒ Object
61
62
63
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 61
def allowed_fields
field_configs.keys
end
|
#can_use_default? ⇒ Boolean
53
54
55
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 53
def can_use_default?
true
end
|
57
58
59
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 57
def default
nil
end
|
71
72
73
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 71
def inspect
%{#{self.class.name}(#{context.source_location.inspect})}
end
|
37
38
39
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 37
def nil_input?
context.input.nil?
end
|
49
50
51
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 49
def node
@node ||= build_node
end
|
33
34
35
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 33
def raw_input
context.input
end
|
#required_fields ⇒ Object
65
66
67
68
69
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 65
def required_fields
field_configs.each_with_object([]) do |(key, config), memo|
memo << key if config.required?
end
end
|
29
30
31
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 29
def resolved_input
@resolved_input ||= build_resolved_input
end
|
#valid? ⇒ Boolean
41
42
43
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 41
def valid?
errors.empty?
end
|