Class: AWSCDK::BedrockAgentCore::SchemaDefinition

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
bedrock_agent_core/schema_definition.rb

Overview

Schema definition for tool input/output.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, description: nil, items: nil, properties: nil, required: nil) ⇒ SchemaDefinition

Returns a new instance of SchemaDefinition.

Parameters:

  • type (AWSCDK::BedrockAgentCore::SchemaDefinitionType)

    The type of the schema definition.

  • description (String, nil) (defaults to: nil)

    The description of the schema definition.

  • items (AWSCDK::BedrockAgentCore::SchemaDefinition, nil) (defaults to: nil)

    The items in the schema definition.

  • properties (Hash{String => AWSCDK::BedrockAgentCore::SchemaDefinition}, nil) (defaults to: nil)

    The properties of the schema definition.

  • required (Array<String>, nil) (defaults to: nil)

    The required fields in the schema definition.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'bedrock_agent_core/schema_definition.rb', line 12

def initialize(type:, description: nil, items: nil, properties: nil, required: nil)
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5TY2hlbWFEZWZpbml0aW9uVHlwZSJ9")), "type")
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description") unless @description.nil?
  @items = items.is_a?(Hash) ? ::AWSCDK::BedrockAgentCore::SchemaDefinition.new(**items.transform_keys(&:to_sym)) : items
  Jsii::Type.check_type(@items, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5TY2hlbWFEZWZpbml0aW9uIn0=")), "items") unless @items.nil?
  @properties = properties.is_a?(Hash) ? properties.transform_values { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::BedrockAgentCore::SchemaDefinition.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : properties
  Jsii::Type.check_type(@properties, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iZWRyb2NrYWdlbnRjb3JlLlNjaGVtYURlZmluaXRpb24ifSwia2luZCI6Im1hcCJ9fQ==")), "properties") unless @properties.nil?
  @required = required
  Jsii::Type.check_type(@required, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "required") unless @required.nil?
end

Instance Attribute Details

#descriptionString? (readonly)

Note:

Default: - No description

The description of the schema definition.

This description provides information about the purpose and usage of the schema.

Returns:

  • (String, nil)


37
38
39
# File 'bedrock_agent_core/schema_definition.rb', line 37

def description
  @description
end

#itemsAWSCDK::BedrockAgentCore::SchemaDefinition? (readonly)

Note:

Default: - No items definition

The items in the schema definition.

This field is used for array types to define the structure of the array elements.

Returns:

  • (AWSCDK::BedrockAgentCore::SchemaDefinition, nil)


44
45
46
# File 'bedrock_agent_core/schema_definition.rb', line 44

def items
  @items
end

#propertiesHash{String => AWSCDK::BedrockAgentCore::SchemaDefinition}? (readonly)

Note:

Default: - No properties

The properties of the schema definition.

These properties define the fields in the schema.

Returns:

  • (Hash{String => AWSCDK::BedrockAgentCore::SchemaDefinition}, nil)


51
52
53
# File 'bedrock_agent_core/schema_definition.rb', line 51

def properties
  @properties
end

#requiredArray<String>? (readonly)

Note:

Default: - No required fields

The required fields in the schema definition.

These fields must be provided when using the schema.

Returns:

  • (Array<String>, nil)


58
59
60
# File 'bedrock_agent_core/schema_definition.rb', line 58

def required
  @required
end

#typeAWSCDK::BedrockAgentCore::SchemaDefinitionType (readonly)

The type of the schema definition.

This field specifies the data type of the schema.



30
31
32
# File 'bedrock_agent_core/schema_definition.rb', line 30

def type
  @type
end

Class Method Details

.jsii_propertiesObject



60
61
62
63
64
65
66
67
68
# File 'bedrock_agent_core/schema_definition.rb', line 60

def self.jsii_properties
  {
    :type => "type",
    :description => "description",
    :items => "items",
    :properties => "properties",
    :required => "required",
  }
end

Instance Method Details

#to_jsiiObject



70
71
72
73
74
75
76
77
78
79
80
# File 'bedrock_agent_core/schema_definition.rb', line 70

def to_jsii
  result = {}
  result.merge!({
    "type" => @type,
    "description" => @description,
    "items" => @items,
    "properties" => @properties,
    "required" => @required,
  })
  result.compact
end