flipt-io / flipt

Enterprise-ready, GitOps enabled, CloudNative feature management solution

Home Page:https://flipt.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Evaluation console does not allow non-string context values e.g. boolean or integer

epahl-atlassian opened this issue · comments

Bug Description

This may be intended, but e.g. this console will not allow:
{"property": true} or {"property": 10} and requires
{"property": "true"} or {"property": "10"}

Version Info

v1.39.0

Search

  • I searched for other open and closed issues before opening this

Steps to Reproduce

Go to evaluation console and put in context similar to that from the description.

Expected Behavior

Booleans and numbers would be accepted by the evaluation console.

Additional Context

No response

Hi @epahl-atlassian. Evaluation console doesn't allow this because of API schema

message EvaluationRequest {
string request_id = 1;
string namespace_key = 2;
string flag_key = 3;
string entity_id = 4;
map<string, string> context = 5;
string reference = 6;
}

All good. In that case I would potentially suggest some sort of banner or warning for the user as a nicety.

I just saw this issue and I'd like to contribute, maybe it'll not lead to change of the actual behavior but for cases like this where we can receive a non know format my suggestion is to use Struct type!

Go package reference: https://pkg.go.dev/google.golang.org/protobuf@v1.33.0/types/known/structpb

I am fine with the behaviour staying as is if that is preferred, but it was unexpected as a user.

I just saw this issue and I'd like to contribute, maybe it'll not lead to change of the actual behavior but for cases like this where we can receive a non know format my suggestion is to use Struct type!

Go package reference: https://pkg.go.dev/google.golang.org/protobuf@v1.33.0/types/known/structpb

In hindsight, the protobuf struct would've been a great shout here. However, I think changing it now will be hard in terms of backwards compatibility. Unless we go for a deprecate and pick a new field name for the context.

A warning, in the UI, which explains why you're not allowed to evaluate would be good.
Something to explain the situation, so you know you have to quote the field values.
Ideally long term we could support the broader range of types for the context values here.