Skip to content

Use pydantic in CLI - #122

Open
Yannicked wants to merge 11 commits into
developfrom
feature/remote_api_pydantic
Open

Use pydantic in CLI#122
Yannicked wants to merge 11 commits into
developfrom
feature/remote_api_pydantic

Conversation

@Yannicked

Copy link
Copy Markdown
Collaborator

No description provided.

Fixes issue with sim pull
Replace the hand-rolled json.dumps/CustomEncoder request bodies and
res.json() dict indexing in RemoteAPI with the shared models from
simdb.remote.models, so the client and server validate against one
contract.

Request bodies are now pydantic models serialised by
serialise_request_data; responses are parsed with model_validate_json
and try_request maps pydantic ValidationError onto the existing
FailedConnection/RemoteError reporting.

Watcher.to_model now maps the notification enum onto the single
character the API reports, instead of emitting str(Notification.X).
# Conflicts:
#	src/simdb/remote/models.py
#	tests/cli/test_remote_api_version.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant