Skip to content

Commit a734884

Browse files
committed
Define missing additional properties
1 parent c218c51 commit a734884

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/ruby_llm/schema/dsl.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ def define(name, &)
8181
definitions[name] = {
8282
type: "object",
8383
properties: sub_schema.properties,
84-
required: sub_schema.required_properties
84+
required: sub_schema.required_properties,
85+
additionalProperties: sub_schema.additional_properties
8586
}
8687
end
8788

@@ -139,7 +140,7 @@ def build_property_schema(type, **options, &)
139140
type: "object",
140141
properties: sub_schema.properties,
141142
required: sub_schema.required_properties,
142-
additionalProperties: additional_properties,
143+
additionalProperties: sub_schema.additional_properties,
143144
description: options[:description]
144145
}.compact
145146
end

spec/ruby_llm/schema_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@
244244
street: {type: "string"},
245245
city: {type: "string"}
246246
},
247-
required: %i[street city]
247+
required: %i[street city],
248+
additionalProperties: false
248249
})
249250
end
250251

@@ -269,7 +270,8 @@
269270
street: {type: "string"},
270271
city: {type: "string"}
271272
},
272-
required: %i[street city]
273+
required: %i[street city],
274+
additionalProperties: false
273275
})
274276
end
275277
end

0 commit comments

Comments
 (0)