Add support for struct tag name overrides in native types
In order to customize how to fields of native types can be accessed via CEL, struct tag support has been added. It is now possible to provide a struct field tag, that will act as the name for the corresponding field.
Here an example
type Person struct {
Name string
Age int `cel:"age"`
}
and here is how to access the Age field from CEL:
person.age
Pull Requests Guidelines
See CONTRIBUTING.md for more details about when to create a GitHub Pull Request and when other kinds of contributions or consultation might be more desirable.
When creating a new pull request, please fork the repo and work within a development branch.
Commit Messages
- Most changes should be accompanied by tests.
- Commit messages should explain why the changes were made.
Summary of change in 50 characters or less
Background on why the change is being made with additional detail on
consequences of the changes elsewhere in the code or to the general
functionality of the library. Multiple paragraphs may be used, but
please keep lines to 72 characters or less.
Reviews
- Perform a self-review.
- Make sure the Travis CI build passes.
- Assign a reviewer once both the above have been completed.
Merging
- If a CEL maintaner approves the change, it may be merged by the author if they have write access. Otherwise, the change will be merged by a maintainer.
- Multiple commits should be squashed before merging.
- Please append the line
closes #<issue-num>: descriptionin the merge message, if applicable.
/gcbrun
Thanks @patrickpichler! This seems like a very nice win.
Wow I just discovered this PR after creating #942! My PR fixes an issue not fixed in yours but completely related to the same use-case
@TristonianJones I've updated the code, would be nice if you could have another look :)
/gcbrun
@patrickpichler thanks for the contribution!