attrs

class litestar.plugins.attrs.AttrsSchemaPlugin

基类:OpenAPISchemaPluginProtocol

static is_plugin_supported_type(value: Any) bool

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

参数:

value -- An arbitrary value.

返回:

A typeguard dictating whether the value is supported by the plugin.

to_openapi_schema(field_definition: FieldDefinition, schema_creator: SchemaCreator) Schema

给定类型注解,将其转换为 OpenAPI 模式类。 Args: field_definition: FieldDefinition 实例。 schema_creator: 模式创建器类的实例。 Returns: 一个 OpenAPI 实例。

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

给定一个类型注解,判断该注解是否为包含 attrs 属性的类。 Args: annotation: 一个类型。 Returns: 一个 typeguard,用于判断该类型是否为 attrs 类。