feat: support object-level descriptions

By saving them as a pydantic model docstring.

Fixes https://github.com/HideyoshiNakazone/jambo/issues/77
This commit is contained in:
Michael Terry
2026-01-14 13:14:48 -05:00
parent 6440c30a91
commit e12396477f
4 changed files with 9 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ class TestObjectTypeParser(TestCase):
properties = {
"type": "object",
"description": "obj desc",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"},
@@ -33,6 +34,7 @@ class TestObjectTypeParser(TestCase):
Model, _args = parser.from_properties_impl(
"placeholder", properties, ref_cache={}
)
self.assertEqual(Model.__doc__, "obj desc")
obj = Model(name="name", age=10)

View File

@@ -274,6 +274,7 @@ class TestSchemaConverter(TestCase):
}
model = self.converter.build_with_cache(schema)
self.assertEqual(model.__doc__, "A person")
obj = model(address={"street": "123 Main St", "city": "Springfield"})