"""Settings Whitelisted Resources Schema.""" from marshmallow import fields from marshmallow.validate import Length, OneOf from permissions.constants import constants from permissions.validations import ma class SettingsWhitelistResourcesSchema(ma.Schema): """Schema for allowed resources in settings app. Properties: - resource_type (str): Type of resource. currently 'LabelParticipant' only. - ids (list): List of identifier for that resource. """ resource_type = fields.Str( validate=OneOf(constants.SETTINGS_SUPPORT_MAPPING['resourceTypes']), required=True ) ids = fields.List(fields.Int(), required=True, validate=Length(min=1))