Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions docs/api_docs/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,12 @@ definitions:
flagSnapshotID:
type: integer
format: int64
flagTags:
description: flagTags. flagTags looks up flags by tag. Either works.
type: array
x-omitempty: true
items:
type: string
segmentID:
type: integer
format: int64
Expand Down
1 change: 1 addition & 0 deletions integration_tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ networks:

services:
mysql:
platform: linux/x86_64
image: mysql:5.6
container_name: flagr-mysql
environment:
Expand Down
3 changes: 3 additions & 0 deletions integration_tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ step_11_test_tag_batch_evaluation() {
matches "\"flagID\":1"
matches "\"variantKey\":\"key_1\""
matches "\"variantID\":1"
contains "flagTags"

}

Expand All @@ -361,12 +362,14 @@ step_12_test_tag_operator_batch_evaluation() {
matches "\"flagID\":1"
matches "\"variantKey\":\"key_1\""
matches "\"variantID\":1"
contains "flagTags"

shakedown POST "$flagr_url"/evaluation/batch -H 'Content-Type:application/json' -d '{"entities":[{ "entityType": "externalalert", "entityContext": {"property_1": "value_2"} }],"flagTags": ["value_1", "value_3"], "flagTagsOperator": "ANY", "enableDebug": false }'
status 200
matches "\"flagID\":1"
matches "\"variantKey\":\"key_1\""
matches "\"variantID\":1"
contains "flagTags"

}

Expand Down
7 changes: 7 additions & 0 deletions pkg/handler/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,16 @@ func BlankResult(f *entity.Flag, evalContext models.EvalContext, msg string) *mo
flagID := uint(0)
flagKey := ""
flagSnapshotID := uint(0)
flagTags := []string{}
if f != nil {
flagID = f.ID
flagSnapshotID = f.SnapshotID
flagKey = f.Key
if len(f.Tags) > 0 {
for _, tag := range f.Tags {
flagTags = append(flagTags, tag.Value)
}
}
}
return &models.EvalResult{
EvalContext: &evalContext,
Expand All @@ -119,6 +125,7 @@ func BlankResult(f *entity.Flag, evalContext models.EvalContext, msg string) *mo
FlagID: int64(flagID),
FlagKey: flagKey,
FlagSnapshotID: int64(flagSnapshotID),
FlagTags: flagTags,
Timestamp: util.TimeNow(),
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/handler/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ func TestPostEvaluation(t *testing.T) {
EntityID: "entityID1",
EntityType: "entityType1",
FlagID: int64(100),
FlagTags: []string{"tag1", "tag2"},
},
})
assert.NotNil(t, resp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test kind of wrong, the intention I think it's to test if flagTags being included in the response, however, the test was just using tags as evaluation context input.

I think you could remove this line and assert that the tags were there in the resp

Copy link
Contributor Author

@su5kk su5kk Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi, thank you for the review

I've added correct assertions
473d3b1

Expand Down
6 changes: 6 additions & 0 deletions swagger/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,12 @@ definitions:
flagSnapshotID:
type: integer
format: int64
flagTags:
description: flagTags. flagTags looks up flags by tag. Either works.
type: array
x-omitempty: true
items:
type: string
segmentID:
type: integer
format: int64
Expand Down
3 changes: 3 additions & 0 deletions swagger_gen/models/eval_result.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions swagger_gen/restapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.