Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pydantic): allow str fields to be populated by int #2166

Merged
merged 5 commits into from
Oct 2, 2024

Conversation

MartinBelthle
Copy link
Contributor

@MartinBelthle MartinBelthle commented Oct 1, 2024

Fix [ANT-2255]

1- Introduces a class BaseModelInHouse to allow coercing and use it everywhere in the code
2- Little refactor to avoid circular import
3- Add test case that used to fail: Creation of a thermal cluster with the name 1111

@MartinBelthle MartinBelthle self-assigned this Oct 1, 2024
@MartinBelthle MartinBelthle requested a review from sylvlecl October 1, 2024 17:27
from antarest.core.exceptions import ShouldNotHappenException

logger = logging.getLogger(__name__)

UUID_PATTERN = re.compile("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$")


class BaseModelInHouse(BaseModel):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposition: renaming to AntaresBaseModel and move it to antares/core/serialization

sylvlecl
sylvlecl previously approved these changes Oct 2, 2024
@MartinBelthle MartinBelthle merged commit 3b0dfff into dev Oct 2, 2024
10 of 11 checks passed
@MartinBelthle MartinBelthle deleted the fix/coercing-issue branch October 2, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants