feat: add strict validation option to reject invalid flag configs#1939
feat: add strict validation option to reject invalid flag configs#1939buildingisfun23 wants to merge 2 commits intoopen-feature:mainfrom
Conversation
✅ Deploy Preview for polite-licorice-3db33c ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Code Review
This pull request introduces a strict schema validation option for the JSON evaluator. It adds a WithStrictValidation option that, when enabled, causes flag configurations failing schema validation to return an error instead of just logging a warning. The changes include updates to the JSON struct, the validation logic, and comprehensive unit tests to verify the new behavior and ensure backward compatibility. Feedback suggests using the %w verb for error wrapping in the new error return path to follow Go best practices.
2791d98 to
5fe79e8
Compare
|
@buildingisfun23 - I'm not opposed - I wonder if we should connect this directly to a flagd startup arg as well? WDYT? |
|
Good call @toddbaert! I've added |
…en-feature#1487) Add WithStrictValidation() option for the JSON evaluator that causes flag configurations failing schema validation to be rejected with an error instead of accepted with a warning. When enabled, the flag store retains its previous state on validation failure. This is an opt-in option to avoid breaking existing behavior. Signed-off-by: buildingisfun23 <buildingisfun23@users.noreply.github.com>
Wire the existing WithStrictValidation() evaluator option through to a new --strict-validation CLI flag (and FLAGD_STRICT_VALIDATION env var) so operators can enable strict schema validation at startup without needing to configure it programmatically. Signed-off-by: buildingisfun23 <buildingisfun23@users.noreply.github.com>
a5d2bb6 to
3bf7ff7
Compare
|



Summary
WithStrictValidation()option to the JSON evaluatorFixes #1487