Skip to content

Comments

fix(cli): iss2150 pattern interface defs error#2152

Open
jimthompson5802 wants to merge 12 commits intofinos:mainfrom
jimthompson5802:fix-iss2150-pattern-interface-defs-error
Open

fix(cli): iss2150 pattern interface defs error#2152
jimthompson5802 wants to merge 12 commits intofinos:mainfrom
jimthompson5802:fix-iss2150-pattern-interface-defs-error

Conversation

@jimthompson5802
Copy link
Contributor

Description

Fix #2150

Reworked JSON-schema snippets for pattern node/interface/relationship definitions — replaced references to obsolete interface defs (e.g., url-interface, container-image-interface, port-interface) with a current schema 1.2 interface types. and moved interface-specific fields into explicit properties (examples: added typed fields like api-port, postgres-port, mysql-port as integers). Also normalized object formatting and expanded required arrays for readability/consistency.

Updated other parts of the prompt to be consistent with the new interface definitions used in the pattern example.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Code style/formatting changes
  • ♻️ Refactoring (no functional changes)
  • ⚡ Performance improvements
  • ✅ Test additions or updates
  • 🔧 Chore (maintenance, dependencies, CI, etc.)

Affected Components

  • CLI (cli/)
  • Shared (shared/)
  • CALM Widgets (calm-widgets/)
  • CALM Hub (calm-hub/)
  • CALM Hub UI (calm-hub-ui/)
  • Documentation (docs/)
  • VS Code Extension (calm-plugins/vscode/)
  • Dependencies
  • CI/CD

Commit Message Format ✅

Examples:

  • feat(cli): add new validation command
  • fix(shared): resolve schema parsing issue
  • docs: update installation guide
  • chore(deps): bump typescript to 5.8.3

This helps with our automated versioning and changelog generation!
Note: Only commits with (cli) scope will trigger CLI releases.
-->

Testing

  • I have tested my changes locally
  • I have added/updated unit tests
  • All existing tests pass

Checklist

  • My commits follow the conventional commit format
  • I have updated documentation if necessary
  • I have added tests for my changes (if applicable)
  • My changes follow the project's coding standards

@jimthompson5802
Copy link
Contributor Author

@markscott-ms pattern-creation.md prompt has been updated to use interface-type specification.

After making the change, I noticed one more issue. The conference sign-up example does not fully support use of oneOf or anyOf for the relationships:

"relationships": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"prefixItems": [
{
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/relationship",
"type": "object",
"properties": {
"unique-id": { "const": "frontend-to-api" },
"description": { "type": "string" },
"protocol": { "const": "HTTPS" },
"relationship-type": {
"const": {
"connects": {
"source": { "node": "frontend" },
"destination": { "node": "api-service" }
}
}
}
},
"required": ["description"]
},
{
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/relationship",
"type": "object",
"properties": {
"unique-id": { "const": "api-to-database" },
"description": { "type": "string" },
"protocol": { "const": "JDBC" },
"relationship-type": {
"const": {
"connects": {
"source": { "node": "api-service" },
"destination": { "node": "postgres-db" }
}
}
}
},
"required": ["description"]
},
{
"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/relationship",
"properties": {
"unique-id": { "const": "deployed-in-k8s" },
"description": { "type": "string" },
"relationship-type": {
"const": {
"deployed-in": {
"container": "k8s-cluster",
"nodes": ["api-service", "postgres-db"]
}
}
}
},
"required": ["description"]
}
]
},
.

The issues I see:

  • hard coded relationship from the application to the postgres database instead of a conditional relationship based on the database selection.
  • hard coded deployed-in relationshp to the postgres database.
  • Missing the options relationship that would prompt the user for the specific database during calm generate.

I'll make the changes to the example to address the above.

@jimthompson5802
Copy link
Contributor Author

jimthompson5802 commented Feb 21, 2026

@markscott-ms I completed refactoring the full example in pattern-creation.md to account for use of oneOf or anyOf with database selection and refactored connects and deployed-in relationships to take into account the database selection. These are no longer hard-coded relationships. I believe this should have updated to current 1.2 schema.

This PR is ready for review.

here is a description of the pattern

Pattern: Conference Signup System

This CALM pattern defines a complete 3-tier conference registration system architecture deployed on Kubernetes, with the option to choose between PostgreSQL or MySQL database.

Architecture Overview

A full-stack conference signup application with:

  • Web frontend
  • Registration API service
  • Database (user's choice)
  • Kubernetes cluster for deployment

Structure

Nodes (4 total):

  1. frontend (Fixed)

    • Type: webclient
    • Web Frontend for conference registration
    • Has frontend-url interface (user configures URL)
    • Description is user-fillable
  2. api-service (Fixed)

    • Type: service
    • Registration API backend
    • Has api-image interface with configurable API port
    • Description is user-fillable
  3. Database Choice (oneOf)

    • postgres-registration-database: PostgreSQL database with configurable port
    • mysql-registration-database: MySQL database with configurable port
    • User selects ONE during generation
  4. k8s-cluster (Fixed)

    • Type: system
    • Kubernetes cluster that houses all services
    • Fixed description

Relationships (4 total):**

  1. database-choice (Decision Point)

    • Prompt: "Which database technology should be used?"
    • Two decisions:
      • "Use PostgreSQL" → adds postgres node + 2 relationships (api-to-postgres + deployed-in-k8s-postgres)
      • "Use MySQL" → adds mysql node + 2 relationships (api-to-mysql + deployed-in-k8s-mysql)
  2. frontend-to-api (Fixed)

    • Type: connects (HTTPS)
    • Frontend connects to API service
  3. API-to-Database Connection (oneOf)

    • api-service-to-postgres-database: JDBC connection to PostgreSQL
    • api-service-to-mysql-database: JDBC connection to MySQL
  4. Kubernetes Deployment (oneOf)

    • deployed-in-k8s-postgres: Deploys API + PostgreSQL in K8s cluster
    • deployed-in-k8s-mysql: Deploys API + MySQL in K8s cluster

Metadata

Required Kubernetes metadata:

  • namespace: Set to "conference" (fixed)

@jimthompson5802 jimthompson5802 marked this pull request as ready for review February 21, 2026 22:16
@jimthompson5802 jimthompson5802 requested a review from a team as a code owner February 21, 2026 22:16
@jimthompson5802
Copy link
Contributor Author

@markscott-ms I've addressed all comments.

@markscott-ms
Copy link
Contributor

@jimthompson5802 whilst you've changed the services to require 2 interfaces in the interfaces array, only the port interface is defined. The image interface is missing:

#2152 (comment)

@jimthompson5802
Copy link
Contributor Author

@markscott-ms hopefully, this is now correct. I have to admit, I have to get a better mental model of how the schema works.

For the API

"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/node",
"type": "object",
"properties": {
    "unique-id": {"const": "api-service"},
    "name": {"const": "Registration API"},
    "node-type": {"const": "service"},
    "description": {"type": "string"},
    "interfaces": {
        "type": "array",
        "minItems": 2,
        "maxItems": 2,
        "prefixItems": [
            {
                "$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/interface-type",
                "properties": {
                    "unique-id": {"const": "api-image"},
                    "image": {"type": "string"}
                },
                "required": ["image"]
            },
            {
                "$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/interface-type",
                "properties": {
                    "unique-id": {"const": "api-port"},
                    "port": { "type": "integer" }
                },
                "required": ["port"]
            }
        ]
    }
},
"required": [
    "description"
]

For Postgres Choice

"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/node",
"type": "object",
"properties": {
    "unique-id": {"const": "postgres-registration-database"},
    "name": {"const": "PostgreSQL Database"},
    "node-type": {"const": "database"},
    "description": {"const": "conference registration database using PostgreSQL"},
    "interfaces": {
        "type": "array",
        "minItems": 2,
        "maxItems": 2,
        "prefixItems": [
            {
                "$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/interface-type",
                "properties": {
                    "unique-id": {"const": "postgres-image"},
                    "image": {"type": "string"}
                },
                "required": ["image"]
            },
            {
                "$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/interface-type",
                "properties": {
                    "unique-id": {"const": "postgres-port"},
                    "port": { "type": "integer" }
                },
                "required": ["port"]
            }
        ]
    }
}

MySQL Choice

"$ref": "https://calm.finos.org/release/1.2/meta/core.json#/defs/node",
"type": "object",
"properties": {
    "unique-id": {"const": "mysql-registration-database"},
    "name": {"const": "MySQL Database"},
    "node-type": {"const": "database"},
    "description": {"const": "conference registration database using MySQL"},
    "interfaces": {
        "type": "array",
        "minItems": 2,
        "maxItems": 2,
        "prefixItems": [
            {
                "$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/interface-type",
                "properties": {
                    "unique-id": {"const": "mysql-image"},
                    "image": {"type": "string"}
                },
                "required": ["image"]
            },
            {
                "$ref": "https://calm.finos.org/release/1.2/meta/interface.json#/defs/interface-type",
                "properties": {
                    "unique-id": {"const": "mysql-port"},
                    "port": { "type": "integer" }
                },
                "required": ["port"]
            }
        ]
    }
}

@jimthompson5802
Copy link
Contributor Author

I generated an architecture from the revised pattern. this is the generated architecture for the api-service and postgres-registration-database. Does this look reasonable?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calm validate errors on a sample pattern file created by copilot AI Assistant

2 participants