Closed spopp20 closed 1 year ago
Can you provide an example of a fastapi-xml/FastAPI app using a routes folder?
If you place your echo example in echo.py in a routes folder we no longer have the @app.get decorator defined and using
This can issue can be closed.
Here is a working routes/health.py example.
from dataclasses import dataclass, field from fastapi import APIRouter from fastapi_xml import XmlBody from fastapi_xml import NonJsonRoute router = APIRouter() router.route_class = NonJsonRoute @dataclass class HealthBody: message: str = field(metadata={"example": "Server Health","name": "Message", "type": "Element"}) @router.post('/health', response_model=HealthBody, tags=["Health"]) async def postHealth(x: HealthBody = XmlBody()) -> HealthBody: x.message += ' Healthy!' return x
Can you provide an example of a fastapi-xml/FastAPI app using a routes folder?
If you place your echo example in echo.py in a routes folder we no longer have the @app.get decorator defined and using
This can issue can be closed.
Here is a working routes/health.py example.