Adds Docs for Object

This commit is contained in:
2025-06-20 23:25:10 -03:00
parent b92cf37145
commit 12471ac804
2 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
Object Type
=================
The Bool type has no specific properties, it has only the generic properties:
- default: Default value for the string.
- description: Description of the string field.
Examples
-----------------
.. code-block:: python
from jambo import SchemaConverter
schema = {
"title": "Person",
"type": "object",
"properties": {
"address": {
"type": "object",
"properties": {
"street": {"type": "string"},
"city": {"type": "string"},
},
"default": {
"street": "Unknown Street",
"city": "Unknown City",
},
},
},
"description": "A person object containing a address.",
"required": ["address"],
}
Person = SchemaConverter.build(schema)
obj = Person.model_validate({ "address": {"street": "123 Main St", "city": "Springfield"} })
print(obj) # Output: Person(address=Address(street='123 Main St', city='Springfield'))
obj_default = Person() # Uses default values
print(obj_default) # Output: Person(address=Address(street='Unknown Street', city='Unknown City'))

View File

@@ -41,3 +41,4 @@ For more complex schemas and types see our documentation on
usage.numeric
usage.bool
usage.array
usage.object