DSL Overview
TODO
This document will be expanded later.
Overview
ElastiCORE DSL is a YAML-based declarative domain model definition language. Instead of writing complex Java code directly, developers define domain models using concise YAML syntax.
YAML-Based Declarative Modeling
Why YAML?
- Readability: A human-friendly format
- Minimal learning curve: No need to learn a separate grammar
- Tool support: YAML is supported by most IDEs
- Easy version control: Track changes easily with Git diff
DSL Components
ElastiCORE DSL consists of the following 5 core components:
| Component | Description | Details |
|---|---|---|
| Entity | JPA entity definitions | Entity Definition |
| DTO | Data transfer object definitions | DTO Definition |
| Enumeration | Enumeration definitions | Enumeration Definition |
| Repository | Custom query definitions | Repository Definition |
| Port | External system communication definitions | Port Overview |
Basic Syntax
# Entity Definition
entity:
User:
meta: entity @expose(20)
fields:
userId: long @id @sequence
name: string(100)! @search(like)
# DTO Definition
dto:
UserDTO:
meta: dto @template(User)
fields:
additionalField: string
# Enumeration Definition
enumeration:
UserStatus:
meta: enum @db(code) @json(code)
fields:
code: string(1) @code
description: string(20)
enum:
ACTIVE: A,Active
INACTIVE: I,Inactive
# Port Definition
port:
ExternalApiPort:
meta: http @url("https://api.example.com")
methods:
getUser:
meta: method @get("/users/{id}")
params:
id: long
return: UserDTO
File Structure
DSL definition files are located under the ./resources/blueprint/{domainName} directory:
resources/
└── blueprint/
└── myDomain/
├── env.yml # Environment configuration
├── entity.yml # Entity definitions
├── dto.yml # DTO definitions
├── enumeration.yml # Enumeration definitions
└── port.yml # Port definitions
Next Steps
- Entity Definition - Learn how to write entities
- Annotation Guide - Reference for available annotations
- env.yml Configuration - How to configure your project