Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(OFREP): return unsupported types field #1846

Merged
merged 4 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions cmd/relayproxy/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,9 @@ const docTemplate = `{
"properties": {
"cacheInvalidation": {
"$ref": "#/definitions/model.OFREPConfigCapabilitiesCacheInvalidation"
},
"flagEvaluation": {
"$ref": "#/definitions/model.OFREPConfigCapabilitiesFlagEvaluation"
}
}
},
Expand All @@ -757,6 +760,17 @@ const docTemplate = `{
}
}
},
"model.OFREPConfigCapabilitiesFlagEvaluation": {
"type": "object",
"properties": {
"unsupportedTypes": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"model.OFREPConfiguration": {
"type": "object",
"properties": {
Expand Down
14 changes: 14 additions & 0 deletions cmd/relayproxy/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,9 @@
"properties": {
"cacheInvalidation": {
"$ref": "#/definitions/model.OFREPConfigCapabilitiesCacheInvalidation"
},
"flagEvaluation": {
"$ref": "#/definitions/model.OFREPConfigCapabilitiesFlagEvaluation"
}
}
},
Expand All @@ -749,6 +752,17 @@
}
}
},
"model.OFREPConfigCapabilitiesFlagEvaluation": {
"type": "object",
"properties": {
"unsupportedTypes": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"model.OFREPConfiguration": {
"type": "object",
"properties": {
Expand Down
9 changes: 9 additions & 0 deletions cmd/relayproxy/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ definitions:
properties:
cacheInvalidation:
$ref: '#/definitions/model.OFREPConfigCapabilitiesCacheInvalidation'
flagEvaluation:
$ref: '#/definitions/model.OFREPConfigCapabilitiesFlagEvaluation'
type: object
model.OFREPConfigCapabilitiesCacheInvalidation:
properties:
Expand All @@ -203,6 +205,13 @@ definitions:
minPollingInterval:
type: integer
type: object
model.OFREPConfigCapabilitiesFlagEvaluation:
properties:
unsupportedTypes:
items:
type: string
type: array
type: object
model.OFREPConfiguration:
properties:
capabilities:
Expand Down
4 changes: 4 additions & 0 deletions cmd/relayproxy/model/ofrep_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ type OFREPConfiguration struct {

type OFREPConfigCapabilities struct {
CacheInvalidation OFREPConfigCapabilitiesCacheInvalidation `json:"cacheInvalidation,omitempty"`
FlagEvaluation OFREPConfigCapabilitiesFlagEvaluation `json:"flagEvaluation,omitempty"`
}

type OFREPConfigCapabilitiesCacheInvalidation struct {
Polling OFREPConfigCapabilitiesCacheInvalidationPolling `json:"polling,omitempty"`
}
type OFREPConfigCapabilitiesFlagEvaluation struct {
UnsupportedTypes []string `json:"unsupportedTypes"`
}

type OFREPConfigCapabilitiesCacheInvalidationPolling struct {
Enabled bool `json:"enabled,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions cmd/relayproxy/ofrep/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (h *EvaluateCtrl) Configuration(c echo.Context) error {
MinPollingInterval: h.goFF.GetPollingInterval(),
},
},
FlagEvaluation: model.OFREPConfigCapabilitiesFlagEvaluation{UnsupportedTypes: []string{}},
},
}
return c.JSON(http.StatusOK, response)
Expand Down
4 changes: 2 additions & 2 deletions cmd/relayproxy/ofrep/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ func Test_Configuration(t *testing.T) {
goffPolling: 10 * time.Second,
want: want{
httpCode: http.StatusOK,
response: "{\"name\":\"GO Feature Flag\",\"capabilities\":{\"cacheInvalidation\":{\"polling\":{\"enabled\":true,\"minPollingInterval\":10000}}}}",
response: "{\"name\":\"GO Feature Flag\",\"capabilities\":{\"cacheInvalidation\":{\"polling\":{\"enabled\":true,\"minPollingInterval\":10000}},\"flagEvaluation\":{\"unsupportedTypes\":[]}}}",
},
},
{
name: "configuration 10 minute",
goffPolling: 10 * time.Minute,
want: want{
httpCode: http.StatusOK,
response: "{\"name\":\"GO Feature Flag\",\"capabilities\":{\"cacheInvalidation\":{\"polling\":{\"enabled\":true,\"minPollingInterval\":600000}}}}",
response: "{\"name\":\"GO Feature Flag\",\"capabilities\":{\"cacheInvalidation\":{\"polling\":{\"enabled\":true,\"minPollingInterval\":600000}},\"flagEvaluation\":{\"unsupportedTypes\":[]}}}",
},
},
}
Expand Down
Loading