labthings / labthings/labthings-fastapi

Client should consistently return either `dict` or `BaseModel`

Open
#90 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

roadmap
Dominant language
Python
Stars
9
Forks
4
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the return behavior of DirectThingClient and ThingClient, then read the code-generation work in issue #89. Determine how annotated and un-annotated return types should be handled so both clients consistently return the same representation; done means their signatures and runtime results agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python
Domain
api, backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.