class Openapi3Parser::NodeFactory::Schema
Private Instance Methods
additional_properties_factory(context)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 122 def additional_properties_factory(context) return context.input if [true, false].include?(context.input) referenceable_schema(context) end
additional_properties_input_type(validatable)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 115 def additional_properties_input_type(validatable) input = validatable.input return if [true, false].include?(input) || input.is_a?(Hash) validatable.add_error("Expected a Boolean or an Object") end
build_object(data, context)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 68 def build_object(data, context) Node::Schema.new(data, context) end
discriminator_factory(context)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 84 def discriminator_factory(context) NodeFactory::Discriminator.new(context) end
enum_factory(context)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 80 def enum_factory(context) NodeFactory::Array.new(context, default: nil) end
external_docs_factory(context)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 92 def external_docs_factory(context) NodeFactory::ExternalDocumentation.new(context) end
items_for_array(validatable)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 54 def items_for_array(validatable) return unless validatable.input["type"] == "array" return unless validatable.factory.resolved_input["items"].nil? validatable.add_error("items must be defined for a type of array") end
properties_factory(context)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 96 def properties_factory(context) NodeFactory::Map.new( context, value_factory: NodeFactory::OptionalReference.new(self.class) ) end
read_only_or_write_only(validatable)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 61 def read_only_or_write_only(validatable) input = validatable.input return if [input["readOnly"], input["writeOnly"]].uniq != [true] validatable.add_error("readOnly and writeOnly cannot both be true") end
referenceable_schema(context)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 103 def referenceable_schema(context) NodeFactory::OptionalReference.new(self.class).call(context) end
referenceable_schema_array(context)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 107 def referenceable_schema_array(context) NodeFactory::Array.new( context, default: nil, value_factory: NodeFactory::OptionalReference.new(self.class) ) end
required_factory(context)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 72 def required_factory(context) NodeFactory::Array.new( context, default: nil, value_input_type: String ) end
xml_factory(context)
click to toggle source
# File lib/openapi3_parser/node_factory/schema.rb, line 88 def xml_factory(context) NodeFactory::Xml.new(context) end