router
router copied to clipboard
Configuration migrations don't support subgraph specific configuration
In https://github.com/apollographql/router/pull/3852, I need to update the following configuration:
traffic_shaping:
all:
experimental_enable_http2: false
subgraphs:
products:
experimental_enable_http2: true
to:
all:
experimental_http2: disable
subgraphs:
products:
experimental_http2: enable
For the traffic_shaping.all path, I can write the migration:
actions:
- type: change
path: traffic_shaping.all.experimental_enable_http2
from: true
to: enable
- type: change
path: traffic_shaping.all.experimental_enable_http2
from: false
to: disable
- type: move
from: traffic_shaping.all.experimental_enable_http2
to: traffic_shaping.all.experimental_http2
But for the products subgraph, where I would write a path like traffic_shaping.subgraphs..experimental_enable_http2, I cannot execute the move, because the target path should refer to the path that was matched.
I cannot find a way to do it in the migration code so far, because neither jsonpath-lib nor jsonpath-rust (why do we even have 2 dependencies for that?) can give the path that was matched, they only provide the value.
In the execution service, we have code that can actually select values from json and give the matched path, maybe I'll replace the current migrations with that
The two dependency thing is because jsonpath-lib is abandoned and buggy. jsonpath-rust is newer and works.
jsonpath-rust is used in config analytics.
It's be worth looking at https://github.com/mitghi/jetro to see if it can replace some of our code.