febus982/bootstrap-python-fastapi

View on GitHub
src/http_app/routes/ping.py

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
from fastapi import APIRouter
from pydantic import BaseModel, ConfigDict

router = APIRouter()


class PingResponse(BaseModel):
    ping: str

    model_config = ConfigDict(
        json_schema_extra={
            "example": {
                "ping": "pong!",
            }
        }
    )


@router.get("/ping")
async def ping() -> PingResponse:
    return PingResponse(ping="pong!")