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

Generate and associate type information for domain elements #454

Open
subhashb opened this issue Aug 13, 2024 · 0 comments
Open

Generate and associate type information for domain elements #454

subhashb opened this issue Aug 13, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@subhashb
Copy link
Contributor

subhashb commented Aug 13, 2024

Having type information available for elements like Aggregates, Entities, and Events is invaluable. While this works in most cases, some edge scenarios need to be handled:

  • Type information for elements subclassing an abstract base element, like HoldExpired and HoldPlaced event classes below:

    @lending.event(part_of="Patron", abstract=True)
    class HoldEvent:
        patron_id = Identifier(required=True)
        patron_type = String(required=True)
        hold_id = Identifier(required=True)
        branch_id = Identifier(required=True)
        book_id = Identifier(required=True)
        hold_type = String(required=True)
        requested_at = DateTime(required=True)
        expires_on = Date()
    
    
    @lending.event(part_of="Patron")
    class HoldExpired(HoldEvent):
        """Event raised when a hold on a book placed by a patron expires"""
    
    
    @lending.event(part_of="Patron")
    class HoldPlaced(HoldEvent):
        """Event raised when a book is placed on hold"""
    
  • Auto-generated fields like id and attributes/shadow fields backing associations and value objects

  • Special fields like HasMany and ValueObject that are connected to other elements have to be annotated with the proper types and attributse

@subhashb subhashb added the enhancement New feature or request label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant