Open piotr-rarus opened 2 months ago
Draive is unable to build a validator for StrEnum. It uses list_validator but doesn't get a range of available values.
Error:
draive.parameters.errors.ParameterValidationError: ("Validation error: Invalid parameter value at: %s - expected '%s' while received '%s'", UserProfileDraive.goals[0], (), <Goal.GENERAL_WELLNESS: 'GENERAL_WELLNESS'>)
Example code:
from enum import StrEnum from draive import DataModel class Goal(StrEnum): GENERAL_WELLNESS = "GENERAL_WELLNESS" INCREASE_ENERGY = "INCREASE_ENERGY" ENHANCE_FOCUS = "ENHANCE_FOCUS" OTHER = "OTHER" class UserProfileDraive(DataModel): name: str goals: list[Goal] user_profile_draive = UserProfileDraive(name='Piotr', goals=[Goal.GENERAL_WELLNESS]) user_profile_draive_json = user_profile_draive.as_json() print(user_profile_draive_json)
It seems that there is some missing part when decoding Enum based types, I will take a closer look at it
Draive is unable to build a validator for StrEnum. It uses list_validator but doesn't get a range of available values.
Error:
Example code: