Feat/basic domain layer#63
Conversation
- Test normalization, validation, equality, hashing, repr and unwrap methods
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Test validation
- Test validation, equality, hashing and repr methods
|
@ShavrinAleksei, Check the tests for Entity, I have a question. Should entities be compared and hashed only by id? or all fields? |
- Test implementation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 352fe89a5f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| """Base class for all value objects.""" | ||
|
|
||
| def __init__(self, value: ValueT) -> None: | ||
| self._value = self._normalize(value) |
There was a problem hiding this comment.
Copy incoming value to preserve value-object immutability
The constructor stores _normalize(value) by reference, so if a mutable input is passed and normalization returns that object, later external mutations change internal state after validation. This undermines value-object immutability and can silently change equality/hash behavior over time; defensively copying at construction avoids aliasing with caller-owned data.
Useful? React with 👍 / 👎.
- Test copy incoming value
Summary
Summary
Add base classes for DDD patterns:
BaseEntity,BaseValueObject,BaseUseCase.Changes
DomainError,InvariantViolationErrorandValidationError.BaseValueObject,BaseEntity.EntityIdUUID6ValueObject.selfin test classes.ty-checkby specifying the python virtual environment:pre-commithook fortyastral-sh/ty#269.ApplicationError.BaseUseCase.Verification
just checkDocs
Tests
BaseValueObjectBaseEntityEntityIdUUID6ValueObjectBaseUseCaseChangelog
changelog.d/