Skip to content

Reorganize attribute handling under entity namespace#45

Merged
afuno merged 2 commits intomainfrom
feature/SRV-359/entity_3
Dec 22, 2025
Merged

Reorganize attribute handling under entity namespace#45
afuno merged 2 commits intomainfrom
feature/SRV-359/entity_3

Conversation

@afuno
Copy link
Member

@afuno afuno commented Dec 22, 2025

No description provided.

Move all attribute-related code from lib/treaty/attribute to lib/treaty/entity/attribute
to better reflect the domain model where attributes belong to entities, not as a
separate top-level concern.

Changes:
- Move attribute builder, options, validators, and validation orchestration classes
- Move attribute base class, DSL, collection, and helper utilities
- Move conditional logic (if/unless) for attribute options
- Move all attribute option modifiers (as, cast, computed, default, transform)
- Move attribute validators (format, inclusion, required, type)
- Add new entity builder to coordinate attribute initialization
- Update request and response attribute classes to reference new location
- Update request and response validators, factories, and entities
- Update core engine and entity module to use reorganized structure
- Move corresponding test suite from spec/treaty/attribute to spec/treaty/entity/attribute
- Update documentation for core concepts and entities

This reorganization improves code cohesion by grouping attribute logic with
its containing entity, making the architectural intent clearer.
- Moved `Info::Entity` modules (Builder, DSL, Result) under `Entity::Info`.
- Introduced a dedicated `Entity::Base` class to standardize reusable entities.
- Updated all references in code and documentation to use `Entity::Base` as the primary entity class.
- Reorganized `Entity` attributes and utilities into a nested module for clarity.
- Updated tests and specs to reflect the new namespace structure.
- Adjusted i18n translations to align with the new class names and an improved validation messaging system.
- Updated entity-related documentation for better examples and clearer explanations.

This refactoring improves domain alignment, readability, and future flexibility.
@afuno afuno added this to the v1.0.0 milestone Dec 22, 2025
@afuno afuno self-assigned this Dec 22, 2025
@afuno afuno added the feature label Dec 22, 2025
@afuno afuno marked this pull request as ready for review December 22, 2025 09:41
@afuno afuno merged commit f8724fc into main Dec 22, 2025
40 of 44 checks passed
@afuno afuno deleted the feature/SRV-359/entity_3 branch December 22, 2025 09:42
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.

1 participant