Sha256: 51ae579f3dd460a37c3e56977cd1d1e1db5e3b6803df4f6820c01a544ca4db56

Contents?: true

Size: 958 Bytes

Versions: 1

Compression:

Stored size: 958 Bytes

Contents

# frozen_string_literal: true

require "openapi3_parser/node_factory/object"

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

1 entries across 1 versions & 1 rubygems

Version Path
openapi3_parser-0.5.2 lib/openapi3_parser/node_factory/link.rb