Skip to content

Schema

faststream.asyncapi.schema.main.Schema #

Bases: BaseModel

A class to represent a schema.

METHOD DESCRIPTION
to_jsonable

Convert the schema to a JSON-serializable object.

to_json

Convert the schema to a JSON string.

to_yaml

Convert the schema to a YAML string.

Note

The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)

asyncapi class-attribute instance-attribute #

asyncapi: str = ASYNC_API_VERSION

channels instance-attribute #

channels: Dict[str, Channel]

components class-attribute instance-attribute #

components: Optional[Components] = None

defaultContentType class-attribute instance-attribute #

defaultContentType: Optional[str] = None

externalDocs class-attribute instance-attribute #

externalDocs: Optional[
    Union[ExternalDocs, ExternalDocsDict, Dict[str, Any]]
] = None

id class-attribute instance-attribute #

id: Optional[str] = None

info instance-attribute #

info: Info

servers class-attribute instance-attribute #

servers: Optional[Dict[str, Server]] = None

tags class-attribute instance-attribute #

tags: Optional[
    List[Union[Tag, TagDict, Dict[str, Any]]]
] = None

to_json #

to_json() -> str
Source code in faststream/asyncapi/schema/main.py
def to_json(self) -> str:
    return model_to_json(
        self,
        by_alias=True,
        exclude_none=True,
    )

to_jsonable #

to_jsonable() -> Any
Source code in faststream/asyncapi/schema/main.py
def to_jsonable(self) -> Any:
    return model_to_jsonable(
        self,
        by_alias=True,
        exclude_none=True,
    )

to_yaml #

to_yaml() -> str
Source code in faststream/asyncapi/schema/main.py
def to_yaml(self) -> str:
    from io import StringIO

    import yaml

    io = StringIO(initial_value="", newline="\n")
    yaml.dump(self.to_jsonable(), io, sort_keys=False)
    return io.getvalue()

Last update: 2023-11-13