From 6df68b0fb5ea33b6c2b090ba63ed5df694497d37 Mon Sep 17 00:00:00 2001
From: Valentin Lorentz <vlorentz@softwareheritage.org>
Date: Wed, 21 Aug 2019 17:50:00 +0200
Subject: [PATCH] Remove release metadata from serialization if it's None.

It kind of matches the current state of the postgresql storage, which
does not support it.
---
 swh/model/model.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/swh/model/model.py b/swh/model/model.py
index ee994cdf..3ee19a83 100644
--- a/swh/model/model.py
+++ b/swh/model/model.py
@@ -238,6 +238,8 @@ class Release(BaseModel):
         rel = attr.asdict(self)
         rel['date'] = self.date.to_dict() if self.date is not None else None
         rel['target_type'] = rel['target_type'].value
+        if rel['metadata'] is None:
+            del rel['metadata']
         return rel
 
     @classmethod
-- 
GitLab