You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to execute this file I get the following error which originates from the yab tool:
➜ ./my-request.yaml
Failed to parse options: failed to read yaml template: yaml: line 13: did not find expected ',' or '}'
I cloned the yab repo locally and tried to debug a little bit.
The problem happens during templateargs.ProcessMap(t.Request, templateArgs) and specifically during the processing of the extraPaymentData string field. If I understand correctly since there are no templates in the string that I specified then the code should follow this conditional and be a noop:
if rendered == v {
// Avoid unmarshalling if the value did not change.
return v, nil
}
However it looks like the rendered string is missing some character escapes from the original string, for example \" and \/. Because of this the code doesn't take the Avoid unmarshalling if the value did not change path.
And then the error happens during the next step which is:
// Otherwise, unmarshal the value and return that.
var unmarshalled interface{}
err = yaml.Unmarshal([]byte(rendered), &unmarshalled)
The text was updated successfully, but these errors were encountered:
Thanks for the detailed bug report. This is caused by the parser for template args as you pointed out. The specific issue is that when an escaped literal is found, the parser drops the fact that it's escaped,
# Anything followed by a '\' is used as-is.
escaped_lit = '\\' any @{ l = literal(data[fpc:fpc+1]) };
@abhinav Do you remember why we don't keep the escape character as part of the literal? Should we instead have an escaped literal function that's used so it can be identified and appropriately escaped?
Hi,
I defined the following yaml template:
When I try to execute this file I get the following error which originates from the yab tool:
I cloned the yab repo locally and tried to debug a little bit.
The problem happens during
templateargs.ProcessMap(t.Request, templateArgs)
and specifically during the processing of theextraPaymentData
string field. If I understand correctly since there are no templates in the string that I specified then the code should follow this conditional and be a noop:However it looks like the
rendered
string is missing some character escapes from the original string, for example\"
and\/
. Because of this the code doesn't take theAvoid unmarshalling if the value did not change
path.And then the error happens during the next step which is:
The text was updated successfully, but these errors were encountered: