Adds Docs for Enum

This commit is contained in:
2025-06-22 17:21:28 -03:00
parent ef66903948
commit 6c94047ec0
3 changed files with 40 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
Enum Type
==================
An enum type is a special data type that enables a variable to be a set of predefined constants. The enum type is used to define variables that can only take one out of a small set of possible values.
It does not have any specific properties, but it has the generic properties:
- default: Default value for the enum.
- description: Description of the enum field.
Examples
-----------------
.. code-block:: python
from jambo import SchemaConverter
schema = {
"title": "EnumExample",
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": ["active", "inactive", "pending"],
"description": "The status of the object.",
"default": "active",
},
},
"required": ["status"],
}
Model = SchemaConverter.build(schema)
obj = Model(status="active")
print(obj) # Output: EnumExample(status=status.ACTIVE)

View File

@@ -44,4 +44,5 @@ For more complex schemas and types see our documentation on
usage.object usage.object
usage.reference usage.reference
usage.allof usage.allof
usage.anyof usage.anyof
usage.enum

View File

@@ -50,6 +50,7 @@ repository = "https://github.com/HideyoshiNakazone/jambo.git"
create-hooks = "bash .githooks/set-hooks.sh" create-hooks = "bash .githooks/set-hooks.sh"
tests = "python -m coverage run -m unittest discover -v" tests = "python -m coverage run -m unittest discover -v"
tests-report = "python -m coverage xml" tests-report = "python -m coverage xml"
serve-docs = "sphinx-autobuild docs/source docs/build"
# Build System # Build System
[tool.hatch.version] [tool.hatch.version]