Sha256: 8c5af6961f11850a075ab232a80fb0126faf082094bbf864ba0381c1ac11b01c

Contents?: true

Size: 842 Bytes

Versions: 12

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

require "openapi3_parser/node_factory/object"

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

      field "contentType", input_type: String
      field "headers", factory: :headers_factory
      field "style", input_type: String
      field "explode", input_type: :boolean, default: :default_explode
      field "allowReserved", input_type: :boolean, default: false

      private

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

      def headers_factory(context)
        factory = NodeFactory::OptionalReference.new(NodeFactory::Header)
        NodeFactory::Map.new(context, value_factory: factory)
      end

      def default_explode
        context.input["style"] == "form"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
openapi3_parser-0.10.1 lib/openapi3_parser/node_factory/encoding.rb
openapi3_parser-0.9.2 lib/openapi3_parser/node_factory/encoding.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/openapi3_parser-0.9.1/lib/openapi3_parser/node_factory/encoding.rb
openapi3_parser-0.9.1 lib/openapi3_parser/node_factory/encoding.rb
openapi3_parser-0.9.0 lib/openapi3_parser/node_factory/encoding.rb
openapi3_parser-0.8.2 lib/openapi3_parser/node_factory/encoding.rb
openapi3_parser-0.8.1 lib/openapi3_parser/node_factory/encoding.rb
openapi3_parser-0.8.0 lib/openapi3_parser/node_factory/encoding.rb
openapi3_parser-0.7.0 lib/openapi3_parser/node_factory/encoding.rb
openapi3_parser-0.6.1 lib/openapi3_parser/node_factory/encoding.rb
openapi3_parser-0.6.0 lib/openapi3_parser/node_factory/encoding.rb
openapi3_parser-0.5.2 lib/openapi3_parser/node_factory/encoding.rb