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
While implementing caching integration tests I needed to make changes to the flagd JSON configuration file at runtime. As such, I parsed the existing configuration file, made changes to the structure and wrote it back to the file. This results in the error "set state: invalid JSON file".
This is due to the targeting property not being valid if set to null. Marshalling the eval.Flags struct sets any empty Targeting fields to null. The solution is to add omitempty to the json tags of this field.
Expected Behavior
Marshalling eval.Flags to JSON is valid for use as configuration.
Steps to reproduce
No response
The text was updated successfully, but these errors were encountered:
## This PR
<!-- add the description of the PR here -->
Added omitempty to the json tags of the `targeting` field in the `Flag`
structure.
### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->
Fixes#246
### Notes
<!-- any additional notes for this PR -->
### Follow-up Tasks
<!-- anything that is related to this PR but not done here should be
noted under this section -->
<!-- if there is a need for a new issue, please link it here -->
### How to test
<!-- if applicable, add testing instructions under this section -->
Signed-off-by: Skye Gill <gill.skye95@gmail.com>
Observed behavior
While implementing caching integration tests I needed to make changes to the flagd JSON configuration file at runtime. As such, I parsed the existing configuration file, made changes to the structure and wrote it back to the file. This results in the error
"set state: invalid JSON file"
.This is due to the
targeting
property not being valid if set to null. Marshalling theeval.Flags
struct sets any emptyTargeting
fields to null. The solution is to addomitempty
to the json tags of this field.Expected Behavior
Marshalling
eval.Flags
to JSON is valid for use as configuration.Steps to reproduce
No response
The text was updated successfully, but these errors were encountered: