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.
21
22
23
24
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 21
def initialize(context)
@context = context
@data = build_data(context.input)
end
|
Instance Attribute Details
Returns the value of attribute context.
19
20
21
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 19
def context
@context
end
|
Returns the value of attribute data.
19
20
21
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 19
def data
@data
end
|
Instance Method Details
#allowed_fields ⇒ Object
58
59
60
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 58
def allowed_fields
field_configs.keys
end
|
#can_use_default? ⇒ Boolean
50
51
52
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 50
def can_use_default?
true
end
|
54
55
56
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 54
def default
nil
end
|
42
43
44
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 42
def errors
@errors ||= ObjectFactory::NodeBuilder.errors(self)
end
|
68
69
70
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 68
def inspect
%{#{self.class.name}(#{context.source_location.inspect})}
end
|
34
35
36
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 34
def nil_input?
context.input.nil?
end
|
46
47
48
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 46
def node
@node ||= build_node
end
|
30
31
32
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 30
def raw_input
context.input
end
|
#required_fields ⇒ Object
62
63
64
65
66
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 62
def required_fields
field_configs.each_with_object([]) do |(key, config), memo|
memo << key if config.required?
end
end
|
26
27
28
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 26
def resolved_input
@resolved_input ||= build_resolved_input
end
|
#valid? ⇒ Boolean
38
39
40
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 38
def valid?
errors.empty?
end
|