You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P2][models] SubscriptionEvent types fields the events API never sends (type, code, payload, created_at) and leaves observed_at/snapshot/deltas untyped #149
Confirmed on 2026-09-13 against the live GET /v1/subscriptions/events body and oilpriceapi-api origin/mainapp/models/watch_event.rb#as_poll_json. The SDK code is origin/maina5304b3, oilpriceapi/models.pySubscriptionEvent.
Defect
SubscriptionEvent models fields the API does not send, and leaves the fields it does send untyped.
SDK field
On the wire?
seq
yes
watch_id
yes
type
no
code
no
payload
no
created_at
no: the timestamp is observed_at
Wire fields the model does not declare, reachable only as untyped pydantic extras (extra="allow"): id, observed_at (ISO string, not parsed to datetime), snapshot, deltas, source, tool_name.
Consequences:
The docstring example on origin/main, print(event.type, event.code), prints None None for every real event.
event.created_at is always None.
Price data (snapshot, deltas) has no type.
Repro
Live body, GET /v1/subscriptions/events?since=99&limit=2, one event shown:
fromoilpriceapi.modelsimportSubscriptionEvente=SubscriptionEvent(**event)
print(e.type, e.code, e.created_at) # None None Noneprint(type(e.observed_at)) # <class 'str'> (an extra, not a datetime)
Expected
Type id, observed_at (a datetime), snapshot, deltas, source and tool_name from the wire shape. Either keep type/code/payload/created_at as deprecated aliases or drop them in a minor release with a CHANGELOG note. Apply to sync and async; they share the model.
PR #147 (#142) already changes the events() docstring example to event.seq, event.watch_id. It does not change the model.
Activity
fix(models): keep never-sent SubscriptionEvent names as deprecated ac…
chore(release): 1.16.0 (#152)