Skip to content

Commit

Permalink
feat(core): added ubiquitous language support (#1000)
Browse files Browse the repository at this point in the history
* feat(core): added ubiquitous language support

* Create loud-days-pump.md

* feat(core): added ubiquitous language support

* feat(core): added ubiquitous language support
  • Loading branch information
boyney123 authored Dec 5, 2024
1 parent 38e6165 commit ccd3a5a
Show file tree
Hide file tree
Showing 16 changed files with 796 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-days-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eventcatalog/core": minor
---

feat(core): added ubiquitous language support
7 changes: 7 additions & 0 deletions default-files-for-collections/ubiquitousLanguages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
id: ubiquitous-language
name: Ubiquitous Language
summary: A shared language used by all team members to communicate about the system.
description: A shared language used by all team members to communicate about the system.
---
<!-- Do not delete this file, required for EC, you an ignore this file -->
23 changes: 23 additions & 0 deletions eventcatalog/src/components/SideBars/DomainSideBar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import OwnersList from '@components/Lists/OwnersList';
import PillListFlat from '@components/Lists/PillListFlat';
import RepositoryList from '@components/Lists/RepositoryList.astro';
import VersionList from '@components/Lists/VersionList.astro';
import { getUbiquitousLanguage } from '@utils/collections/domains';
import { buildUrl } from '@utils/url-builder';
import { getEntry, type CollectionEntry } from 'astro:content';
import { ScrollText, Workflow } from 'lucide-react';
Expand All @@ -14,6 +15,9 @@ const { domain } = Astro.props;
// @ts-ignore
const services = (domain.data.services as CollectionEntry<'services'>[]) || [];
const ubiquitousLanguage = await getUbiquitousLanguage(domain);
const hasUbiquitousLanguage = ubiquitousLanguage.length > 0;
const ubiquitousLanguageDictionary = hasUbiquitousLanguage ? ubiquitousLanguage[0].data.dictionary : [];
const ownersRaw = domain.data?.owners || [];
const owners = await Promise.all(ownersRaw.map((o) => getEntry(o)));
Expand All @@ -26,6 +30,13 @@ const serviceList = services.map((p) => ({
href: buildUrl(`/docs/${p.collection}/${p.data.id}/${p.data.version}`),
}));
const ubiquitousLanguageList = ubiquitousLanguageDictionary?.map((l) => ({
label: l.name,
badge: 'Ubiquitous Language',
collection: 'ubiquitousLanguages',
href: buildUrl(`/docs/${domain.collection}/${domain.data.id}/language?id=${l.id}`),
}));
const ownersList = owners.map((o) => ({
label: o.data.name,
type: o.collection,
Expand All @@ -45,6 +56,17 @@ const ownersList = owners.map((o) => ({
icon="ServerIcon"
client:load
/>
{
ubiquitousLanguageList && hasUbiquitousLanguage && (
<PillListFlat
title={`Ubiquitous Language Dictionary (${ubiquitousLanguageDictionary?.length})`}
pills={ubiquitousLanguageList}
color="pink"
emptyMessage={`This domain does not have any documented ubiquitous language.`}
client:load
/>
)
}
{domain.data.versions && <VersionList versions={domain.data.versions} collectionItem={domain} />}
{
domain.data.repository && (
Expand All @@ -57,6 +79,7 @@ const ownersList = owners.map((o) => ({
emptyMessage={`This domain does not have any documented owners.`}
client:load
/>

<div class="space-y-2">
<a
href={buildUrl(`/visualiser/${domain.collection}/${domain.data.id}/${domain.data.version}`)}
Expand Down
18 changes: 18 additions & 0 deletions eventcatalog/src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,23 @@ const domains = defineCollection({
.merge(baseSchema),
});

const ubiquitousLanguages = defineCollection({
type: 'content',
schema: z.object({
dictionary: z
.array(
z.object({
id: z.string(),
name: z.string(),
summary: z.string().optional(),
description: z.string().optional(),
icon: z.string().optional(),
})
)
.optional(),
}),
});

const users = defineCollection({
type: 'content',
schema: z.object({
Expand Down Expand Up @@ -270,4 +287,5 @@ export const collections = {
flows,
pages,
changelogs,
ubiquitousLanguages,
};
Loading

0 comments on commit ccd3a5a

Please sign in to comment.