Experiment to use openapi tools to generate a fastapi server. Note that fastapi generation is beta support and not well documented.
serve.yml was hand constructed using parts of CiviForm's openapi export for a test program.
CLI docs Fast API generators doc
openapi-generator-cli generate -i ./server.yml -g python-fastapi -o ./server-python-fastapi
See server docs too
cd server-python-fastapi/
PYTHONPATH=src uvicorn openapi_server.main:app --host 0.0.0.0 --port 8080
curl -s -H 'accept: application/json' -H 'Content-Type: application/json' -K post_request.txt
send_app.py is an example of adding a custom api handler by simply subclassing programs_api_base, programs_api then looks up the child and calls the api handler on it.
Note: that it seems all apis must be defined in the same child as the base class contains them as abstract. It's unclear the intent in the base or programs_api for using the array, but given this is beta, it may improve later.