This is an automated email from the ASF dual-hosted git repository.
oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new 2f008f53f ci: reject duplicate x-descriptors in the Kamelet validator
(#2900)
2f008f53f is described below
commit 2f008f53f1fe73a65471f8538cc7cdf5c469f7c0
Author: Andrea Cosentino <[email protected]>
AuthorDate: Thu Jul 2 10:30:37 2026 +0200
ci: reject duplicate x-descriptors in the Kamelet validator (#2900)
Add a check to verifyDescriptors that flags a property listing the same
x-descriptor more than once. This catches the class of bug fixed in #2882,
where converting the deprecated tectonic descriptor to
urn:camel:group:credentials produced a duplicate on properties that already
carried it. Green on the current catalog; verified to fire on an injected
duplicate.
Signed-off-by: Andrea Cosentino <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
---
script/validator/validator.go | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/script/validator/validator.go b/script/validator/validator.go
index cff38b7aa..9cd35c6c3 100644
--- a/script/validator/validator.go
+++ b/script/validator/validator.go
@@ -121,6 +121,13 @@ func verifyDescriptors(kamelets []KameletInfo) (errors
[]error) {
if hasXDescriptorPrefix(p, deprecatedDescriptorPrefix) {
errors = append(errors, fmt.Errorf("property %q
in kamelet %q uses the deprecated x-descriptor prefix %q; use %q instead", k,
kamelet.Name, deprecatedDescriptorPrefix, credDescriptor))
}
+ seenDescriptors := make(map[string]bool)
+ for _, d := range p.XDescriptors {
+ if seenDescriptors[d] {
+ errors = append(errors,
fmt.Errorf("property %q in kamelet %q lists the x-descriptor %q more than
once", k, kamelet.Name, d))
+ }
+ seenDescriptors[d] = true
+ }
}
}
return errors