Skip to content
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

[BUG] Marshalling eval.Flags struct to JSON triggers "invalid JSON file" error #246

Closed
skyerus opened this issue Jan 5, 2023 · 0 comments · Fixed by #247
Closed

[BUG] Marshalling eval.Flags struct to JSON triggers "invalid JSON file" error #246

skyerus opened this issue Jan 5, 2023 · 0 comments · Fixed by #247
Assignees
Labels
bug Something isn't working

Comments

@skyerus
Copy link
Contributor

skyerus commented Jan 5, 2023

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 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

@skyerus skyerus added the bug Something isn't working label Jan 5, 2023
@skyerus skyerus self-assigned this Jan 5, 2023
beeme1mr pushed a commit that referenced this issue Jan 5, 2023
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant