TinCanPython icon indicating copy to clipboard operation
TinCanPython copied to clipboard

Group with empty member list violates spec?

Open dcollien opened this issue 3 years ago • 0 comments

I've noticed LRS.io (Veracity LRS) does not accept statements from this library which has an "empty list" for the member field of a Group (as is the default in this implementation), it only allows member lists with one or more element, or with the member field missing.

I've patched my own version of group.py to accept None as the default for member rather than empty list (which ends up being omitted) to work around this, but perhaps this could be the default on this implementation too.

    def __init__(self, *args, **kwargs):
        self._object_type = None
        self._member = None

        super(Group, self).__init__(*args, **kwargs)

    def addmember(self, value):
        if self._member is None:
            self._member = AgentList()
        # ... etc.

    @member.setter
    def member(self, value):
        if value is None:
            self._member = None
        else:
           # ... etc.

dcollien avatar Mar 21 '21 03:03 dcollien