So I wrote some Pydantic modules to express at least the shape of the DataRightsRequest and DataRightsStatus objects and as much of the logic as I could feasibly express with Pydantic's validators, and the Python 3 type systems. I had done some experiments using these classes to generate test cases using Hypothesis but that was a tarpit I pulled myself out of. There is some weird complexity here, the BaseModel exists so that a serialized DataRightsRequest will contain a JWT-serialized IdentityPayload. It's quite a neat trick but basically useless right now.
They're used here in status_server.py though, a bit! I got it done in less than 100 lines like I threatened to.
it even includes a Swagger instance. I'll figure out how to load the PIP's openapi.yaml in it and kill two birds with one stone by providing a web tool which can submit PIP requests and receive their callbacks.
The callback server is minimum-viable hack-ish. It stores the statuses as json on-disk where DRP_REQUEST_CACHE environment variable is set, or ./drp-request-cache by default.
If you want to test this, I suggest installing Poetry, running poetry install and then running poetry run uvicorn status_server:app, then http://localhost:8000/docs will load the swagger. :smiling_imp: Or you can install Nix package manager :smiling_imp: and run nix-shell then uvicorn status_server:app
So I wrote some Pydantic modules to express at least the shape of the DataRightsRequest and DataRightsStatus objects and as much of the logic as I could feasibly express with Pydantic's validators, and the Python 3 type systems. I had done some experiments using these classes to generate test cases using Hypothesis but that was a tarpit I pulled myself out of. There is some weird complexity here, the
BaseModel
exists so that a serializedDataRightsRequest
will contain a JWT-serializedIdentityPayload
. It's quite a neat trick but basically useless right now.They're used here in status_server.py though, a bit! I got it done in less than 100 lines like I threatened to.
it even includes a Swagger instance. I'll figure out how to load the PIP's
openapi.yaml
in it and kill two birds with one stone by providing a web tool which can submit PIP requests and receive their callbacks.The callback server is minimum-viable hack-ish. It stores the statuses as json on-disk where
DRP_REQUEST_CACHE
environment variable is set, or./drp-request-cache
by default.If you want to test this, I suggest installing Poetry, running
poetry install
and then runningpoetry run uvicorn status_server:app
, then http://localhost:8000/docs will load the swagger. :smiling_imp: Or you can install Nix package manager :smiling_imp: and runnix-shell
thenuvicorn status_server:app