attrs

class litestar.plugins.attrs.AttrsSchemaPlugin[原始碼]

基底類別:OpenAPISchemaPlugin

static is_plugin_supported_type(value: Any) bool[原始碼]

Given a value of indeterminate type, determine if this value is supported by the plugin.

This is called by the default implementation of is_plugin_supported_field() for backwards compatibility. User's should prefer to override that method instead.

參數:

value -- An arbitrary value.

回傳:

A bool indicating whether the value is supported by the plugin.

to_openapi_schema(field_definition: FieldDefinition, schema_creator: SchemaCreator) Schema[原始碼]

Given a type annotation, transform it into an OpenAPI schema class.

參數:
  • field_definition -- FieldDefinition instance.

  • schema_creator -- An instance of the schema creator class

回傳:

An OpenAPI instance.

litestar.plugins.attrs.is_attrs_class(annotation: Any) TypeGuard[type[AttrsInstance]][原始碼]

Given a type annotation determine if the annotation is a class that includes an attrs attribute.

參數:

annotation -- A type.

回傳:

A typeguard determining whether the type is an attrs class.