-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new MergeJsonKeys
functionality to transformation filter.
#350
Conversation
source/extensions/filters/http/transformation/inja_transformer.cc
Outdated
Show resolved
Hide resolved
source/extensions/filters/http/transformation/inja_transformer.cc
Outdated
Show resolved
Hide resolved
// prepare variables for non-advanced_templates_ scenario | ||
absl::string_view name_to_split; | ||
json* current = nullptr; | ||
// if (!advanced_templates_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't end up supporting json pointer templates, I think we should keep this check in and throw in the constructor at config time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to understand better what would be entailed, I honestly don't really know the different 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's largely just handling of /
and ~
spec: https://datatracker.ietf.org/doc/html/rfc6901
our fork to re-introduce support in inja: solo-io/inja#6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm now throwing an exception at config time
Co-authored-by: Jacob Bohanon <[email protected]>
api/envoy/config/filter/http/transformation/v2/transformation_filter.proto
Show resolved
Hide resolved
source/extensions/filters/http/transformation/inja_transformer.cc
Outdated
Show resolved
Hide resolved
test/extensions/filters/http/transformation/inja_transformer_test.cc
Outdated
Show resolved
Hide resolved
test/extensions/filters/http/transformation/inja_transformer_test.cc
Outdated
Show resolved
Hide resolved
…filter.proto Co-authored-by: Nathan Fudenberg <[email protected]>
source/extensions/filters/http/transformation/inja_transformer.cc
Outdated
Show resolved
Hide resolved
source/extensions/filters/http/transformation/inja_transformer.cc
Outdated
Show resolved
Hide resolved
source/extensions/filters/http/transformation/inja_transformer.cc
Outdated
Show resolved
Hide resolved
source/extensions/filters/http/transformation/inja_transformer.cc
Outdated
Show resolved
Hide resolved
source/extensions/filters/http/transformation/inja_transformer.cc
Outdated
Show resolved
Hide resolved
Issues linked to changelog: |
api/envoy/config/filter/http/transformation/v2/transformation_filter.proto
Outdated
Show resolved
Hide resolved
…filter.proto Co-authored-by: Nathan Fudenberg <[email protected]>
lgtm pending yuval check |
inja_template.set_text("\"{{header(\":path\")}}\""); | ||
envoy::api::v2::filter::http::MergeJsonKeys_OverridableTemplate tmpl; | ||
(*tmpl.mutable_tmpl()) = inja_template; | ||
(*transformation.mutable_merge_json_keys()->mutable_json_keys())["ext2"] = tmpl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add tests for the dot logic. include edge cases to make sure we don't crash. i.e.
- "foo.bar"
- "foo..bar"
- ".foo."
- "..."
- ".foo
- "bar."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline, I am going to remove this ability for now as it's not necessary. In order to ensure we can potentially add it back later I will throw an exception at config_time
if a "."
is present in the key
Add a new feature to the
inja_transformer
calledMergeJsonKeys
which allows merging of rendered templates into the JSON body without needing to rewrite the entire body