Skip to main content
ElastiCORE 3.0 is a release candidate: 3.0.261022-rc1 on Maven Central. Projects on the 2.2 line: see the 2.2 documentation.
Version: 3.0

Reading the DSL: one line, every layer

The whole grammar is six habits, so a developer writes it by hand and a reviewer reads it at a glance. New features keep these shapes - there is no new grammar per feature.

PrincipleExample
1One line is one field - it decides storage, validation, search and exposurename: string(30)! @search(like)
2Common things are symbols beside the type(30) length, ! required, (10.2) precision
3Entity-level rules go on the one meta: linemeta: entity @root @editable @expose(20) @access(read=public)
4Defaults - write only what differs@expose(20) alone gives create, read, search, paging and REST
5YAML sections are the conceptsentity, dto, enumeration, states, metrics, port
6The description follows -- - the model documents itself-- unit of sale (Large, Male Puppy ...)

A line, taken apart​

unitCost:  money(10.2)!  @min(0.01, 'price must be positive')  @terms(price, 가격)
PieceMeans
unitCostthe name
money(10.2)the type and its precision (10 digits, 2 after the point)
!required
@min(0.01, 'price must be positive')a rule and its message
@terms(price, 가격)what people call this value (synonyms BI and AI tools look for)

Business rules keep the same shapes​

FeatureShapeExample (pet store)
A lifecycle stepcommand: FROM -> TOship: PLACED -> SHIPPED
States a row may be deleted inone more line in states:delete: CANCELLED
A business measurename: expression @terms -- descriptionrevenue: sum(PurchaseOrder.total) where status != CANCELLED
Access and ownershipmarks on the meta: line@owner(customerId) @access(read=owner, create=user, cancel=owner)
Another context's type or eventcontext:Namecatalog:Product, on: [shop:OrderPlaced]

When the DSL is wrong the generator says, in one sentence, what is wrong and how to fix it - for example states.status names SHIPED, which OrderStatus does not have (it has PLACED, SHIPPED, CANCELLED). A person or an AI reads that and fixes it right away.

The top-level sections​

SectionWhatReference
entity:entities and value objects; inside an entity fields:, states:, commands:Entities
dto:DTOs of your ownDTOs
enumeration:enumerations with codes and labelsEnumerations
repository:query methods added to a repositoryRepositories
port:calls to other systems (HTTP, SQL, gRPC)Ports
domainService:, processManager:operations of no single aggregate; reactions to events (DDD bundles)Derived values and events
metrics:business measures for the Ossie exportMetrics

Files: src/main/resources/blueprint/<domain>/model/*.yml - split them by kind (entity.yml, enum.yml, dto.yml, ...) as you like; settings go in blueprint/<domain>/env.yml.

YAML pitfalls

A description with : in it (-- ordered by: the member) breaks the file, and # cuts the rest of the line off as a comment. Write -- ordered by the member, or quote the whole line. A file that does not parse is reported as * LOAD ERROR: <file> and, on the rule engine, stops the build.