Skip to content

typing.annotate

annotate(field: object, **kwargs: object) -> object

Annotate a type with metadata.

Args

  • field: Type to be annotated.
  • kwargs: Type metadata. See below.

Returns

Annotated type.

Type metadata closely resembles specifications for JSON Schema DRAFT7 with a few additions. A few commonly used keywords are: label, description, units, maximum, minimum, exclusiveMaximum, exclusiveMinimum, maxItems, minItems, maxLength, and minLength.