ONSdigital/csvcubed

New/ExistingQbAttributeLiteral should validate for no new_attribute_values

Opened this issue · 0 comments

The classes NewQbAttributeLiteral and ExistingQbAttributeLiteral inherit from the QbAttribute(Resource) classes. These have the property new_attribute_values: List[NewQbAttributeValue] which should not be populated when passed down to the QbAttributeLiteral classes.

We currently work around this by setting the init parameter to False in the Literal classes but this means that it is still possible to create a new New/ExistingQbAttributeLiteral that contains a List of NewQbAttributeValues.

This is not currently flagged by _get_validations() function which just checks that the property new_attribute_values is in fact a List of NewQbAttributeValues :

"new_attribute_values": v.list(v.validated_model(NewQbAttributeValue)),

This ticket should alter the _get_validations() call on New/ExistingQbAttributeLiterals so that it checks for an empty list instead of a List of NewQbAttributeValues.