Closed maybe-sybr closed 3 years ago
In accordance with my discussion from issue 507, a defaulted optional property is effectively logically required. Using the NOW
default is a convenience which essentially allows the system to compute a value for you. As mentioned in the other issue, the assumption is that omitting the property would result in a noncompliant object. If you don't set the property, the property must be included with its default value. It's not so much a transformation, as ensuring compliance by taking advantage of the provided default.
Closing per the discussion on #507. Thanks again @chisholm and @clenk !
While doing some experimentation related to my situation described in #507, I found that parsing or making a copy of a STIX object (specifically one of my "event" observables), which has no value for an optional property with some non-constant default value like
NOW
, actually sets that property by calling the default callable.I think this might be a more convincing use case for the
UNSET
constant I proposed in #507. Using this similar diff seems to make parsing and deepcopying non-transformative, although it would break the existing assumptions that all properties with default values are available for dotted attribute access (e.g.stix_obj.foo
raises anAttributeError
now).