Skip to content

Commit e79e0e7

Browse files
committed
fixup: update
Signed-off-by: Simon Schrottner <[email protected]>
1 parent 22d7648 commit e79e0e7

File tree

1 file changed

+37
-12
lines changed

1 file changed

+37
-12
lines changed

docs/architecture-decisions/flag_configuration_parsing.md

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ To address these issues, it is essential to establish a consistent and testable
3434

3535
## Considered Options
3636

37-
- Standardize flag parsing and handling using schema validation (Option 1).
37+
- Standardize flag parsing and handling using schema validation ([Option 1](#option-1-standardize-flag-parsing-and-handling-using-schema-validation).
3838
- Continue with the current approach but document the inconsistencies (Option 2).
3939
- Develop separate parsing logic for each implementation to address specific needs (Option 3).
40-
- Be rigid and enforce the JSON Schema Validation for all updates, even if that means ignoring updates if just one flag is violating the schema (Option 3).
40+
- Be rigid and enforce the JSON Schema Validation for all updates, even if that means ignoring updates if just one flag is violating the schema ([Option 4](#option-4-full-document-validation-on-sync)).
4141

4242
## Proposal
4343

44-
### Standardize Flag Parsing and Handling Using Schema Validation (Option 1)
44+
### Option 1: Standardize Flag Parsing and Handling Using Schema Validation
4545

4646
This proposal recommends adopting schema validation as the primary method for parsing and handling flags. The key elements of this approach include:
4747

@@ -98,34 +98,59 @@ flowchart TD
9898
9999
```
100100

101-
[Double click to switch code/render]
102-
103101
### API Changes
104102

105103
No immediate API changes are proposed. However, the internal logic for flag parsing and handling will be standardized, which may indirectly impact APIs that rely on these processes.
106104

107105
### Consequences
108106

109107
- **Positive Consequences**:
110-
- Improved consistency across implementations.
111-
- Easier maintenance and debugging.
112-
- Enhanced testability and reliability.
113-
- Robustness of Configuration issues (one invalid flag can not stop and update of others)
108+
- Improved consistency across implementations.
109+
- Easier maintenance and debugging.
110+
- Enhanced testability and reliability.
111+
- Robustness of Configuration issues (one invalid flag can not stop and update of others)
114112
- **Negative Consequences**:
115-
- Initial development effort to implement the unified framework.
116-
- Potential learning curve for contributors to adapt to the new framework.
113+
- Initial development effort to implement the unified framework.
114+
- Potential learning curve for contributors to adapt to the new framework.
115+
116+
### Option 4: Full Document Validation on Sync
117+
118+
#### Summary
119+
This alternative proposal suggests validating the entire flags configuration document using the schema provided at [https://flagd.dev/schema/v0/flags.json](https://flagd.dev/schema/v0/flags.json). The validation would occur both at startup and during each sync update.
120+
121+
#### Key Elements
122+
1. **Validation at Startup**:
123+
- If any part of the configuration is invalid, the application fails to start.
124+
- This aligns with the current behavior, where failure to parse the flags configuration prevents startup.
125+
126+
2. **Validation on Sync Updates**:
127+
- If any part of the updated configuration is invalid, the update is ignored.
128+
- An error or warning message is logged prominently to alert the user.
129+
- This builds on the existing behavior, where unparseable configurations are rejected.
130+
131+
#### Consequences
132+
133+
- **Positive Consequences**:
134+
- Ease of Implementation: The validation step can be added to the existing parsing logic with minimal changes.
135+
- Simplified Testing: Many error-edge cases in the test suite can be removed, as invalid configurations will never be allowed.
136+
- Schema-Driven Validation: Relying on the schema eliminates the need for detailed error-handling logic.
137+
138+
- **Negative Consequences**:
139+
- Blocking Updates Due to Errors: A single invalid flag will prevent the entire update from being applied.
140+
- However, this is consistent with the current behavior, where unparseable flags already block updates.
117141

118142
### Timeline
119143

120144
### Open Questions
121145

122146
- Are there any edge cases that need to be addressed in the schema validation rules?
123147
- Should and error in the global metadata cause and issue with the parsing?
148+
- What solution do we prefer?
124149

125150
## More Information
126151

127152
For additional context, refer to the following issues:
128153

129154
- [BUG] Inconsistency in file provider and JSON parsing for different languages (#1627)
130155
- [BUG] [File Provider] Support File Formats (#1689)
131-
- [FEATURE] Provider option to reject flag set with invalid rules (#1487)
156+
- [FEATURE] Provider option to reject flag set with invalid rules (#1487)

0 commit comments

Comments
 (0)