You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/03/08 08:33:11 UTC

[GitHub] [camel-k-runtime] nicolaferraro commented on issue #631: Optional parameters in Kamelet route templates

nicolaferraro commented on issue #631:
URL: https://github.com/apache/camel-k-runtime/issues/631#issuecomment-792576379


   > I wonder if we need something like this with route template DSL
   > 
   > ```
   >                 routeTemplate("myTemplate").templateParameter("foo").templateOptionalParameter("maxKeep")
   >                         .from("direct:{{foo}}")
   >                         .to("mock:result?retainFirst={{maxKeep}}");
   > ```
   > 
   > As then you make it standout in the parameter definitions in the top which are required, and which are optional.
   > 
   > Then in the route DSL you just use {{key}} where its in use. Then you dont need to remember to use ? for optional. However this requires camel-core to transform the DSL by automatic replacing `{{maxKeep}}` to `{{?maxKeep}}` as it was declared as optional. And for this I need to add a new hook into the properties component
   
   I think there's in place a mechanism by which all required parameters are checked in the Kamelet runtime, so having parameters marked as optional could help implementing such check correctly. Otherwise the runtime will still reject an instance if we don't provide a value for a param.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org