Commit 81fff8f
authored
feat: Add API trigger, AsyncAPI field, and orphan detection validation (#1506)
* feat: Add API trigger, AsyncAPI field, and orphan detection validation
Implement three validation enhancements for the manifest validator:
Task 2 - API trigger validation against OpenAPI spec: validates path
format, checks existence against the generated swagger spec, enforces
uniqueness across sagas, and provides "Did you mean?" suggestions.
Task 5 - AsyncAPI CEL field validation: cross-checks event filter CEL
expression field references against AsyncAPI payload schemas, producing
warnings (not errors) for unknown fields since specs may lag behind.
Task 11 - Operational gateway orphan detection: warns on provider
connections not referenced by any instruction route or webhook trigger,
and on instruction routes not dispatched by any saga script.
Uses functional options (WithOpenAPIPaths, WithAsyncAPISchemas) for
testability and graceful degradation when spec files are unavailable.
* fix: Update example manifests to use valid API trigger paths
The new API trigger validation correctly rejects fictional paths like
/v1/carbon/retire and /v1/energy/settlements. Update example manifests
to use /v1/sagas/execute which exists in the generated OpenAPI spec.
* fix: Address review feedback on validation enhancements
- Keep API path format and duplicate checks active when OpenAPI spec is
unavailable; only skip the endpoint existence check
- Merge AsyncAPI fields across messages for the same channel instead of
overwriting
- Reuse extractWebhookSource helper in validateWebhookTriggers to
eliminate duplicated logic
- Extract resolveMessageFields to reduce parseAsyncAPIFile complexity
- Document regex-based Starlark scanning limitation for orphan detection
- Add tests for format/duplicate checks without spec and multi-message
field merging
* fix: Handle bracket-notation CEL field refs and document auto-loading
- Extract field names from bracket notation (event["field"]) in CEL AST
by detecting the _[_] index operator on the event variable
- Document auto-loading design rationale for OpenAPI/AsyncAPI specs
- Add regression tests for bracket and mixed dot/bracket CEL expressions
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>1 parent 4216bde commit 81fff8f
4 files changed
Lines changed: 1261 additions & 28 deletions
File tree
- examples/manifests
- services/control-plane/internal/validator
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
0 commit comments