Channel

pydantic model asyncapi_container.containers.v3.simple_channels.TopicV3

Simplified version of AsyncAPI channel used as topic.

Config:
  • arbitrary_types_allowed: bool = True

Fields:
field address: str | None = None

An optional string representation of this channel’s address. The address is typically the “topic name”, “routing key”, “event type”, or “path”. When null or absent, it MUST be interpreted as unknown. This is useful when the address is generated dynamically at runtime or can’t be known upfront. It MAY contain Channel Address Expressions. Query parameters and fragments SHALL NOT be used, instead use bindings to define them.

field description: str = ''

An optional description of this channel. CommonMark syntax can be used for rich text representation.

field summary: str = ''

A short summary of the channel.

field tags: list[asyncapi_container.asyncapi.spec.v3.tag.Tag] | None = None

A list of tags for logical grouping of channels.

field title: str = ''

A human-friendly title for the channel.

class Config

class Customer(BaseModel):
    first_name: str = Field(..., title='First Name')
    last_name: str = Field(..., title='Last Name')
    email: str = Field(..., title='Email')
    country: str = Field(..., title='Country')
    zipcode: str = Field(..., title='Zipcode')
    city: str = Field(..., title='City')
    street: str = Field(..., title='Street')
    apartment: str = Field(..., title='Apartment')


class OrderSchemaV1(BaseModel):
    product_id: int = Field(..., title='Product Id')
    quantity: int = Field(..., title='Quantity')
    customer: Customer


class MySpecialServiceAsyncAPISpecV3(SimpleSpecV3):
    info: Info = Info(
        title="My special Service",
        version="1.0.0",
        description="Service for making orders"
    )
    sends: RoutingMap = {}
    receives: RoutingMap = {
        TopicV3(
            address="test.topic.v1",
            title="TESTING TITLE",
            description="test",
            summary="testing summary",
            tags=[
                Tag(name="test"),
            ]
        ): [
            Customer
        ]
    }