From e735b537c7f3f90b49829c90f1ed9fa86b000b23 Mon Sep 17 00:00:00 2001 From: Michael Chisholm Date: Wed, 31 Mar 2021 20:56:31 -0400 Subject: [PATCH] Remove a workaround which was used in the 2.0 and 2.1 Report objects, to structure object_refs type requirements as an empty blacklist, instead of a whitelist. I think it was originally necessary due to the older implementation of ReferenceProperty which was in place at the time. With the implementation change to invert whitelists with generics to blacklists when allow_custom=True, a "full" whitelist is internally converted to an empty blacklist anyway, so it winds up being the same thing. But I think the full whitelist looks better in the code, so I prefer that to the empty blacklist. --- stix2/v20/sdo.py | 2 +- stix2/v21/sdo.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stix2/v20/sdo.py b/stix2/v20/sdo.py index d08063e..8565dcb 100644 --- a/stix2/v20/sdo.py +++ b/stix2/v20/sdo.py @@ -240,7 +240,7 @@ class Report(_DomainObject): ('name', StringProperty(required=True)), ('description', StringProperty()), ('published', TimestampProperty(required=True)), - ('object_refs', ListProperty(ReferenceProperty(invalid_types=[], spec_version='2.0'), required=True)), + ('object_refs', ListProperty(ReferenceProperty(valid_types=["SCO", "SDO", "SRO"], spec_version='2.0'), required=True)), ('revoked', BooleanProperty(default=lambda: False)), ('labels', ListProperty(OpenVocabProperty(REPORT_LABEL), required=True)), ('external_references', ListProperty(ExternalReference)), diff --git a/stix2/v21/sdo.py b/stix2/v21/sdo.py index bba531e..da90542 100644 --- a/stix2/v21/sdo.py +++ b/stix2/v21/sdo.py @@ -644,7 +644,7 @@ class Report(_DomainObject): ('description', StringProperty()), ('report_types', ListProperty(OpenVocabProperty(REPORT_TYPE))), ('published', TimestampProperty(required=True)), - ('object_refs', ListProperty(ReferenceProperty(invalid_types=[], spec_version='2.1'), required=True)), + ('object_refs', ListProperty(ReferenceProperty(valid_types=["SCO", "SDO", "SRO"], spec_version='2.1'), required=True)), ('revoked', BooleanProperty(default=lambda: False)), ('labels', ListProperty(StringProperty)), ('confidence', IntegerProperty()),