Sha256: 211032d35ee33b3a56b64eede19efc446e1432070437791b9a32e04effd1289f

Contents?: true

Size: 1023 Bytes

Versions: 3

Compression:

Stored size: 1023 Bytes

Contents

# frozen_string_literal: true

require 'yori/schema/v3/media_type'

module Yori
  module Schema
    module V3
      # RequestBody: Describes a single request body.
      class RequestBody < Yori::SchemaBase
        # @!method description
        #   A brief description of the request body. This could contain examples of use.
        #   CommonMark syntax MAY be used for rich text representation.
        # @!method required
        #   Determines if the request body is required in the request. Defaults to false.
        fields :description, :required
        # @!method content
        #   REQUIRED. The content of the request body. The key is a media type or media type range and the value describes it.
        #   For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
        hash_field_block :content, :content_type, Yori::Schema::V3::MediaType

        def validate!
          validate_require_fields!('content')
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yori-0.1.2 lib/yori/schema/v3/request_body.rb
yori-0.1.1 lib/yori/schema/v3/request_body.rb
yori-0.1.0 lib/yori/schema/v3/request_body.rb