Skip to content

Client should consistently return either dict or BaseModel #90

Open

Description

@rwb27

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.

Activity

  1. added
    roadmap
    on Dec 18, 2024
  2. rwb27 commented on Dec 19, 2024

    @rwb27
    CollaboratorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    roadmap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions