""" Application entry point for an OpenAPI-first Veterinary Clinic service. This module constructs a FastAPI application exclusively from an OpenAPI specification and a handler namespace, without using decorator-driven routing. All HTTP routes, methods, request/response schemas, and operation bindings are defined in the OpenAPI document referenced by ``openapi_path``. Python callables defined in the ``routes`` module are bound to OpenAPI operations strictly via ``operationId``. This module contains no routing logic, persistence concerns, or framework configuration beyond application assembly. Design guarantees: - OpenAPI is the single source of truth - No undocumented routes can exist - Every OpenAPI operationId must resolve to exactly one handler - All contract violations fail at application startup This file is intended to be used as the ASGI entry point. Example: uvicorn main:app """ from contextlib import asynccontextmanager from starlette.middleware.cors import CORSMiddleware from openapi_first.app import OpenAPIFirstApp import routes from sse import start_worker, stop_worker @asynccontextmanager async def lifespan(app): start_worker() try: yield finally: stop_worker() app = OpenAPIFirstApp( openapi_path="openapi.yaml", routes_module=routes, title="Veterinary Clinic Service", lifespan=lifespan, ) app.add_middleware( CORSMiddleware, allow_origins=["http://localhost:5173"], allow_methods=["*"], allow_headers=["*"], )