Skip to content

Creating at least one privacy declaration without a name causes validation errors #4

@NevilleS

Description

@NevilleS

From fideslang created by allisonking: IABTechLab#98

Bug Description

Creating at least one privacy declaration without a name causes validation errors

Steps to Reproduce

In a python repl...

>>> from fideslang import System, PrivacyDeclaration
>>> p = PrivacyDeclaration(data_categories=[], data_use="test", data_subjects=[])
>>> p2 = PrivacyDeclaration(data_categories=[], data_use="test", data_subjects=[])
>>> s = System(fides_key="s", system_type="s" privacy_declarations=[p, p2])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pydantic/main.py", line 331, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for System
privacy_declarations
  '<' not supported between instances of 'NoneType' and 'NoneType' (type=type_error)

Doing just one privacy declaration works okay, perhaps because this sort doesn't need to compare

Expected behavior

Be able to make multiple privacy declarations without names without problems

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

  • Version:
  • OS:
  • Python Version:
  • Docker Version:

Additional context

There's a number of ways we could fix this, considering name is being deprecated:

  • Remove the sort
  • Sort on data_use instead
  • Default name to ""

I'm not sure what the best way is, open to suggestions!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions