Introduce computed attribute modifier for derived values#38
Merged
Conversation
- Added `Treaty::Attribute::Option::Modifiers::ComputedModifier` to compute attribute values using raw data context. - Enhanced documentation with detailed examples, comparison with `transform`, and advanced error handling. - Updated specs to cover typical and edge cases for the new `computed` modifier. - Adjusted transformation order documentation to include `computed` at the top of the modifier chain. - Refactored existing tests and services to demonstrate usage of computed attributes.
- Renamed all `context` parameters to `root_data` across codebase for improved conceptual consistency. - Updated method signatures in `ComputedModifier`, `OptionOrchestrator`, validation classes, and other related areas. - Refactored computation logic in tests and examples to align with `root_data` terminology. - Enhanced documentation, examples, and troubleshooting guides to reflect the renaming.
- Added error messages for `computed` modifier in English and German translations.
- Included a dedicated section for `computed` in the modifier error message reference.
- Expanded documentation with examples of `%{attribute}`, `%{type}`, and `%{error}` keys for `computed`.
- Introduced comprehensive test coverage for `Serialization::OrderDto` class. - Validated presence and data types for all attributes including `id`, `customer_name`, and `items`. - Covered nested attribute validations for `items` and its associated fields such as `product_name`, `quantity`, and `unit_price_cents`. - Ensured correctness for computed attributes like `line_total_cents`, `subtotal_cents`, `tax_cents`, and `total_cents`. - Included checks for formatted and cast attributes like `formatted_total` and `created_at`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.