Sha256: 5cdf621d61ecb9904baf92d533de23af30df930a55c525ca85db86054194cc6e
Contents?: true
Size: 866 Bytes
Versions: 1
Compression:
Stored size: 866 Bytes
Contents
class OpenAPI::Loader::Denormalizer # # Denormalizes all the 'servers' definitions # by moving them from the root OpenAPI object and path objects # right into the corresponding operation objects. # # @private # class Servers < SimpleDelegator def call root_default = delete "servers" paths.each do |path| default = path.delete("servers") || root_default operations(path).each do |operation| operation["servers"] ||= default if default end end end private def paths Enumerator.new do |yielder| fetch("paths", {}).each_value do |path| yielder << path if path.is_a? Hash end end end def operations(path) Enumerator.new do |yielder| path.each_value { |item| yielder << item if item.is_a? Hash } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
open_api-loader-0.0.1 | lib/open_api/loader/denormalizer/servers.rb |