pg.schema

Accessible via pg.schema, pg.typing.schema.

schema(cls_or_fn, args=None, returns=None, *, auto_typing=True, auto_doc=True, remove_self=True, include_return=False)[source]

Returns the schema from the signature of a class or a function.

Return type:

pg.Schema

Parameters:
  • cls_or_fn – A class or a function.

  • args – (Optional) additional annotations for arguments.

  • returns – (Optional) additional annotation for return value.

  • auto_typing – If True, enable type inference from annotations.

  • auto_doc – If True, extract schema/field description form docstrs.

  • remove_self – If True, remove the first self argument if it appears in the signature.

  • include_return – If True, include the return value spec in the schema with key ‘return_value’.

Returns:

A pg.typing.Schema object.