Yaml/JSON pre-processing with Jackson #261
-
Hello, Just to give a little context first, I'm part of Part of the configuration surface is a Yaml/JSON The job spec is fetched from Google Cloud Storage. To alleviate this issue, the former implementation What this token map defines is a JSON dictionary For instance: {"project": "my-project", "schema": "my-schema"} A job spec author can then write something like version: '1'
config:
reset_db: false
sources:
- type: bigquery
name: a_bigquery_source
query: |-
SELECT some_field FROM `$project.$schema.some_table`
LIMIT 100
// [...] As a result, the job spec does not need to be The token map can also define values of JSON For instance, the job spec could define a mapping // [...]
targets:
nodes:
- name: some_node_target
active: $some_node_target_active
source: a_bigquery_source
write_mode: merge
labels: [ANodeLabel]
properties:
- source_field: some_field
target_property: some_property
// [...] And the corresponding runtime token map could Here, I'm not sure how I can pre-process the JSON Is there any Jackson component I can hook into? Our current Jackson integration looks like this, Happy new year and thanks a lot for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Is the TLDR here that you want to token substitute in the yaml? If so, I don't know of a pre-built Jackson solution. I would suggest using a String based substitutor. |
Beta Was this translation helpful? Give feedback.
-
Jackson functionality for transformations is limited (by design), so at most you can parser content (JSON, YAML, XML, Avro etc etc) into generic Tree Model ( There are probably libraries based on Jackson that support various transformations but I am not familiar with any. But if this is more about templating & String substitutions (which it sounds like), perhaps basic templating libraries work even better as per @pjfanning. |
Beta Was this translation helpful? Give feedback.
-
Oh. The possibility of post-processing Strings (which would probably allow working on something here (and its databind counter-part FasterXML/jackson-databind#2971) is a sort of long-term well-known wish. Ability to do modify Strings after low-level decoding would allow hooking in templating functionality, and make that conditional/configurable (to only apply to some sections). |
Beta Was this translation helpful? Give feedback.
Oh. The possibility of post-processing Strings (which would probably allow working on something here
FasterXML/jackson-core#355
(and its databind counter-part FasterXML/jackson-databind#2971)
is a sort of long-term well-known wish. Ability to do modify Strings after low-level decoding would allow hooking in templating functionality, and make that conditional/configurable (to only apply to some sections).
Unfortunately I haven't had time to tackle this, but it is something on my mental TODO list.