Class: Vellum::NodeParentContext
- Inherits:
-
Object
- Object
- Vellum::NodeParentContext
- Defined in:
- lib/vellum_ai/types/node_parent_context.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #links ⇒ Array<Vellum::SpanLink> readonly
- #node_definition ⇒ Vellum::VellumCodeResourceDefinition readonly
- #parent ⇒ Vellum::ParentContext readonly
- #span_id ⇒ String readonly
- #type ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(parent: OMIT, links: OMIT, node_definition:, type:, span_id:, additional_properties: nil) ⇒ Vellum::NodeParentContext constructor
- #to_json ⇒ String
Constructor Details
#initialize(parent: OMIT, links: OMIT, node_definition:, type:, span_id:, additional_properties: nil) ⇒ Vellum::NodeParentContext
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/vellum_ai/types/node_parent_context.rb', line 35 def initialize(parent: OMIT, links: OMIT, node_definition:, type:, span_id:, additional_properties: nil) @parent = parent if parent != OMIT @links = links if links != OMIT @node_definition = node_definition @type = type @span_id = span_id @additional_properties = additional_properties @_field_set = { "parent": parent, "links": links, "node_definition": node_definition, "type": type, "span_id": span_id }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
21 22 23 |
# File 'lib/vellum_ai/types/node_parent_context.rb', line 21 def additional_properties @additional_properties end |
#links ⇒ Array<Vellum::SpanLink> (readonly)
13 14 15 |
# File 'lib/vellum_ai/types/node_parent_context.rb', line 13 def links @links end |
#node_definition ⇒ Vellum::VellumCodeResourceDefinition (readonly)
15 16 17 |
# File 'lib/vellum_ai/types/node_parent_context.rb', line 15 def node_definition @node_definition end |
#parent ⇒ Vellum::ParentContext (readonly)
11 12 13 |
# File 'lib/vellum_ai/types/node_parent_context.rb', line 11 def parent @parent end |
#span_id ⇒ String (readonly)
19 20 21 |
# File 'lib/vellum_ai/types/node_parent_context.rb', line 19 def span_id @span_id end |
#type ⇒ String (readonly)
17 18 19 |
# File 'lib/vellum_ai/types/node_parent_context.rb', line 17 def type @type end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::NodeParentContext
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/vellum_ai/types/node_parent_context.rb', line 50 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) unless parsed_json["parent"].nil? parent = parsed_json["parent"].to_json parent = Vellum::ParentContext.from_json(json_object: parent) else parent = nil end links = parsed_json["links"]&.map do | item | item = item.to_json Vellum::SpanLink.from_json(json_object: item) end unless parsed_json["node_definition"].nil? node_definition = parsed_json["node_definition"].to_json node_definition = Vellum::VellumCodeResourceDefinition.from_json(json_object: node_definition) else node_definition = nil end type = parsed_json["type"] span_id = parsed_json["span_id"] new( parent: parent, links: links, node_definition: node_definition, type: type, span_id: span_id, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
92 93 94 95 96 97 98 |
# File 'lib/vellum_ai/types/node_parent_context.rb', line 92 def self.validate_raw(obj:) obj.parent.nil? || Vellum::ParentContext.validate_raw(obj: obj.parent) obj.links&.is_a?(Array) != false || raise("Passed value for field obj.links is not the expected type, validation failed.") Vellum::VellumCodeResourceDefinition.validate_raw(obj: obj.node_definition) obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.span_id.is_a?(String) != false || raise("Passed value for field obj.span_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
83 84 85 |
# File 'lib/vellum_ai/types/node_parent_context.rb', line 83 def to_json @_field_set&.to_json end |