feat(calm-server): calm server validation against a custom pattern#2565
Draft
aayush-razdan wants to merge 2 commits into
Draft
feat(calm-server): calm server validation against a custom pattern#2565aayush-razdan wants to merge 2 commits into
aayush-razdan wants to merge 2 commits into
Conversation
|
|
d57f3c1 to
61f4b3b
Compare
61f4b3b to
95e2542
Compare
Contributor
There was a problem hiding this comment.
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-patternroute 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); |
|
|
||
| ### Validate Architecture against a Pattern | ||
|
|
||
| Validate a CALM architecture document against a pattern: |
rocketstack-matt
requested changes
Jun 5, 2026
rocketstack-matt
left a comment
Member
There was a problem hiding this comment.
Please address copilot comments
Member
|
@aayush-razdan are you able to take a look at the Copilot feedback? |
Author
Yes, working on this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Affected Components
cli/)calm/)calm-ai/)calm-hub/)calm-hub-ui/)calm-server/)calm-widgets/)docs/)shared/)calm-plugins/vscode/)Commit Message Format ✅
Testing
Checklist