val icon indicating copy to clipboard operation
val copied to clipboard

Add annotations to document()

Open thisfred opened this issue 10 years ago • 0 comments

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."}}}

thisfred avatar Feb 16 '15 19:02 thisfred