Skip to content

Commit

Permalink
fix(ext/controller/flipt): correct schema for recent validation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeMac committed Aug 14, 2023
1 parent 0d75510 commit f7d8d31
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/hack/config/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}
}
},
"additionalProperties": false
"additionalProperties": true
}
}
}
Expand Down
42 changes: 40 additions & 2 deletions build/hack/config/segments.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,47 @@
"v1alpha1": {
"type": "object",
"properties": {
"enabled": { "type": "boolean" }
"spec": {
"type": "object",
"properties": {
"enabled": {"type": "boolean"},
"match_type": { "enum": ["", "ANY_MATCH_TYPE", "ALL_MATCH_TYPE"]},
"description": {"type": "string"},
"constraints": {
"type": ["array", "null"],
"items": {
"type": "object",
"properties": {
"type": {
"enum": ["", "STRING_COMPARISON_TYPE","NUMBER_COMPARISON_TYPE","BOOLEAN_COMPARISON_TYPE","DATETIME_COMPARISON_TYPE"]
},
"property": {"type": "string"},
"operator": {"enum": [
"",
"eq",
"neq",
"empty",
"notempty",
"prefix",
"suffix",
"present",
"notpresent",
"le",
"lte",
"gt",
"gte",
"true",
"false"
]},
"value": {"type": "string"},
"description": {"type": "string"}
}
}
}
}
}
},
"additionalProperties": false
"additionalProperties": true
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ext/controllers/flipt.io/v1alpha1/cmd/flipt/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (f *Flag) MarshalJSON() (_ []byte, err error) {
flag.Key = "" // key will be carried by the resource name
flag.Name = "" // key will be carried by the resource name

resource.Spec, err = json.Marshal(&f.flag)
resource.Spec, err = json.Marshal(&flag)
if err != nil {
return nil, fmt.Errorf("marshalling flag: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion ext/controllers/flipt.io/v1alpha1/cmd/flipt/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (s *Segment) MarshalJSON() (_ []byte, err error) {
segment.Key = "" // key will be carried by the resource name
segment.Name = "" // key will be carried by the resource name

resource.Spec, err = json.Marshal(&s.segment)
resource.Spec, err = json.Marshal(&segment)
if err != nil {
return nil, fmt.Errorf("marshalling segment: %w", err)
}
Expand Down

0 comments on commit f7d8d31

Please sign in to comment.