Skip to main content

No project description provided

Project description

fastest-asyncapi

Use pydantic model to construct asyncapi docs and serve inside your asyncapi app

Installation

Install using pip or poetry

poetry add fastest-asyncapi

Usage

  1. Describe your specification using pydantic models
from asyncapi_container.asyncapi.spec.v3.info import Info
from asyncapi_container.containers.v3.simple_spec import SimpleSpecV3
from asyncapi_container.custom_types import RoutingMap
from pydantic import BaseModel, Field


class Customer(BaseModel):
    first_name: str = Field(..., title='First Name')
    last_name: str = Field(..., title='Last Name')
    email: str = Field(..., title='Email', format="email", description="Person's email to deliver order info")
    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 = {
        "shop.orders.v1": [
            OrderSchemaV1,
        ]
    }
    receives: RoutingMap = {}
  1. Configure fast-and-async-api app using asyncapi spec definition from above Mount fastapi-asyncapi urls.
from fastapi import FastAPI

from fastest_asyncapi.views.sync.v3.asyncapi import fastest_asyncapi_app

app = FastAPI()

fastest_asyncapi_app.configure(asyncapi_spec_classes=[MySpecialServiceAsyncAPISpecV3])
app.mount("/docs/", fastest_asyncapi_app)
  1. Enjoy your results by navigating to docs/asyncapi/v3/

alt text

PS: images generated by AI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastest_asyncapi-0.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastest_asyncapi-0.1.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file fastest_asyncapi-0.1.2.tar.gz.

File metadata

  • Download URL: fastest_asyncapi-0.1.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.9 Darwin/22.6.0

File hashes

Hashes for fastest_asyncapi-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f358e90b4524df72b800a1e41c664af30965616f65ffa74514fd5f483ca59459
MD5 8fb72d7794750b797042a12290f0afe5
BLAKE2b-256 e04f08013ceec6548eda4c0412342b7811b20f8b3632276688b73b730908d0cb

See more details on using hashes here.

File details

Details for the file fastest_asyncapi-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: fastest_asyncapi-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.9 Darwin/22.6.0

File hashes

Hashes for fastest_asyncapi-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9fe11c7ded3ba63053ee6d53a1c1bc6fbdb89a5dab8a6e83ef701bf598d4c4de
MD5 16a3def1f5f0bbd1d4eb679c37cdeab3
BLAKE2b-256 3257d064cfb52a4c98de046f686066512c4651011a91df4c8ed1c5467d869cc2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page