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


##########
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:
   Nit, non-blocking: `VerbDefinition#apiDocs` (default `true`) also inherits. 
In `RestOpenApiReader`, a verb whose `apiDocs` is not set falls back to 
`rest.getApiDocs()` (lines 291-297 and 467-474). Take a verb with 
`apiDocs="true"` under a rest with `apiDocs="false"`: after a dump, its 
`apiDocs` is dropped and the verb is left out of the OpenAPI document. It only 
affects the docs, not routing, so it could be added here or as a follow-up: 
`"org.apache.camel.model.rest.VerbDefinition#apiDocs"`, then regenerate the 
writers.



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