A new format for entity category restrictions was needed to support
being able to express that certain categories should not be "mixed"
(refeds personalized, pseudonymous, anonymous).
In discussions, it was determined that Pydantic was a suitable tool to
load such configuration in a way that made it convenient, and safe, to
work with.
This code is backwards compatible with the old entity categories module
data format (RELEASE and ONLY_REQUIRED, two dictionaries) but also adds
support for a new format, RESTRICTIONS which is a list of dicts that
Pydantic will marshal into EntityCategoryRule objects when loaded.
As often is the case when typing, the scope of the change spread a
little to related functions and classes.
Description
The feature or problem addressed by this PR
Complete the changes needed to entity category handling in order to support refeds personalized, pseudononymous and anonymous.
What your changes do and why you chose this solution
A new format for entity category restrictions was needed to support
being able to express that certain categories should not be "mixed"
(refeds personalized, pseudonymous, anonymous).
In discussions, it was determined that Pydantic was a suitable tool to
load such configuration in a way that made it convenient, and safe, to
work with.
This code is backwards compatible with the old entity categories module
data format (RELEASE and ONLY_REQUIRED, two dictionaries) but also adds
support for a new format, RESTRICTIONS which is a list of dicts that
Pydantic will marshal into EntityCategoryRule objects when loaded.
As often is the case when typing, the scope of the change spread a
little to related functions and classes.
Checklist