diff --git a/PKG-INFO b/PKG-INFO index 33046f7b9df9b5b39004ae037ebf03c14b3d6ba6..28b3b9be40e54a96698cb30d91a946edb470bc61 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: swh.model -Version: 0.3.1 +Version: 0.3.2 Summary: Software Heritage data model Home-page: https://forge.softwareheritage.org/diffusion/DMOD/ Author: Software Heritage developers diff --git a/swh.model.egg-info/PKG-INFO b/swh.model.egg-info/PKG-INFO index 33046f7b9df9b5b39004ae037ebf03c14b3d6ba6..28b3b9be40e54a96698cb30d91a946edb470bc61 100644 --- a/swh.model.egg-info/PKG-INFO +++ b/swh.model.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: swh.model -Version: 0.3.1 +Version: 0.3.2 Summary: Software Heritage data model Home-page: https://forge.softwareheritage.org/diffusion/DMOD/ Author: Software Heritage developers diff --git a/swh/model/hypothesis_strategies.py b/swh/model/hypothesis_strategies.py index 7e0f42a3a81bb9098bba2d4a37600d10a5a7da62..3e8198bd42d7bd1d54dc626e35a45159e6032daa 100644 --- a/swh/model/hypothesis_strategies.py +++ b/swh/model/hypothesis_strategies.py @@ -179,7 +179,7 @@ def origin_visit_statuses_d(): status=sampled_from(["ongoing", "full", "partial"]), date=aware_datetimes(), snapshot=optional(sha1_git()), - metadata=one_of(none(), metadata_dicts()), + metadata=optional(metadata_dicts()), ) @@ -191,10 +191,10 @@ def origin_visit_statuses(): def releases_d(draw): target_type = sampled_from([x.value for x in ObjectType]) name = binary() - message = binary() + message = optional(binary()) synthetic = booleans() target = sha1_git() - metadata = one_of(none(), revision_metadata()) + metadata = optional(revision_metadata()) return draw( one_of( @@ -234,7 +234,7 @@ revision_metadata = metadata_dicts def revisions_d(): return builds( dict, - message=binary(), + message=optional(binary()), synthetic=booleans(), author=persons_d(), committer=persons_d(), @@ -243,7 +243,7 @@ def revisions_d(): parents=tuples(sha1_git()), directory=sha1_git(), type=sampled_from([x.value for x in RevisionType]), - metadata=one_of(none(), revision_metadata()), + metadata=optional(revision_metadata()), ) # TODO: metadata['extra_headers'] can have binary keys and values @@ -350,7 +350,7 @@ def snapshots_d(draw, *, min_size=0, max_size=100, only_objects=False): branches = draw( dictionaries( keys=branch_names(), - values=one_of(none(), branch_targets_d(only_objects=only_objects)), + values=optional(branch_targets_d(only_objects=only_objects)), min_size=min_size, max_size=max_size, ) diff --git a/swh/model/model.py b/swh/model/model.py index c9ade626039cadaad464305b8aa6998218b93c3d..efb9039bc9565e98845fa1c78de192a98741ef69 100644 --- a/swh/model/model.py +++ b/swh/model/model.py @@ -407,7 +407,7 @@ class RevisionType(Enum): @attr.s(frozen=True) class Revision(BaseModel, HashableObject): - message = attr.ib(type=bytes, validator=type_validator()) + message = attr.ib(type=Optional[bytes], validator=type_validator()) author = attr.ib(type=Person, validator=type_validator()) committer = attr.ib(type=Person, validator=type_validator()) date = attr.ib(type=Optional[TimestampWithTimezone], validator=type_validator()) diff --git a/version.txt b/version.txt index 860639aad272ae5987903126be5200cac6b8392b..87fd2823f92edf801e0b97982d92365939fa5ea0 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v0.3.1-0-ga427e18 \ No newline at end of file +v0.3.2-0-gf723eb1 \ No newline at end of file