Sha256: 297a7ae880a04388d4022cf30774be0b42f3487d49f5f2910653fade28967253
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true require "openapi3_parser/error" require "openapi3_parser/node_factory/fields/reference" require "openapi3_parser/node_factory/object" require "openapi3_parser/node_factory/recursive_pointer" module Openapi3Parser module NodeFactory class Reference < NodeFactory::Object field "$ref", input_type: String, required: true, factory: :ref_factory attr_reader :factory def initialize(context, factory) @factory = factory super(context) end def in_recursive_loop? data["$ref"].in_recursive_loop? end def recursive_pointer NodeFactory::RecursivePointer.new(data["$ref"].reference_context) end private def build_node if in_recursive_loop? raise Error::InRecursiveStructure, "Can't build node as it references itself, use "\ "recursive_pointer" end data["$ref"].node end def ref_factory(context) NodeFactory::Fields::Reference.new(context, factory) end def build_resolved_input data["$ref"].resolved_input end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
openapi3_parser-0.5.1 | lib/openapi3_parser/node_factory/reference.rb |
openapi3_parser-0.5.0 | lib/openapi3_parser/node_factory/reference.rb |