Class: DryOpenApi::Encoding

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Includes:
EquatableAsContent
Defined in:
lib/dry_open_api/encoding.rb

Overview

Class Method Summary collapse

Methods included from EquatableAsContent

#==

Class Method Details

.load(hash) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/dry_open_api/encoding.rb', line 15

def self.load(hash)
  new(
    content_type: hash['contentType'],
    headers: hash['headers']&.map { |k, v| [k, Reference.load(v) || Header.load(v)] }.to_h,
    style: hash['style'],
    explode: hash['explode'],
    allow_reserved: hash['allowReserved'].present?
  )
end