Metadata-Version: 2.1
Name: fastapi-xml
Version: 1.0.0b1
Summary: adds xml support to fastapi
Home-page: https://github.com/cercide/fastapi-xml
License: MIT
Author: Leon Rendel
Author-email: cercide@tuta.io
Maintainer: Leon Rendel
Maintainer-email: cercide@tuta.io
Requires-Python: >=3.7,<4.0
Classifier: Framework :: FastAPI
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup :: XML
Provides-Extra: docs
Provides-Extra: local
Provides-Extra: testing
Requires-Dist: Sphinx (>=5.2.3,<6.0.0); extra == "docs"
Requires-Dist: fastapi (>=0.70.0)
Requires-Dist: pre-commit (>=2.20.0,<3.0.0); extra == "testing"
Requires-Dist: pydantic (>=1.10.2,<1.11)
Requires-Dist: pytest (>=7.1.3,<8.0.0); extra == "testing"
Requires-Dist: pytest-cov (>=4.0.0,<5.0.0); extra == "testing"
Requires-Dist: tox (>=3.26.0,<4.0.0)
Requires-Dist: tox-poetry (>=0.4.1,<0.5.0); extra == "testing"
Requires-Dist: uvicorn (>=0.18.2,<0.19.0); extra == "local"
Requires-Dist: xsdata (>=22.9)
Project-URL: Repository, https://github.com/cercide/fastapi-xml
Description-Content-Type: text/markdown

# FastAPI::XML

![tests](https://github.com/cercide/fastapi-xml/actions/workflows/tests.yml/badge.svg)
[![codecov](https://codecov.io/gh/cercide/fastapi-xml/branch/master/graph/badge.svg)](https://app.codecov.io/gh/cercide/fastapi-xml)
![license](https://img.shields.io/github/license/cercide/fastapi-xml)
![languages](https://img.shields.io/github/languages/top/cercide/fastapi-xml.svg)
[![CodeFactor](https://www.codefactor.io/repository/github/cercide/fastapi-xml/badge)](https://www.codefactor.io/repository/github/cercide/fastapi-xml)
![versions](https://img.shields.io/pypi/pyversions/fastapi-xml.svg)

`pip install fastapi-xml`


A bridge between [FastAPI](https://github.com/tiangolo/fastapi) and [xsdata](https://github.com/tefra/xsdata). Together,
fastapi handles xml data structures using dataclasses generated by xsdata. Whilst, fastapi handles the api calls, xsdata
covers xml serialisation and deserialization. In addition, openapi support works as well.

![Swagger Example](https://github.com/cercide/fastapi-xml/raw/master/.github/rsc/example.png)

```python
from dataclasses import dataclass, field
from fastapi import FastAPI
from fastapi_xml import add_openapi_extension
from fastapi_xml import NonJsonRoute
from fastapi_xml import XmlAppResponse
from fastapi_xml import XmlBody

@dataclass
class HelloWorld:
    message: str = field(metadata={"example": "Foo","name": "Message", "type": "Element"})

app = FastAPI(title="FastAPI::XML", default_response_class=XmlAppResponse)
app.router.route_class = NonJsonRoute
add_openapi_extension(app)

@app.post("/echo", response_model=HelloWorld, tags=["Example"])
def echo(x: HelloWorld = XmlBody()) -> HelloWorld:
    x.message += " For ever!"
    return x

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="127.0.0.1", port=8000)
```

