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
Copy file name to clipboardExpand all lines: docs/architecture-decisions/flag_configuration_parsing.md
+37-12Lines changed: 37 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,14 +34,14 @@ To address these issues, it is essential to establish a consistent and testable
34
34
35
35
## Considered Options
36
36
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).
38
38
- Continue with the current approach but document the inconsistencies (Option 2).
39
39
- 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)).
41
41
42
42
## Proposal
43
43
44
-
### Standardize Flag Parsing and Handling Using Schema Validation (Option 1)
44
+
### Option 1: Standardize Flag Parsing and Handling Using Schema Validation
45
45
46
46
This proposal recommends adopting schema validation as the primary method for parsing and handling flags. The key elements of this approach include:
47
47
@@ -98,34 +98,59 @@ flowchart TD
98
98
99
99
```
100
100
101
-
[Double click to switch code/render]
102
-
103
101
### API Changes
104
102
105
103
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.
106
104
107
105
### Consequences
108
106
109
107
-**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)
114
112
-**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.
117
141
118
142
### Timeline
119
143
120
144
### Open Questions
121
145
122
146
- Are there any edge cases that need to be addressed in the schema validation rules?
123
147
- Should and error in the global metadata cause and issue with the parsing?
148
+
- What solution do we prefer?
124
149
125
150
## More Information
126
151
127
152
For additional context, refer to the following issues:
128
153
129
154
-[BUG] Inconsistency in file provider and JSON parsing for different languages (#1627)
130
155
-[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