Class: Anthropic::Helpers::InputSchema::ParsedJson Abstract

Inherits:
Internal::Type::Unknown show all
Defined in:
lib/anthropic/helpers/input_schema/parsed_json.rb

Overview

This class is abstract.

Like Anthropic::Internal::Type::Unknown, but for parsed JSON values, which can be incomplete or malformed.

Class Method Summary collapse

Methods inherited from Internal::Type::Unknown

==, ===, dump, to_sorbet_type

Methods included from Internal::Type::Converter

#coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Class Method Details

.coerce(value, state:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

No coercion needed for Unknown type.

Parameters:

  • value (Object)
  • state (Hash{Symbol=>Object})

    .

    @option state [Boolean] :translate_names

    @option state [Boolean] :strictness

    @option state [HashSymbol=>Object] :exactness

    @option state [Class<StandardError>] :error

    @option state [Integer] :branched

Returns:

  • (Object)


30
31
32
33
34
# File 'lib/anthropic/helpers/input_schema/parsed_json.rb', line 30

def coerce(value, state:)
  (state[:error] = value) if value.is_a?(StandardError)

  super
end