Typed Features
The generated SDK is more than just a generic HTTP client. It mirrors your API's exact type system.
Sealed resource types
The generated SDK subclass only exposes resource types that exist on your
server:
The generic DjsonApiSdk creates resource classes on the fly for any attribute.
The generated SDK subclass overrides this with a sealed registry — only the
types declared in your API are accepted.
Type conversions
Annotated types drive runtime conversion between JSON:API wire format and native types:
| Python/TS type | JSON:API wire | Client access |
|---|---|---|
int / number |
"42" |
resource.id → 42 |
datetime / Date |
"2026-07-17T10:00:00Z" |
resource.created_at → datetime(...) |
date |
"2026-07-17" |
resource.published_on → date(...) |
UUID / string |
"abc-123" |
resource.uuid → UUID(...) |
str / string |
"hello" |
resource.title → "hello" |
Conversions are applied:
- On deserialization (GET responses → resource attributes)
- On serialization (save/create payloads → JSON:API wire format)
The generated code uses _attribute_types dict for this:
Relationship types
Relationships are typed to the correct target resource class:
This is driven by _relationship_types:
Capability gating
Every resource class has a _capabilities frozenset that determines which
methods exist:
Similarly, relationship capabilities gate mutation methods:
Query method typing
The generated list() method and associated find() have typed filter
parameters matching your endpoint's declared query parameters: