Skip to content

Commit 397a42b

Browse files
fix: update interface defs in calm pattern prompt file
1 parent fd0493b commit 397a42b

File tree

2 files changed

+151
-76
lines changed

2 files changed

+151
-76
lines changed

calm-ai/tools/pattern-creation.md

Lines changed: 149 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -189,83 +189,105 @@ Patterns use JSON schema constructs to provide choices and options:
189189
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/node",
190190
"type": "object",
191191
"properties": {
192-
"unique-id": { "const": "frontend" },
193-
"name": { "const": "Web Frontend" },
194-
"node-type": { "const": "webclient" },
195-
"description": { "type": "string" },
192+
"unique-id": {
193+
"const": "frontend"
194+
},
195+
"name": {
196+
"const": "Web Frontend"
197+
},
198+
"node-type": {
199+
"const": "webclient"
200+
},
201+
"description": {
202+
"type": "string"
203+
},
196204
"interfaces": {
197205
"type": "array",
198206
"minItems": 1,
199207
"maxItems": 1,
200208
"prefixItems": [
201209
{
202-
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/url-interface",
210+
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/interface-type",
203211
"properties": {
204-
"unique-id": { "const": "frontend-url" }
212+
"unique-id": {
213+
"const": "frontend-url"
214+
}
205215
}
206216
}
207217
]
208218
}
209219
},
210-
"required": ["description"]
220+
"required": [
221+
"description"
222+
]
211223
},
212224
{
213225
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/node",
214226
"type": "object",
215227
"properties": {
216-
"unique-id": { "const": "api-service" },
217-
"name": { "const": "Registration API" },
218-
"node-type": { "const": "service" },
219-
"description": { "type": "string" },
228+
"unique-id": {
229+
"const": "api-service"
230+
},
231+
"name": {
232+
"const": "Registration API"
233+
},
234+
"node-type": {
235+
"const": "service"
236+
},
237+
"description": {
238+
"type": "string"
239+
},
220240
"interfaces": {
221241
"type": "array",
222242
"minItems": 2,
223243
"maxItems": 2,
224244
"prefixItems": [
225245
{
226-
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/container-image-interface",
227-
"properties": {
228-
"unique-id": { "const": "api-image" }
229-
}
230-
},
231-
{
232-
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/port-interface",
246+
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/interface-type",
233247
"properties": {
234-
"unique-id": { "const": "api-port" }
248+
"unique-id": {
249+
"const": "api-image"
250+
},
251+
"api-port": {
252+
"type": "integer"
253+
}
235254
}
236255
}
237256
]
238257
}
239258
},
240-
"required": ["description"]
259+
"required": [
260+
"description"
261+
]
241262
},
242263
{
243264
"anyOf": [
244265
{
245266
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/node",
246267
"type": "object",
247268
"properties": {
248-
"unique-id": { "const": "postgres-db" },
249-
"name": { "const": "PostgreSQL Database" },
250-
"node-type": { "const": "database" },
269+
"unique-id": {
270+
"const": "postgres-db"
271+
},
272+
"name": {
273+
"const": "PostgreSQL Database"
274+
},
275+
"node-type": {
276+
"const": "database"
277+
},
251278
"interfaces": {
252279
"type": "array",
253280
"minItems": 2,
254281
"maxItems": 2,
255282
"prefixItems": [
256283
{
257-
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/container-image-interface",
284+
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/interface-type",
258285
"properties": {
259286
"unique-id": {
260287
"const": "postgres-image"
261-
}
262-
}
263-
},
264-
{
265-
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/port-interface",
266-
"properties": {
267-
"unique-id": {
268-
"const": "postgres-port"
288+
},
289+
"postgres-port": {
290+
"type": "integer"
269291
}
270292
}
271293
}
@@ -277,27 +299,28 @@ Patterns use JSON schema constructs to provide choices and options:
277299
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/node",
278300
"type": "object",
279301
"properties": {
280-
"unique-id": { "const": "mysql-db" },
281-
"name": { "const": "MySQL Database" },
282-
"node-type": { "const": "database" },
302+
"unique-id": {
303+
"const": "mysql-db"
304+
},
305+
"name": {
306+
"const": "MySQL Database"
307+
},
308+
"node-type": {
309+
"const": "database"
310+
},
283311
"interfaces": {
284312
"type": "array",
285313
"minItems": 2,
286314
"maxItems": 2,
287315
"prefixItems": [
288316
{
289-
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/container-image-interface",
317+
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/interface-type",
290318
"properties": {
291319
"unique-id": {
292320
"const": "mysql-image"
293-
}
294-
}
295-
},
296-
{
297-
"$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/port-interface",
298-
"properties": {
299-
"unique-id": {
300-
"const": "mysql-port"
321+
},
322+
"mysql-port": {
323+
"type": "integer"
301324
}
302325
}
303326
}
@@ -311,12 +334,22 @@ Patterns use JSON schema constructs to provide choices and options:
311334
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/node",
312335
"type": "object",
313336
"properties": {
314-
"unique-id": { "const": "k8s-cluster" },
315-
"name": { "const": "Kubernetes Cluster" },
316-
"node-type": { "const": "system" },
317-
"description": { "type": "string" }
337+
"unique-id": {
338+
"const": "k8s-cluster"
339+
},
340+
"name": {
341+
"const": "Kubernetes Cluster"
342+
},
343+
"node-type": {
344+
"const": "system"
345+
},
346+
"description": {
347+
"type": "string"
348+
}
318349
},
319-
"required": ["description"]
350+
"required": [
351+
"description"
352+
]
320353
}
321354
]
322355
},
@@ -329,53 +362,86 @@ Patterns use JSON schema constructs to provide choices and options:
329362
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/relationship",
330363
"type": "object",
331364
"properties": {
332-
"unique-id": { "const": "frontend-to-api" },
333-
"description": { "type": "string" },
334-
"protocol": { "const": "HTTPS" },
365+
"unique-id": {
366+
"const": "frontend-to-api"
367+
},
368+
"description": {
369+
"type": "string"
370+
},
371+
"protocol": {
372+
"const": "HTTPS"
373+
},
335374
"relationship-type": {
336375
"const": {
337376
"connects": {
338-
"source": { "node": "frontend" },
339-
"destination": { "node": "api-service" }
377+
"source": {
378+
"node": "frontend"
379+
},
380+
"destination": {
381+
"node": "api-service"
382+
}
340383
}
341384
}
342385
}
343386
},
344-
"required": ["description"]
387+
"required": [
388+
"description"
389+
]
345390
},
346391
{
347392
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/relationship",
348393
"type": "object",
349394
"properties": {
350-
"unique-id": { "const": "api-to-database" },
351-
"description": { "type": "string" },
352-
"protocol": { "const": "JDBC" },
395+
"unique-id": {
396+
"const": "api-to-database"
397+
},
398+
"description": {
399+
"type": "string"
400+
},
401+
"protocol": {
402+
"const": "JDBC"
403+
},
353404
"relationship-type": {
354405
"const": {
355406
"connects": {
356-
"source": { "node": "api-service" },
357-
"destination": { "node": "postgres-db" }
407+
"source": {
408+
"node": "api-service"
409+
},
410+
"destination": {
411+
"node": "postgres-db"
412+
}
358413
}
359414
}
360415
}
361416
},
362-
"required": ["description"]
417+
"required": [
418+
"description"
419+
]
363420
},
364421
{
365422
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/relationship",
366423
"properties": {
367-
"unique-id": { "const": "deployed-in-k8s" },
368-
"description": { "type": "string" },
424+
"unique-id": {
425+
"const": "deployed-in-k8s"
426+
},
427+
"description": {
428+
"type": "string"
429+
},
369430
"relationship-type": {
370431
"const": {
371432
"deployed-in": {
372433
"container": "k8s-cluster",
373-
"nodes": ["api-service", "postgres-db"]
434+
"nodes": [
435+
"api-service",
436+
"postgres-db"
437+
]
374438
}
375439
}
376440
}
377441
},
378-
"required": ["description"]
442+
"required": [
443+
"description"
444+
]
379445
}
380446
]
381447
},
@@ -390,17 +456,27 @@ Patterns use JSON schema constructs to provide choices and options:
390456
"kubernetes": {
391457
"type": "object",
392458
"properties": {
393-
"namespace": { "const": "conference" }
459+
"namespace": {
460+
"const": "conference"
461+
}
394462
},
395-
"required": ["namespace"]
463+
"required": [
464+
"namespace"
465+
]
396466
}
397467
},
398-
"required": ["kubernetes"]
468+
"required": [
469+
"kubernetes"
470+
]
399471
}
400472
]
401473
}
402474
},
403-
"required": ["nodes", "relationships", "metadata"]
475+
"required": [
476+
"nodes",
477+
"relationships",
478+
"metadata"
479+
]
404480
}
405481
```
406482

@@ -446,7 +522,7 @@ Based on real CALM patterns, patterns should include:
446522

447523
### Complete Node Definitions
448524

449-
- **Interfaces**: Define specific interface types (url-interface, container-image-interface, port-interface, etc.)
525+
- **Interfaces**: Define specific interface types (interface-definition, interface-type, node-interface)
450526
- **Constraints**: Use `const` for structural identifiers, `anyOf` for choices
451527
- **Array constraints**: Use `minItems`, `maxItems`, and `prefixItems`
452528

@@ -509,10 +585,9 @@ Patterns can also constrain business flows (though not shown in the basic exampl
509585

510586
Always use specific interface schema references:
511587

512-
- `url-interface` for web endpoints
513-
- `container-image-interface` for Docker images
514-
- `port-interface` for network ports
515-
- `host-port-interface` for host/port combinations
588+
- `interface-definition` is a formal interface definition that references an external schema for standardization and validation.
589+
- `interface-type` is a simple, inline interface allowing any properties for quick documentation and basic connectivity.
590+
- `node-interface` used in relationships (specifically connects relationships) to reference specific interfaces on nodes.
516591

517592
### Relationship Types
518593

cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@finos/calm-cli",
3-
"version": "1.33.0",
3+
"version": "1.33.1-dev.0",
44
"description": "A set of tools for interacting with the Common Architecture Language Model (CALM)",
55
"homepage": "https://calm.finos.org",
66
"repository": {
@@ -71,4 +71,4 @@
7171
"typescript": "^5.8.3",
7272
"xml2js": "^0.6.2"
7373
}
74-
}
74+
}

0 commit comments

Comments
 (0)