Closed tomaszmichalak closed 3 years ago
This is due to PlaceholdersResolver logic which looks for opening and ending brackets in a greedy way.
So { "key": "{config.value}" }
gets recognized as a whole field and is not matched, instead of - what would be best - to match only the not nested group {config.value}
.
Next time please provide some more details - it will be easier to debug :)
The issue seems to be a bit more complex - simple unit test for the case above passes.
What happens for the case above:
in: $categories
, \n html \n
, \n url\n label\n
, \n url\n label\n
, config.categories
in: $categories
, \n html \n
, \n url\n label\n
, \n url\n label\n
, ⚠️ "categories":["2"]
The mismatch is a nested result of a few factors:
The sequential substitution and the additional search are things we should eventually drop off. Otherwise, we might end up with substituting nested values, which would be indeterministic and not desired, e.g.: Query: {config.key}
-> Query: SET {payload.otherKey} TO NULL
-> Query: SET !unexpected! TO NULL
.
Also, the substitution of not resolved placeholders to empty string should be configurable. I think it would be best if we just replaced placeholders that match any of used source definitions, otherwise end up with the problems above.
Describe the bug HTTP Action fails when we try to interpolate the body (this is GraphQL query with variables)
To Reproduce Steps to reproduce the behaviour:
Expected behavior
{config.categories}
is replaced with2
when the fragment is configured such as<knotx:snippet categories="2" .../>