Sha256: 49db2389e5eb9cbda9291d33a70acc391c8a81c7e520a9ad25037011532eba6e

Contents?: true

Size: 690 Bytes

Versions: 7

Compression:

Stored size: 690 Bytes

Contents

# Represents any Object

require_relative '../exceptions'

module Attributor
  class Object
    include Type

    def self.native_type
      ::BasicObject
    end

    def self.example(_context = nil, options: {})
      'An Object'
    end

    # Not really used (we override as_json_schema to represent this as an Any Type),
    # but if it _were_ used, this would be accurate.
    def self.json_schema_type
      :object
    end

    # Represents Object as an OpenAPI Any Type.
    #
    # @see https://swagger.io/docs/specification/data-models/data-types/#any
    def self.as_json_schema(**kwargs)
      schema = super(**kwargs)
      schema.delete(:type)
      schema
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
attributor-8.0 lib/attributor/types/object.rb
attributor-7.1 lib/attributor/types/object.rb
attributor-7.0 lib/attributor/types/object.rb
attributor-6.5 lib/attributor/types/object.rb
attributor-6.4 lib/attributor/types/object.rb
attributor-6.3 lib/attributor/types/object.rb
attributor-6.2 lib/attributor/types/object.rb