Sha256: 7ff0d3f4cd969f4d3d30990d0e3f9429b1e49c817bf9eefac511c4155ee21848
Contents?: true
Size: 771 Bytes
Versions: 9
Compression:
Stored size: 771 Bytes
Contents
module SoberSwag module Nodes ## # OpenAPI v3 represents types that are a "choice" between multiple alternatives as an array. # However, it is easier to model these as a sum type initially: if a type can be either an `A`, a `B`, or a `C`, we can model this as: # # `Sum.new(A, Sum.new(B, C))`. # # This means we only ever need to deal with two types at once. # So, we initially serialize to a sum type, then later transform to this array type for further serialization. class OneOf < ::SoberSwag::Nodes::Array ## # @return [Hash{Symbol => SoberSwag::Nodes::Base}] # the alternatives, wrapped in an `alternatives:` key. def deconstruct_keys(_) { alternatives: @elements } end end end end
Version data entries
9 entries across 9 versions & 1 rubygems