open-feature / spec

OpenFeature specification
https://openfeature.dev
Apache License 2.0
639 stars 34 forks source link

Typing of flag values #22

Closed dabeeeenster closed 2 years ago

dabeeeenster commented 2 years ago

Most providers also allow for flags to return some sort of value as well as a boolean.

How these values are typed can be problematic, as you have to be aware of the consistency of types and coercion across languages that are both strongly and weakly typed. How flag values are typed should be part of the spec, I feel.

There is a similar issue around user properties. Many providers allow for user properties/meta data to provide context to the flag engine. Again, how these values are typed needs to be considered.

toddbaert commented 2 years ago

I agree that flag value typing should be defined in the spec, and that we need to do our best to come up with a cross-language solution for this problem. Somewhat relevant to this discussion is the recently merged doc here: https://github.com/open-feature/spec/blob/main/research/api-comparision.md#types

It seems to me that many of the sampled vendors have type-specific methods/functions for some amount of type safety, and presumably to validate that the retrieved value is of the expected type. I believe @agentgonzo has some sensible opinions on this. I'll do some more research and respond here with some ideas.

beeme1mr commented 2 years ago

I'll close this issue now that we have a proposal in place. @dabeeeenster your feedback on @toddbaert's proposal would be very much appreciated.