val
val copied to clipboard
Add annotations to document()
If teleport supports it, add information about additional restrictions to the documented schemas. (if not, provide a different way to show them.
For instance, something like:
def non_negative(value):
"""Must be >= 0."""
return value >= 0
schema = Schema({
"balance": And(int, non_negative)})
print(document(schema, with_annotations=True))
{"Struct": {
"required": {"balance": "Integer"},
"optional": {}}
"[whatever teleport supports for this, if anything]": {
"restrictions": {
"balance": "Must be >= 0."}}}