Skip to main content

Container Types: Any

schema.any

Declares a schema that defines any type.

from d42 import schema

sch = schema.any

The schema.any object represents a schema that can match any type of value. This can be useful in some cases where the structure of the data is unknown or can vary widely.


schema.any(*types)

Declares a schema that can be any of the provided types.

from d42 import schema

sch = schema.any(schema.str, schema.int)

# syntax sugar
sch = schema.str | schema.int

Both of the above examples define a schema that can be either a str or an int.