For watch events associated with a group-version-kind, it should be possible to emit a strongly typed WatchEvent instead. Perhaps override WatchEvent with:
Then use WatchEvent<Pod>, etc for things with a gvk, and WatchEvent<apimachinery::pkg::runtime::RawExtension> for everything else.
As before, the user can ignore the response type and manually deserialize into a WatchEvent<apimachinery::pkg::runtime::RawExtension> if the strong type doesn't meet their requirements for any reason (eg it's incorrect due to a spec bug).
Currently,
WatchEvent.object
is aRawExtension
, which is a newtype wrapper aroundserde_json::Value
. This means the user has to re-deserialize theserde_json::Value
as the actual type they want, likeapi::core::v1::Pod
.For watch events associated with a group-version-kind, it should be possible to emit a strongly typed
WatchEvent
instead. Perhaps overrideWatchEvent
with:Then use
WatchEvent<Pod>
, etc for things with a gvk, andWatchEvent<apimachinery::pkg::runtime::RawExtension>
for everything else.As before, the user can ignore the response type and manually deserialize into a
WatchEvent<apimachinery::pkg::runtime::RawExtension>
if the strong type doesn't meet their requirements for any reason (eg it's incorrect due to a spec bug).