Skip to content

feat(calm-server): calm server validation against a custom pattern#2565

Draft
aayush-razdan wants to merge 2 commits into
finos:mainfrom
aayush-razdan:feature/issue-2099
Draft

feat(calm-server): calm server validation against a custom pattern#2565
aayush-razdan wants to merge 2 commits into
finos:mainfrom
aayush-razdan:feature/issue-2099

Conversation

@aayush-razdan

Copy link
Copy Markdown

Description

Addresses #2099 - "Currently the CALM Validation of pattern instances is done against patterns that already exist in the project directory. It should be possible to pass in a pattern instance and the pattern to the validation in order for it to be validated."

This is now available through the endpoint /calm/validate/with-pattern

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/)
  • Schema (calm/)
  • CALM AI (calm-ai/)
  • CALM Hub (calm-hub/)
  • CALM Hub UI (calm-hub-ui/)
  • CALM Server (calm-server/)
  • CALM Widgets (calm-widgets/)
  • Documentation (docs/)
  • Shared (shared/)
  • VS Code Extension (calm-plugins/vscode/)
  • Dependencies
  • CI/CD

Commit Message Format ✅

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

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 3, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: aayush-razdan / name: aayush-razdan (61f4b3b)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support in calm-server for validating an architecture instance against a runtime-supplied custom pattern, addressing #2099 by introducing a new /calm/validate/with-pattern endpoint alongside the existing validation flow.

Changes:

  • Added POST /calm/validate/with-pattern route to validate an architecture JSON against a pattern JSON provided in the request body.
  • Expanded unit test coverage for both the existing validation endpoint and the new with-pattern endpoint, including additional error-path tests.
  • Added documentation and test fixtures demonstrating the new endpoint’s request format.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
calm-server/test_fixtures/validation_route/valid_instantiation_with_pattern.json Adds a fixture request payload containing both architecture and pattern as JSON-encoded strings.
calm-server/src/server/routes/validation-route.ts Implements /with-pattern endpoint and adjusts error handling for validation failures.
calm-server/src/server/routes/validation-route.spec.ts Refactors test app setup and adds tests for the new endpoint and additional failure scenarios.
calm-server/README.md Documents the new validation endpoint usage with an example curl request.
calm-server/AGENTS.md Updates endpoint inventory and adds an example request for /with-pattern.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

) => {
let architecture;
try {
architecture = JSON.parse(req.body.architecture);

let pattern;
try {
pattern = JSON.parse(req.body.pattern);
return res.status(400).type('json').send(new ErrorResponse(`The "$schema" field (${schema}) in the architecture does not match the "$id" field (${patternId}) in the pattern`));
}

try {
}

try {
const outcome = await validate(architecture, pattern, undefined, this.schemaDirectory, true);
Comment thread calm-server/README.md

### Validate Architecture against a Pattern

Validate a CALM architecture document against a pattern:

@rocketstack-matt rocketstack-matt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address copilot comments

@rocketstack-matt

Copy link
Copy Markdown
Member

@aayush-razdan are you able to take a look at the Copilot feedback?

@aayush-razdan

Copy link
Copy Markdown
Author

@aayush-razdan are you able to take a look at the Copilot feedback?

Yes, working on this.

@rocketstack-matt rocketstack-matt marked this pull request as draft June 16, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants