Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client should consistently return either dict or BaseModel #90

Open
rwb27 opened this issue Dec 18, 2024 · 1 comment
Open

Client should consistently return either dict or BaseModel #90

rwb27 opened this issue Dec 18, 2024 · 1 comment
Labels
roadmap Plans for the future

Comments

@rwb27
Copy link
Collaborator

rwb27 commented Dec 18, 2024

At the moment, the intention is that a DirectThingClient and a ThingClient should have the same signature, but in reality the server-side "client" object returns Pydantic models (if that's the return type) while the client-side version returns simple Python objects (i.e. whatever's deserialised from JSON).

Once code generation is in (#89) we might be able to return Model objects from both. That would make everything so much neater and more type-checkable. Handling un-annotated types gracefully might be a challenge, but hopefully one we can figure out.

@rwb27 rwb27 added the roadmap Plans for the future label Dec 18, 2024
@rwb27
Copy link
Collaborator Author

rwb27 commented Dec 19, 2024

Related to this: it would be very nice to handle Blob types better - i.e. automatically inflate them to blob objects from the dictionary. This is much easier if we have the blob in a response model. I'd envisage registering Blob subclasses for specific mime types, and picking the best class for each blob. That way, JPEGBlobs could be easily turned back into images, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
roadmap Plans for the future
Projects
None yet
Development

No branches or pull requests

1 participant