gnodet-bot commented on code in PR #26489:
URL: https://github.com/apache/camel/pull/26489#discussion_r4024018074


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidator.java:
##########
@@ -147,30 +150,51 @@ public static List<String> validateCamelYaml(String 
content, CamelCatalog catalo
         if (content == null || content.isBlank()) {
             return msgs;
         }
+        if (validateYamlSchema(content, catalog, schemaValidator, msgs)) {
+            msgs.addAll(validateYamlCatalog(content, catalog));
+        }
+        return msgs;
+    }
+
+    /**
+     * The schema half of {@link #validateCamelYaml(String, CamelCatalog)}: 
the YAML DSL schema of the catalog's Camel
+     * version, without the catalog checks. For a sample that is right for its 
version but uses what the catalog cannot
+     * know (a custom step, a header a component sets at runtime).
+     */
+    public static List<String> validateYamlSchema(String content, CamelCatalog 
catalog) {
+        List<String> msgs = new ArrayList<>();

Review Comment:
   💡 **Nit:** `validate()` enforces `requireNonNull(catalog, "catalog")` at 
line 104, but this new public sibling does not. `yamlValidator(catalog)` now 
calls `catalog.getCatalogVersion()` without a null guard, so a null here 
produces an NPE rather than falling back to the built-in validator (as the old 
code did).
   
   ```suggestion
           Objects.requireNonNull(catalog, "catalog");
           List<String> msgs = new ArrayList<>();
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to