Skip to content

feat(sdk): add variant key to evaluation schemas#7704

Draft
gagantrivedi wants to merge 1 commit into
mainfrom
feat/evaluation-schema-variant
Draft

feat(sdk): add variant key to evaluation schemas#7704
gagantrivedi wants to merge 1 commit into
mainfrom
feat/evaluation-schema-variant

Conversation

@gagantrivedi
Copy link
Copy Markdown
Member

WIP / draft. Part of the multivariate variant key work (see #7698, #7699). This PR must merge before the flag-engine PR that regenerates types from these schemas.

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature. (deferred — SDK-facing docs land with the SDK slice.)
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to

Extends the canonical cross-SDK evaluation contract so engines can report which multivariate variant was selected:

Both fields are omitted when not applicable (no variant selected, or the selected variant has no key), consistent with the existing optional fields (metadata, variants, priority) in these schemas. Purely additive — existing consumers are unaffected.

Downstream consumers regenerated from these schemas: flag_engine/context/types.py and flag_engine/result/types.py in [flagsmith-engine] (PR to follow), then each SDK.

How did you test this code?

  • Both files validate as JSON.
  • Ran datamodel-code-generator (0.33.0, as used by flagsmith-engine) against the updated schemas to confirm the emitted types are the expected key: NotRequired[str] / variant: NotRequired[str].
  • The flag-engine companion PR implements + tests the behaviour end-to-end (378 tests passing, including the shared engine-test-data corpus untouched, proving backwards compatibility).

Add an optional `key` to FeatureValue in the evaluation context schema,
and an optional `variant` to FlagResult in the evaluation result schema,
so engines can report which multivariate variant was selected. The
`variant` name follows OpenFeature's ResolutionDetails.variant.

Both fields are omitted when not applicable, consistent with the
existing optional fields in these schemas.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Jun 4, 2026 8:53am
flagsmith-frontend-preview Ignored Ignored Jun 4, 2026 8:53am
flagsmith-frontend-staging Ignored Ignored Jun 4, 2026 8:53am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant