Sha256: b76032afa2d3fc3f930546a8675bd89a722ec982cb9a28273b946422cf228538
Contents?: true
Size: 787 Bytes
Versions: 1
Compression:
Stored size: 787 Bytes
Contents
require "mountapi/schema/base" module Mountapi module Schema # Schema implementation for Array class Array include Base # @param [Object] value the inbound value for this schema # # cast the inbound value and it's items # in case of array we already expect an array. (from rack Query parser) def cast(array) raise_cast_error(array) unless array.is_a?(::Array) array.to_a.map do |item| Schema.build(open_api_schema.items).cast(item) end end # for array we also transform items to json_schema def self.to_json_schema(key_name, value) if key_name == "items" value = Schema.build(value).to_json_schema end { key_name => value } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mountapi-0.11.1 | lib/mountapi/schema/array.rb |