class OpenApi::Header
github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#header-object
Attributes
allow_empty_value[RW]
deprecated[RW]
description[RW]
other_fields_hash[RW]
required[RW]
Public Class Methods
load(hash)
click to toggle source
# File lib/open_api/header.rb, line 25 def self.load(hash) fixed_field_names = [:description, :required, :deprecated, :allowEmptyValue] other_fields_hash = hash.reject { |key| key.to_sym.in?(fixed_field_names) } new( description: hash["description"], required: hash["required"].nil? ? false : hash["required"], deprecated: hash["deprecated"].nil? ? false : hash["deprecated"], allow_empty_value: hash["allowEmptyValue"].nil? ? false : hash["allowEmptyValue"], **other_fields_hash.symbolize_keys, ) end
new(description: nil, required: false, deprecated: nil, allow_empty_value: false, **other_fields_hash)
click to toggle source
# File lib/open_api/header.rb, line 8 def initialize(description: nil, required: false, deprecated: nil, allow_empty_value: false, **other_fields_hash) self.description = description self.required = required self.deprecated = deprecated self.allow_empty_value = allow_empty_value self.other_fields_hash = other_fields_hash.with_indifferent_access other_fields_hash.keys.each do |field_name| define_singleton_method(field_name) do other_fields_hash[field_name] end define_singleton_method("#{field_name}=") do |value| other_fields_hash[field_name] = value end end end