Schema: bounded contexts — model scope slugs and cross-model references
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách xác định định nghĩa schema v1, các kiểm tra của linter và các điểm vào để rendering Mermaid ER và Markdown được mô tả trong issue. Theo dõi cách top-level model keys, entity references và các chu kỳ subtypeOf hiện đang được xử lý; được xem là hoàn thành khi scopes và imports được biểu diễn, đồng thời có thể kiểm tra unresolved references và import cycles mà không làm hỏng rendering hiện có.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
A system outgrows one model. Splitting it is usually correct: different parts have different lifecycles, different owners, and sometimes one half gets open-sourced on its own. Today there is no way for one model to refer to an entity defined in another.
Checked against v1: the top-level keys are description, entities, enums, glossary, invariants, kind, scenarios, title, version. kind is a file-type discriminator (always DomainModel) and title is display-only, so nothing there identifies a model or lets one reference another.
The situation
Two models in one organisation. One describes a development methodology and the artifacts it produces. The other describes a build tool that consumes those artifacts. They are deliberately separate: the second is intended to be usable by teams who have never adopted the first.
They share exactly one small piece of vocabulary — a three-value enum — because the methodology model needs to say where a rule is expressed, and the tool model needs the same three names for its own purposes.
The workaround, and why it is unsatisfying
Define the enum in both models and rely on the names matching. That works and it is what we are doing, so this is not blocking anything.
What it costs: the claim "these two enums are the same enum" lives only in prose. Nothing resolves it, nothing checks it, and the two definitions drift silently. That is the same shape as the gap #24 describes — the linter cannot check a claim the prose makes.
DDD framing
This is bounded contexts, and cross-context reference is normal rather than a smell. Evans names the integration patterns (shared kernel, published language, conformist, anticorruption layer), and a context map is the artifact that records which contexts exist and how they relate. A model that can name its own scope and import another's is the minimum needed to express any of that.
Proposed shape
- Each model declares a scope slug at the top level.
- A model may import other models.
- References across a boundary are written
scope-slug.EntityName.
Deliberately not proposed: prefix-alias mapping in the xmlns style. The slug is short already and an alias layer buys indirection rather than clarity.
What lint could then check
- an import that does not resolve;
- a
scope-slug.EntityNamereference where the slug is not imported, or the entity is not defined in that model; - import cycles across models, the same way
subtypeOfcycles are caught today; - optionally, a local entity whose name shadows an imported one.
Render
The existing principle applies unchanged: the Mermaid ER is a deliberately lossy view and the Markdown is the source of truth. Imported entities could appear in a distinct section (or simply be marked as external where they are referenced) without the ER attempting to draw a context boundary.
Related: #24. Both are cases where the model's prose asserts something the tooling cannot verify.
🤖 Filed by Claude Code on behalf of a modelith user, from a real modelling session that hit this boundary.
- Ngôn ngữ chính
- Go
- Star
- 32
- Fork
- 5
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của stacklok/modelith
-
enhancement
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 68/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
-
documentation
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
Tất cả issue của stacklok/modelith
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
bug group: validation priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
codecheckers/chekhov#51 ·
-
Creating worktree from an existing remote branch with a slash in it, has unexpected behaviour Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100