Commit 76b109eb authored by George Papathanail's avatar George Papathanail Committed by Dimitrios Gogos
Browse files

fix: omit null fields when publishing TrafficInfluence SRM commands

parent 7942e015
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -111,7 +111,13 @@ class TrafficInfluenceService:
        if self._publisher is None:
            raise RuntimeError("DataBus publisher is not available")
        try:
            await self._publisher.publish(subject, command.model_dump(mode="json"))
            # srm/canonical-parameters-schema.md: "prefer omitting inapplicable keys; do
            # not send null placeholders unless a capability explicitly defines null
            # semantics" -- none of TI's optional fields (domain_id, traffic filter
            # protocol, deactivate's external_ref/service_instance_id) do.
            await self._publisher.publish(
                subject, command.model_dump(mode="json", exclude_none=True)
            )
        except Exception as exc:
            raise DownstreamServiceException(error_msg) from exc