You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "lburgazzoli (via GitHub)" <gi...@apache.org> on 2023/03/03 08:28:11 UTC
[GitHub] [camel-k] lburgazzoli commented on issue #3981: Unable to use `properties:` of `type: object`
lburgazzoli commented on issue #3981:
URL: https://github.com/apache/camel-k/issues/3981#issuecomment-1453155056
I had a brief look at how things works as today and so far what I found is that essentially we lack a way to handle properties of type object.
As today camel-k translates each kamelet property in a java property like:
```
kamelt.kamelet.${kameelt-id}.${id}.${property} = ${value}
```
So @tarilabs workaround works because if you define a property as a string, then it fall into a known path. However if a property is an object, that would fail.
A possible solution would be to:
- serialize objects as json + base64
- leverage camel's type converters for de-serialize the json to something meaningful
So a property would then look like:
```properties
kamelt.kamelet.mmk.${id}.ktable = {{base64:eyAidHlwZSI6ICJEZWNpc2lvblRhYmxlIiB9}}
```
Is up to the kamelet developer to provide a a type converter, something like:
```java
@Converter(generateLoader = true)
public class IOConverter {
@Converter
public static DecisionTable toDecisionTable(Exchange exchange, String raw) {
return new ObjectMapper().readValue(), DecisionTable.class);
}
}
```
At some point we may be able to offer some automatic conversion but as first step we can delegate some of the conversion logic to the kamelet developer.
@squakez @tarilabs what do you think ?
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org