Skip to content

ExternalDocs

faststream.specification.asyncapi.v2_6_0.schema.docs.ExternalDocs #

Bases: BaseModel

A class to represent external documentation.

ATTRIBUTE DESCRIPTION
url

URL of the external documentation

description

optional description of the external documentation

url instance-attribute #

url

description class-attribute instance-attribute #

description = None

model_config class-attribute instance-attribute #

model_config = {'extra': 'allow'}

Config #

extra class-attribute instance-attribute #

extra = 'allow'

from_spec classmethod #

from_spec(docs: None) -> None
from_spec(docs: ExternalDocs) -> Self
from_spec(docs: ExternalDocsDict) -> Self
from_spec(docs: dict[str, Any]) -> dict[str, Any]
from_spec(docs)
Source code in faststream/specification/asyncapi/v2_6_0/schema/docs.py
@classmethod
def from_spec(
    cls,
    docs: SpecDocs | ExternalDocsDict | dict[str, Any] | None,
) -> Self | dict[str, Any] | None:
    if docs is None:
        return None

    if isinstance(docs, SpecDocs):
        return cls(url=docs.url, description=docs.description)

    docs = cast("dict[str, Any]", docs)
    docs_data, custom_data = filter_by_dict(ExternalDocsDict, docs)

    if custom_data:
        return docs

    return cls(**docs_data)