Bases: BaseModel
A class to represent a tag.
description class-attribute instance-attribute
description: str | None = None
externalDocs class-attribute instance-attribute
model_config class-attribute instance-attribute
model_config = {'extra': 'allow'}
from_spec classmethod
from_spec(tag: Tag) -> Self
from_spec(tag: dict[str, Any]) -> dict[str, Any]
from_spec(
tag: Tag | TagDict | dict[str, Any],
) -> Self | dict[str, Any]
Source code in faststream/specification/asyncapi/v2_6_0/schema/tag.py
| @classmethod
def from_spec(cls, tag: SpecTag | TagDict | dict[str, Any]) -> Self | dict[str, Any]:
if isinstance(tag, SpecTag):
return cls(
name=tag.name,
description=tag.description,
externalDocs=ExternalDocs.from_spec(tag.external_docs),
)
tag = cast("dict[str, Any]", tag)
tag_data, custom_data = filter_by_dict(TagDict, tag)
if custom_data:
return tag
return cls(
name=tag_data.get("name"),
description=tag_data.get("description"),
externalDocs=tag_data.get("external_docs"),
)
|