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
Class Method 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.
25
26
27
28
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 25
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
|
Class Method Details
.object_type ⇒ Object
21
22
23
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 21
def self.object_type
to_s
end
|
Instance Method Details
#allowed_fields ⇒ Object
62
63
64
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 62
def allowed_fields
field_configs.keys
end
|
#can_use_default? ⇒ Boolean
54
55
56
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 54
def can_use_default?
true
end
|
58
59
60
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 58
def default
nil
end
|
72
73
74
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 72
def inspect
%{#{self.class.name}(#{context.source_location.inspect})}
end
|
38
39
40
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 38
def nil_input?
context.input.nil?
end
|
#node(node_context) ⇒ Object
50
51
52
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 50
def node(node_context)
build_node(node_context)
end
|
34
35
36
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 34
def raw_input
context.input
end
|
#required_fields ⇒ Object
66
67
68
69
70
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 66
def required_fields
field_configs.each_with_object([]) do |(key, config), memo|
memo << key if config.required?
end
end
|
30
31
32
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 30
def resolved_input
@resolved_input ||= build_resolved_input
end
|
#valid? ⇒ Boolean
42
43
44
|
# File 'lib/openapi3_parser/node_factory/object.rb', line 42
def valid?
errors.empty?
end
|