Skip to content

Commit 5b6c0a7

Browse files
Merge pull request #1478 from LeighFinegold/1471
New model that allows for native dererencing + canonical model for calm template --template/template-dir options
2 parents 1ac7457 + e8f09d1 commit 5b6c0a7

File tree

86 files changed

+3716
-2303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+3716
-2303
lines changed

calm-hub-ui/src/model/calm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CalmAdrMeta } from "@finos/calm-shared/src/model/adr.js";
1+
import { CalmAdrMeta } from "shared/src/view-model/adr.js";
22

33
export type Namespace = string;
44
export type PatternID = string;

calm-hub-ui/src/service/adr-service/adr-service.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios, { AxiosInstance } from 'axios';
22
import { getToken } from '../../authService.js';
3-
import { CalmAdrMeta } from '@finos/calm-shared/src/model/adr.js';
3+
import { CalmAdrMeta } from 'shared/src/view-model/adr.js';
44

55
export class AdrService {
66
private readonly ax: AxiosInstance;

calm/release/1.0-rc2/meta/core.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"type": "string"
3535
},
3636
"description": "External links to ADRs (Architecture Decision Records) or similar documents that provide context or decisions related to the architecture. These can be URLs or references to internal documentation."
37-
}
37+
},
38+
"additionalProperties": false
3839
},
3940
"defs": {
4041
"node": {

cli/src/cli.e2e.spec.ts

Lines changed: 30 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,14 @@ describe('CLI Integration Tests', () => {
321321
test('template command works with --template mode', async () => {
322322
const fixtureDir = path.resolve(__dirname, '../test_fixtures/template');
323323
const testModelPath = path.join(fixtureDir, 'model/document-system.json');
324-
const localDirectory = path.join(fixtureDir, 'model/url-to-file-directory.json');
325324
const templatePath = path.join(fixtureDir, 'self-provided/single-template.hbs');
326325
const expectedOutputPath = path.join(fixtureDir, 'expected-output/single-template-output.md');
327326
const outputDir = path.join(tempDir, 'output-single-template');
328327
const outputFile = path.join(outputDir, 'simple-template-output.md');
329328

330329
await run(
331330
calm(
332-
`template --input ${testModelPath} --template ${templatePath} --output ${outputFile} --url-to-local-file-mapping ${localDirectory}`
331+
`template --input ${testModelPath} --template ${templatePath} --output ${outputFile}`
333332
)
334333
);
335334

@@ -342,14 +341,13 @@ describe('CLI Integration Tests', () => {
342341
test('template command works with --template-dir mode', async () => {
343342
const fixtureDir = path.resolve(__dirname, '../test_fixtures/template');
344343
const testModelPath = path.join(fixtureDir, 'model/document-system.json');
345-
const localDirectory = path.join(fixtureDir, 'model/url-to-file-directory.json');
346344
const templateDirPath = path.join(fixtureDir, 'self-provided/template-dir');
347345
const expectedOutputDir = path.join(fixtureDir, 'expected-output/template-dir');
348346
const actualOutputDir = path.join(tempDir, 'output-template-dir');
349347

350348
await run(
351349
calm(
352-
`template --input ${testModelPath} --template-dir ${templateDirPath} --output ${actualOutputDir} --url-to-local-file-mapping ${localDirectory}`
350+
`template --input ${testModelPath} --template-dir ${templateDirPath} --output ${actualOutputDir}`
353351
)
354352
);
355353

@@ -472,84 +470,51 @@ describe('CLI Integration Tests', () => {
472470
await expectDirectoryMatch(expectedOutputDocifyWebsite, outputWebsite);
473471

474472
//STEP 3: Add flow to architecture-document
475-
const flowsDir = path.resolve(tempDir, 'flows');
476-
const flowFile = path.resolve(flowsDir, 'conference-signup.flow.json');
477473
const flowUrl = 'https://calm.finos.org/getting-started/flows/conference-signup.flow.json';
478-
fs.mkdirSync(flowsDir, { recursive: true });
479-
480-
/* eslint-disable quotes */
481-
writeJson(flowFile, {
482-
$schema: 'https://calm.finos.org/release/1.0-rc2/meta/flow.json',
483-
$id: flowUrl,
484-
'unique-id': 'flow-conference-signup',
485-
name: 'Conference Signup Flow',
486-
description:
487-
'Flow for registering a user through the conference website and storing their details in the attendee database.',
488-
transitions: [
489-
{
490-
'relationship-unique-id':
491-
'conference-website-load-balancer',
492-
'sequence-number': 1,
493-
description:
494-
'User submits sign-up form via Conference Website to Load Balancer',
495-
},
496-
{
497-
'relationship-unique-id': 'load-balancer-attendees',
498-
'sequence-number': 2,
499-
description:
500-
'Load Balancer forwards request to Attendees Service',
501-
},
502-
{
503-
'relationship-unique-id': 'attendees-attendees-store',
504-
'sequence-number': 3,
505-
description:
506-
'Attendees Service stores attendee info in the Attendees Store',
507-
},
508-
],
509-
});
510474

511-
await expectFilesMatch(
512-
path.resolve(
513-
GETTING_STARTED_TEST_FIXTURES_DIR,
514-
'STEP-3/flows/conference-signup.flow.json'
515-
),
516-
flowFile
517-
);
518-
519-
const directory = path.resolve(tempDir, 'directory.json');
520-
writeJson(directory, {
521-
'https://calm.finos.org/getting-started/flows/conference-signup.flow.json':
522-
'flows/conference-signup-with-flow.arch.json',
523-
}); //since the flow document is not published
524475

525476
patchJson(outputArchitecture, (arch) => {
526-
arch['flows'] = arch['flows'] || [];
527-
if (!arch['flows'].includes(flowUrl)) arch['flows'].push(flowUrl);
477+
arch['flows'] = [
478+
{
479+
$schema: 'https://calm.finos.org/release/1.0-rc2/meta/flow.json',
480+
$id: flowUrl,
481+
'unique-id': 'flow-conference-signup',
482+
name: 'Conference Signup Flow',
483+
description: 'Flow for registering a user through the conference website and storing their details in the attendee database.',
484+
transitions: [
485+
{
486+
'relationship-unique-id': 'conference-website-load-balancer',
487+
'sequence-number': 1,
488+
description: 'User submits sign-up form via Conference Website to Load Balancer',
489+
},
490+
{
491+
'relationship-unique-id': 'load-balancer-attendees',
492+
'sequence-number': 2,
493+
description: 'Load Balancer forwards request to Attendees Service',
494+
},
495+
{
496+
'relationship-unique-id': 'attendees-attendees-store',
497+
'sequence-number': 3,
498+
description: 'Attendees Service stores attendee info in the Attendees Store',
499+
},
500+
],
501+
},
502+
];
528503
});
504+
529505
await expectFilesMatch(
530506
path.resolve(GETTING_STARTED_TEST_FIXTURES_DIR, 'STEP-3/conference-signup-with-flow.arch.json'),
531507
outputArchitecture
532508
);
533509

534-
// Patch directory.json to map the URL → local path
535-
patchJson(directory, (dir) => {
536-
dir[flowUrl] = 'flows/conference-signup.flow.json';
537-
});
538-
await expectFilesMatch(
539-
path.resolve(
540-
GETTING_STARTED_TEST_FIXTURES_DIR,
541-
'STEP-3/directory.json'
542-
),
543-
directory
544-
);
545510

546511
const outputWebsiteWithFlow = path.resolve(
547512
tempDir,
548513
'website-with-flow'
549514
);
550515
await run(
551516
calm(
552-
`docify --input ${outputArchitecture} --output ${outputWebsiteWithFlow} --url-to-local-file-mapping ${directory}`
517+
`docify --input ${outputArchitecture} --output ${outputWebsiteWithFlow}`
553518
)
554519
);
555520

cli/test_fixtures/getting-started/STEP-3/conference-signup-with-flow.arch.json

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,29 @@
178178
],
179179
"$schema": "https://calm.finos.org/getting-started/conference-signup.pattern.json",
180180
"flows": [
181-
"https://calm.finos.org/getting-started/flows/conference-signup.flow.json"
181+
{
182+
"$schema": "https://calm.finos.org/release/1.0-rc2/meta/flow.json",
183+
"$id": "https://calm.finos.org/getting-started/flows/conference-signup.flow.json",
184+
"unique-id": "flow-conference-signup",
185+
"name": "Conference Signup Flow",
186+
"description": "Flow for registering a user through the conference website and storing their details in the attendee database.",
187+
"transitions": [
188+
{
189+
"relationship-unique-id": "conference-website-load-balancer",
190+
"sequence-number": 1,
191+
"description": "User submits sign-up form via Conference Website to Load Balancer"
192+
},
193+
{
194+
"relationship-unique-id": "load-balancer-attendees",
195+
"sequence-number": 2,
196+
"description": "Load Balancer forwards request to Attendees Service"
197+
},
198+
{
199+
"relationship-unique-id": "attendees-attendees-store",
200+
"sequence-number": 3,
201+
"description": "Attendees Service stores attendee info in the Attendees Store"
202+
}
203+
]
204+
}
182205
]
183206
}

cli/test_fixtures/getting-started/STEP-3/directory.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

cli/test_fixtures/getting-started/STEP-3/flows/conference-signup.flow.json

Lines changed: 0 additions & 24 deletions
This file was deleted.

cli/test_fixtures/template/model/document-system.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,24 @@
7373
}
7474
],
7575
"flows": [
76-
"https://calm.finos.org/docuflow/flow/document-upload"
76+
{
77+
"$schema": "https://calm.finos.org/draft/2024-12/meta/flow.json",
78+
"$id": "https://calm.finos.org/docuflow/flow/document-upload",
79+
"unique-id": "flow-document-upload",
80+
"name": "Document Upload Flow",
81+
"description": "Flow for uploading a document and storing metadata securely in the DocuFlow system.",
82+
"transitions": [
83+
{
84+
"relationship-unique-id": "rel-upload-to-storage",
85+
"sequence-number": 1,
86+
"summary": "Upload Service sends document to Storage Service"
87+
},
88+
{
89+
"relationship-unique-id": "rel-storage-to-db",
90+
"sequence-number": 2,
91+
"summary": "Storage Service stores document metadata in Document Database"
92+
}
93+
]
94+
}
7795
]
7896
}

cli/test_fixtures/template/model/flows/flow-document-upload.json

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{{#with nodes.[0]}}
2-
{{uniqueId}}
2+
{{unique-id}}
33
{{/with}}

0 commit comments

Comments
 (0)