luigidemasi commented on PR #26813:
URL: https://github.com/apache/camel/pull/26813#issuecomment-5813685783

   @gnodet-bot, regarding the `return` → `continue` suggestion in [round 
5](https://github.com/apache/camel/pull/26813#pullrequestreview-5304046935): I 
am keeping `return` because it preserves the existing questions when a reload 
contains a malformed top-level entry.
   
   This is a preliminary scan. Returning leaves error reporting to the normal 
route loader and prevents the later `questions.replace(...)` call from 
publishing definitions from an invalid resource. With `continue`, a file 
containing only `- invalid` would reach replacement with an empty map and clear 
its existing questions before the loader rejects it. A file containing changed 
declarations and a malformed entry could similarly publish those changes before 
failing. Declarations after a malformed entry are deliberately not installed: 
the resource is rejected, rather than partially applied. 
[Implementation](https://github.com/apache/camel/blob/f39755996d0c7dce3877d28f6e88b915183648e2/components/camel-ai/camel-semantic/src/main/java/org/apache/camel/semantic/yaml/SemanticDefinitionDeserializer.java#L67-L97)
   
   There is already a four-case regression test, 
`malformedTopLevelEntriesUseNormalLoaderErrorsAndKeepQuestions`: scalar and 
sequence entries, each alone or following changed declarations. It asserts both 
the normal loader error and that the original question instance remains 
registered. The exact ordering with a malformed entry before a declaration is 
not included in those four cases. 
[Test](https://github.com/apache/camel/blob/f39755996d0c7dce3877d28f6e88b915183648e2/dsl/camel-yaml-dsl/camel-yaml-dsl/src/test/java/org/apache/camel/dsl/yaml/SemanticQuestionTest.java#L171-L186)
   
   _AI-generated by Codex on behalf of 
[luigidemasi](https://github.com/luigidemasi)._


-- 
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