attrs#

class litestar.plugins.attrs.AttrsSchemaPlugin#

Bases: OpenAPISchemaPluginProtocol

static is_plugin_supported_type(value: Any) bool#

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

Parameters:

value – An arbitrary value.

Returns:

A typeguard dictating 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.

Parameters:
  • field_definition – FieldDefinition instance.

  • schema_creator – An instance of the schema creator class

Returns:

An OpenAPI instance.

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

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

Parameters:

annotation – A type.

Returns:

A typeguard determining whether the type is an attrs class.