Sha256: 634c1184844a682624e3c1e9701f11fcd7bc74efe312653cf64d4e972ea90b3d

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

module Openapi3Parser
  module NodeFactories
    class Parameter
      module ParameterLike
        def default_explode
          context.input["style"] == "form"
        end

        def schema_factory(context)
          factory = NodeFactory::OptionalReference.new(NodeFactories::Schema)
          factory.call(context)
        end

        def examples_factory(context)
          factory = NodeFactory::OptionalReference.new(NodeFactories::Schema)
          NodeFactories::Map.new(context, value_factory: factory)
        end

        def content_factory(context)
          factory = NodeFactory::OptionalReference.new(
            NodeFactories::MediaType
          )
          NodeFactories::Map.new(context, value_factory: factory)
        end
      end
    end
  end
end

# These are in the footer as a cyclic dependency can stop this module loading
require "openapi3_parser/node_factory/optional_reference"
require "openapi3_parser/node_factories/schema"
require "openapi3_parser/node_factories/map"
require "openapi3_parser/node_factories/example"
require "openapi3_parser/node_factories/media_type"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openapi3_parser-0.3.0 lib/openapi3_parser/node_factories/parameter/parameter_like.rb
openapi3_parser-0.2.0 lib/openapi3_parser/node_factories/parameter/parameter_like.rb
openapi3_parser-0.1.0 lib/openapi3_parser/node_factories/parameter/parameter_like.rb