allthingssecurity commented on code in PR #28029:
URL: https://github.com/apache/camel/pull/28029#discussion_r4307675862


##########
tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ModelWriterGeneratorMojo.java:
##########
@@ -493,6 +494,33 @@ private Stream<Class<?>> fieldReferences(Class<?> clazz) {
     }
 
     public static class Property {
+
+        /**
+         * The model classes of which every option is written whenever it is 
set, even to its documented default value:
+         * an onException copies the error handler's redelivery policy and 
overrides only the options that are set, and
+         * a circuit breaker configuration is layered over the global one, so 
"not set" means "the value of the parent
+         * level", not "the default value", and a dump that leaves such an 
option out runs differently once loaded.
+         */
+        private static final Set<String> INHERITED_OPTION_CLASSES = Set.of(
+                "org.apache.camel.model.RedeliveryPolicyDefinition",
+                "org.apache.camel.model.Resilience4jConfigurationCommon",
+                "org.apache.camel.model.FaultToleranceConfigurationCommon");
+
+        /**
+         * The options (declaring class and attribute name) that are written 
whenever they are set, for the same reason:
+         * the rest binding options of a verb take the value of its rest, then 
of the rest configuration, which in turn
+         * falls back to the RestConfiguration of the CamelContext; the 
shutdown options of a route take the value of
+         * the CamelContext.
+         */
+        private static final Set<String> INHERITED_OPTIONS = Stream.concat(
+                Stream.of("RestDefinition", "VerbDefinition", 
"RestBindingDefinition", "RestConfigurationDefinition")
+                        .flatMap(c -> Stream.of("bindingMode", 
"skipBindingOnErrorCode", "clientRequestValidation",
+                                "clientResponseValidation", "enableCORS", 
"enableNoContentResponse")
+                                .map(o -> "org.apache.camel.model.rest." + c + 
"#" + o)),
+                
Stream.of("org.apache.camel.model.RouteDefinition#shutdownRoute",
+                        
"org.apache.camel.model.RouteDefinition#shutdownRunningTask"))

Review Comment:
   Thanks, you are right: a verb with `apiDocs="true"` under a rest with 
`apiDocs="false"` loses its value in the dump and drops out of the OpenAPI 
document. I will add `VerbDefinition#apiDocs` to `isInheritedOption` in the 
CAMEL-25752 follow-up, which has to regenerate the same writers after this one 
is merged anyway, with a dump test for that case. I am leaving this PR as you 
approved it.
   
   _Claude Code on behalf of allthingssecurity_



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