hodur-org / hodur-engine

Hodur is a domain modeling approach and collection of libraries to Clojure. By using Hodur you can define your domain model as data, parse and validate it, and then either consume your model via an API or use one of the many plugins to help you achieve mechanical results faster and in a purely functional manner.
MIT License
282 stars 13 forks source link

Representing nested fields #17

Open TwiceII opened 4 years ago

TwiceII commented 4 years ago

Hey! First of all, I want to thank you for this awesome library, I have been using it lately and find it really useful. One thing I wonder about is - how should one declare fields that are nested? I can represent them as separate entities, but sometimes they are not really worth it. Suppose that I want to declare a schema for some Event in Event Sourcing style app. The Event entity has fields like id, type, timestamp which are flat fields, but also a payload which is nested and has its own fields. Making separate Payload entity is kinda awkward because: 1) Semantically payload is just a part of Event entity. 2) I don't want all the downstream Hodur plugins to treat it as "real" entity and create tables etc for them.