Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
660eabd
updating golang generator to include object flag
bbland1 Jun 14, 2025
7334df8
updating success_go to include object & having determing order for ma…
bbland1 Jun 14, 2025
f65221f
fixing type of ObjectValue & Details to actually be any as in client.go
bbland1 Jun 14, 2025
93c7950
fixing spacing issue of template output
bbland1 Jun 14, 2025
c6ba375
fixing spacing issue of template return out
bbland1 Jun 14, 2025
2b2f1e2
running generate docs per lefthook
bbland1 Jun 14, 2025
e0e03f7
adding object flag to react gen, updating templ and golden for new flag
bbland1 Jun 14, 2025
a70d327
updating python generator, tmpl and golden to include object
bbland1 Jun 15, 2025
8ef35dd
added addtl func to handle nested values in object flags
bbland1 Jun 15, 2025
196ca19
updating nodejs generator and golden
bbland1 Jun 16, 2025
a9b2efe
fixed objectDetails for nodejs default to no be go map
bbland1 Jun 17, 2025
cb8e563
added object flag to nestjs go file and tmpl file
bbland1 Jun 17, 2025
6fedc97
fixed nestjs generator type and success golden
bbland1 Jun 17, 2025
4ddace3
updated go & python generators func name of helper
bbland1 Jun 17, 2025
3152146
added object maping func to java gen remove filtering of obecjt flag out
bbland1 Jun 17, 2025
0de1167
fixed map logic to acutally have map for default value object
bbland1 Jun 17, 2025
68ee802
renamed map helper func
bbland1 Jun 17, 2025
102c05c
updated java golden to include object
bbland1 Jun 17, 2025
560d34e
added object to csharp flag and dictionary helper func
bbland1 Jun 17, 2025
eef3460
added object parts to the tmpl
bbland1 Jun 17, 2025
1d40cd9
updated csharp golden to include object
bbland1 Jun 17, 2025
dfddf88
fixed integration error about not using new Value
bbland1 Jun 17, 2025
6591812
Revert "fixed integration error about not using new Value"
bbland1 Jun 17, 2025
9e89319
fixed spacing on go and python map func
bbland1 Jun 17, 2025
43157a9
fixed to useoOpenfeature model value & structure builder
bbland1 Jun 19, 2025
0e76385
fixed structure builder call
bbland1 Jun 19, 2025
6254b23
added object flag to integration files in test dir
bbland1 Jun 19, 2025
74ffe8e
removed new for structure.builder because believe it is static
bbland1 Jun 19, 2025
539b429
fixed details method for theme to properly use the details call not v…
bbland1 Jun 19, 2025
74c229e
fixed spacing of list builders in map conversion
bbland1 Jun 20, 2025
89739b8
updated nodejs, nestjs, react to use JsonValue instead of object
bbland1 Jun 20, 2025
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: 0 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ atomicgo.dev/keyboard v0.2.9 h1:tOsIid3nlPLZ3lwgG8KZMp/SFmr7P0ssEN5JUsm78K8=
atomicgo.dev/keyboard v0.2.9/go.mod h1:BC4w9g00XkxH/f1HXhW2sXmJFOCWbKn9xrOunSFtExQ=
atomicgo.dev/schedule v0.1.0 h1:nTthAbhZS5YZmgYbb2+DH8uQIZcTlIrd4eYr3UQxEjs=
atomicgo.dev/schedule v0.1.0/go.mod h1:xeUa3oAkiuHYh8bKiQBRojqAMq3PXXbJujjb0hw8pEU=
dagger.io/dagger v0.18.9 h1:IXZhlGm893LuqYFpo6VHtaCAEP6Qz0VjMhLvyKQVl1Y=
dagger.io/dagger v0.18.9/go.mod h1:e6Y+sAPWh04pHvBf4s3sSiOe1QMoCEcccmMv898RnZA=
dagger.io/dagger v0.18.10 h1:Ibyz5LqxjjEHfLMlaU9PJ3xt3ju7p29RWy0lVfvSNU0=
dagger.io/dagger v0.18.10/go.mod h1:VSj+2HMd/EnaCVt7gTY70p8LBW+oQDYjA1XTadr8vBE=
github.com/99designs/gqlgen v0.17.73 h1:A3Ki+rHWqKbAOlg5fxiZBnz6OjW3nwupDHEG15gEsrg=
github.com/99designs/gqlgen v0.17.73/go.mod h1:2RyGWjy2k7W9jxrs8MOQthXGkD3L3oGr0jXW3Pu8lGg=
github.com/99designs/gqlgen v0.17.74 h1:1FuVtkXxOc87xpKio3f6sohREmec+Jvy86PcYOuwgWo=
github.com/99designs/gqlgen v0.17.74/go.mod h1:a+iR6mfRLNRp++kDpooFHiPWYiWX3Yu1BIilQRHgh10=
github.com/Khan/genqlient v0.8.1 h1:wtOCc8N9rNynRLXN3k3CnfzheCUNKBcvXmVv5zt6WCs=
Expand Down Expand Up @@ -108,8 +104,6 @@ github.com/pterm/pterm v0.12.31/go.mod h1:32ZAWZVXD7ZfG0s8qqHXePte42kdz8ECtRyEej
github.com/pterm/pterm v0.12.33/go.mod h1:x+h2uL+n7CP/rel9+bImHD5lF3nM9vJj80k9ybiiTTE=
github.com/pterm/pterm v0.12.36/go.mod h1:NjiL09hFhT/vWjQHSj1athJpx6H8cjpHXNAK5bUw8T8=
github.com/pterm/pterm v0.12.40/go.mod h1:ffwPLwlbXxP+rxT0GsgDTzS3y3rmpAO1NMjUkGTYf8s=
github.com/pterm/pterm v0.12.80 h1:mM55B+GnKUnLMUSqhdINe4s6tOuVQIetQ3my8JGyAIg=
github.com/pterm/pterm v0.12.80/go.mod h1:c6DeF9bSnOSeFPZlfs4ZRAFcf5SCoTwvwQ5xaKGQlHo=
github.com/pterm/pterm v0.12.81 h1:ju+j5I2++FO1jBKMmscgh5h5DPFDFMB7epEjSoKehKA=
github.com/pterm/pterm v0.12.81/go.mod h1:TyuyrPjnxfwP+ccJdBTeWHtd/e0ybQHkOS/TakajZCw=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
Expand Down Expand Up @@ -210,15 +204,11 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -246,8 +236,6 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand All @@ -259,8 +247,6 @@ google.golang.org/genproto/googleapis/api v0.0.0-20250528174236-200df99c418a h1:
google.golang.org/genproto/googleapis/api v0.0.0-20250528174236-200df99c418a/go.mod h1:a77HrdMjoeKbnd2jmgcWdaS++ZLZAEq3orIOAEIKiVw=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a h1:v2PbRU4K3llS09c7zodFpNePeamkAwG3mPrAery9VeE=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8=
google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok=
google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
Expand Down
32 changes: 32 additions & 0 deletions internal/cmd/testdata/success_csharp.golden
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,38 @@ namespace TestNamespace
return await _client.GetStringDetailsAsync("greetingMessage", "Hello there!", evaluationContext, options);
}

/// <summary>
/// Allows customization of theme colors.
/// </summary>
/// <remarks>
/// <para>Flag key: themeCustomization</para>
/// <para>Default value: new Value(Structure.Builder().Set("primaryColor", "#007bff").Set("secondaryColor", "#6c757d").Build())</para>
/// <para>Type: object</para>
/// </remarks>
/// <param name="evaluationContext">Optional context for the flag evaluation</param>
/// <param name="options">Options for flag evaluation</param>
/// <returns>The flag value</returns>
public async Task<Value> ThemeCustomizationAsync(EvaluationContext? evaluationContext = null, FlagEvaluationOptions? options = null)
{
return await _client.GetObjectValueAsync("themeCustomization", new Value(Structure.Builder().Set("primaryColor", "#007bff").Set("secondaryColor", "#6c757d").Build()), evaluationContext, options);
}

/// <summary>
/// Allows customization of theme colors.
/// </summary>
/// <remarks>
/// <para>Flag key: themeCustomization</para>
/// <para>Default value: new Value(Structure.Builder().Set("primaryColor", "#007bff").Set("secondaryColor", "#6c757d").Build())</para>
/// <para>Type: object</para>
/// </remarks>
/// <param name="evaluationContext">Optional context for the flag evaluation</param>
/// <param name="options">Options for flag evaluation</param>
/// <returns>The evaluation details containing the flag value and metadata</returns>
public async Task<FlagEvaluationDetails<Value>> ThemeCustomizationDetailsAsync(EvaluationContext? evaluationContext = null, FlagEvaluationOptions? options = null)
{
return await _client.GetObjectDetailsAsync("themeCustomization", new Value(Structure.Builder().Set("primaryColor", "#007bff").Set("secondaryColor", "#6c757d").Build()), evaluationContext, options);
}

/// <summary>
/// Maximum allowed length for usernames.
/// </summary>
Expand Down
19 changes: 19 additions & 0 deletions internal/cmd/testdata/success_go.golden
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type IntProvider func(ctx context.Context, evalCtx openfeature.EvaluationContext
type IntProviderDetails func(ctx context.Context, evalCtx openfeature.EvaluationContext) (openfeature.IntEvaluationDetails, error)
type StringProvider func(ctx context.Context, evalCtx openfeature.EvaluationContext) (string, error)
type StringProviderDetails func(ctx context.Context, evalCtx openfeature.EvaluationContext) (openfeature.StringEvaluationDetails, error)
type ObjectProvider func(ctx context.Context, evalCtx openfeature.EvaluationContext) (any, error)
type ObjectProviderDetails func(ctx context.Context, evalCtx openfeature.EvaluationContext) (openfeature.InterfaceEvaluationDetails, error)

var client openfeature.IClient = nil
// Discount percentage applied to purchases.
Expand Down Expand Up @@ -67,6 +69,23 @@ var GreetingMessage = struct {
return client.StringValueDetails(ctx, "greetingMessage", "Hello there!", evalCtx)
},
}
// Allows customization of theme colors.
var ThemeCustomization = struct {
// Value returns the value of the flag ThemeCustomization,
// as well as the evaluation error, if present.
Value ObjectProvider

// ValueWithDetails returns the value of the flag ThemeCustomization,
// the evaluation error, if any, and the evaluation details.
ValueWithDetails ObjectProviderDetails
}{
Value: func(ctx context.Context, evalCtx openfeature.EvaluationContext) (any, error) {
return client.ObjectValue(ctx, "themeCustomization", map[string]any{"primaryColor": "#007bff", "secondaryColor": "#6c757d"}, evalCtx)
},
ValueWithDetails: func(ctx context.Context, evalCtx openfeature.EvaluationContext) (openfeature.InterfaceEvaluationDetails, error){
return client.ObjectValueDetails(ctx, "themeCustomization", map[string]any{"primaryColor": "#007bff", "secondaryColor": "#6c757d"}, evalCtx)
},
}
// Maximum allowed length for usernames.
var UsernameMaxLength = struct {
// Value returns the value of the flag UsernameMaxLength,
Expand Down
30 changes: 30 additions & 0 deletions internal/cmd/testdata/success_java.golden
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,27 @@ public final class OpenFeature {
* Returns the evaluation details containing the flag value and metadata
*/
FlagEvaluationDetails<String> greetingMessageDetails(EvaluationContext ctx);

/**
* Allows customization of theme colors.
* Details:
* - Flag key: themeCustomization
* - Type: Object
* - Default value: Map.of("primaryColor", "#007bff", "secondaryColor", "#6c757d")
* Returns the flag value
*/
Object themeCustomization(EvaluationContext ctx);

/**
* Allows customization of theme colors.
* Details:
* - Flag key: themeCustomization
* - Type: Object
* - Default value: Map.of("primaryColor", "#007bff", "secondaryColor", "#6c757d")
* Returns the evaluation details containing the flag value and metadata
*/
FlagEvaluationDetails<Object> themeCustomizationDetails(EvaluationContext ctx);

/**
* Maximum allowed length for usernames.
* Details:
Expand Down Expand Up @@ -131,7 +151,17 @@ public final class OpenFeature {
public FlagEvaluationDetails<String> greetingMessageDetails(EvaluationContext ctx) {
return client.getStringDetails("greetingMessage", "Hello there!", ctx);
}

@Override
public Object themeCustomization(EvaluationContext ctx) {
return client.getObjectValue("themeCustomization", Map.of("primaryColor", "#007bff", "secondaryColor", "#6c757d"), ctx);
}

@Override
public FlagEvaluationDetails<Object> themeCustomizationDetails(EvaluationContext ctx) {
return client.getObjectDetails("themeCustomization", Map.of("primaryColor", "#007bff", "secondaryColor", "#6c757d"), ctx);
}

@Override
public Integer usernameMaxLength(EvaluationContext ctx) {
return client.getIntegerValue("usernameMaxLength", 50, ctx);
Expand Down
32 changes: 29 additions & 3 deletions internal/cmd/testdata/success_nestjs.golden
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import type {
EvaluationContext,
EvaluationDetails,
OpenFeatureModuleOptions,
JsonValue
} from "@openfeature/nestjs-sdk";
import { OpenFeatureModule, BooleanFeatureFlag, StringFeatureFlag, NumberFeatureFlag } from "@openfeature/nestjs-sdk";
import { OpenFeatureModule, BooleanFeatureFlag, StringFeatureFlag, NumberFeatureFlag, ObjectFeatureFlag } from "@openfeature/nestjs-sdk";

import type { GeneratedClient } from "./openfeature";
import { getGeneratedClient } from "./openfeature";
Expand Down Expand Up @@ -133,7 +134,7 @@ export function DiscountPercentage(props?: TypedFeatureProps): ParameterDecorato
* @Get("/")
* public async handleRequest(
* @EnableFeatureA()
* enableFeatureA: Observable<EvaluationDetails<number>>,
* enableFeatureA: Observable<EvaluationDetails<boolean>>,
Comment thread
bbland1 marked this conversation as resolved.
* )
* ```
* @param {TypedFeatureProps} props The options for injecting the feature flag.
Expand All @@ -158,7 +159,7 @@ export function EnableFeatureA(props?: TypedFeatureProps): ParameterDecorator {
* @Get("/")
* public async handleRequest(
* @GreetingMessage()
* greetingMessage: Observable<EvaluationDetails<number>>,
* greetingMessage: Observable<EvaluationDetails<string>>,
* )
* ```
* @param {TypedFeatureProps} props The options for injecting the feature flag.
Expand All @@ -168,6 +169,31 @@ export function GreetingMessage(props?: TypedFeatureProps): ParameterDecorator {
return StringFeatureFlag({ flagKey: "greetingMessage", defaultValue: "Hello there!", ...props });
}

/**
* Gets the {@link EvaluationDetails} for `themeCustomization` from a domain scoped or the default OpenFeature
* client and populates the annotated parameter with the {@link EvaluationDetails} wrapped in an {@link Observable}.
*
* **Details:**
* - flag key: `themeCustomization`
* - description: `Allows customization of theme colors.`
* - default value: `{"primaryColor":"#007bff","secondaryColor":"#6c757d"}`
* - type: `JsonValue`
*
* Usage:
* ```typescript
* @Get("/")
* public async handleRequest(
* @ThemeCustomization()
* themeCustomization: Observable<EvaluationDetails<JsonValue>>,
* )
* ```
* @param {TypedFeatureProps} props The options for injecting the feature flag.
* @returns {ParameterDecorator} The decorator function.
*/
export function ThemeCustomization(props?: TypedFeatureProps): ParameterDecorator {
return ObjectFeatureFlag({ flagKey: "themeCustomization", defaultValue: {"primaryColor":"#007bff","secondaryColor":"#6c757d"}, ...props });
}

/**
* Gets the {@link EvaluationDetails} for `usernameMaxLength` from a domain scoped or the default OpenFeature
* client and populates the annotated parameter with the {@link EvaluationDetails} wrapped in an {@link Observable}.
Expand Down
39 changes: 39 additions & 0 deletions internal/cmd/testdata/success_nodejs.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
OpenFeature,
stringOrUndefined,
objectOrUndefined,
JsonValue,
} from "@openfeature/server-sdk";
import type {
EvaluationContext,
Expand Down Expand Up @@ -101,6 +102,36 @@ export interface GeneratedClient {
*/
greetingMessageDetails(context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<EvaluationDetails<string>>;

/**
* Allows customization of theme colors.
*
* **Details:**
* - flag key: `themeCustomization`
* - default value: `{"primaryColor":"#007bff","secondaryColor":"#6c757d"}`
* - type: `JsonValue`
*
* Performs a flag evaluation that returns a object.
* @param {EvaluationContext} context The evaluation context used on an individual flag evaluation
* @param {FlagEvaluationOptions} options Additional flag evaluation options
* @returns {Promise<JsonValue>} Flag evaluation response
*/
themeCustomization(context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<JsonValue>;

/**
* Allows customization of theme colors.
*
* **Details:**
* - flag key: `themeCustomization`
* - default value: `{"primaryColor":"#007bff","secondaryColor":"#6c757d"}`
* - type: `JsonValue`
*
* Performs a flag evaluation that a returns an evaluation details object.
* @param {EvaluationContext} context The evaluation context used on an individual flag evaluation
* @param {FlagEvaluationOptions} options Additional flag evaluation options
* @returns {Promise<EvaluationDetails<JsonValue>>} Flag evaluation details response
*/
themeCustomizationDetails(context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<EvaluationDetails<JsonValue>>;

/**
* Maximum allowed length for usernames.
*
Expand Down Expand Up @@ -185,6 +216,14 @@ export function getGeneratedClient(domainOrContext?: string | EvaluationContext,
return client.getStringDetails("greetingMessage", "Hello there!", context, options);
},

themeCustomization: (context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<JsonValue> => {
return client.getObjectValue("themeCustomization", {"primaryColor":"#007bff","secondaryColor":"#6c757d"}, context, options);
},

themeCustomizationDetails: (context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<EvaluationDetails<JsonValue>> => {
return client.getObjectDetails("themeCustomization", {"primaryColor":"#007bff","secondaryColor":"#6c757d"}, context, options);
},

usernameMaxLength: (context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<number> => {
return client.getNumberValue("usernameMaxLength", 50, context, options);
},
Expand Down
Loading