Conversation
|
| } | ||
|
|
||
| // Handle conditions - create default if empty | ||
| conditions := config.Conditions |
There was a problem hiding this comment.
based on the last structure, the conditions are under targeting element
[
{
"name": "SomeConfig1",
"variants": [
{
"name": "v1",
"definition": {
"prop1": true,
"prop2": 123
}
},
{
"name": "v2",
"definition": {
"prop1": false,
"prop2": 456
}
}
],
"targeting": {
"conditions": [
{
"variant": "v1",
"label": "main condition",
"matchers": [
{
"type": "IS_EQUAL_TO",
"data": {
"type": "NUMBER",
"number": 42
},
"attribute": "age"
},
{
"type": "WHITELIST",
"data": {
"strings": [
"a",
"b",
"c"
]
},
"attribute": "favoriteCharacter"
}
]
}
]
}
}
]
| package dtos | ||
|
|
||
| // ConvertConfigToSplit converts a ConfigDTO to a SplitDTO | ||
| func ConvertConfigToSplit(config ConfigDTO) SplitDTO { |
There was a problem hiding this comment.
you need to extract variants element as well, see comment below
| import "encoding/json" | ||
|
|
||
| // ConfigDTO represents a configuration definition fetched from the /configs endpoint | ||
| type ConfigDTO struct { |
There was a problem hiding this comment.
same here, missing variants and targeting elements




GO SPLIT COMMONS
What did you accomplish?
How do we test the changes introduced in this PR?
Extra Notes