Sha256: 0fa057dd875572529e8bab5a3f6bc21544c8a1154f3a0bd816a85ab92224a8a4

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require "openapi3_parser/node/license"
require "openapi3_parser/node_factory/map"
require "openapi3_parser/node_factory/object"
require "openapi3_parser/node_factory/server"

module Openapi3Parser
  module NodeFactory
    class Link < NodeFactory::Object
      allow_extensions

      # @todo The link object in OAS is pretty meaty and there's lot of scope
      # for further work here to make use of it's funcationality

      field "operationRef", input_type: String
      field "operationId", input_type: String
      field "parameters", factory: :parameters_factory
      field "requestBody"
      field "description", input_type: String
      field "server", factory: :server_factory

      mutually_exclusive "operationRef", "operationId", required: true

      private

      def build_object(data, context)
        Node::Link.new(data, context)
      end

      def parameters_factory(context)
        NodeFactory::Map.new(context)
      end

      def server_factory(context)
        NodeFactory::Server.new(context)
      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/link.rb
openapi3_parser-0.5.0 lib/openapi3_parser/node_factory/link.rb