Skip to content

Backend: Implement Context values for Segments #5674

@khvn26

Description

@khvn26

Blocked on Flagsmith/flagsmith-engine#219.

DoD

As an API user,
When performing

  • POST /api/v1/projects/{project_pk}/segments/
  • PUT /api/v1/projects/{project_pk}/segments/{id}/
  • PATCH /api/v1/projects/{project_pk}/segments/{id}/

When providing a value under $.rules[].conditions[].property which is an invalid JSONPath within the evaluation context object, it is assumed to be a trait. This can be simplified to any property that doesn't start with $..

As an API user,
When performing

  • POST /api/v1/projects/{project_pk}/segments/
  • PUT /api/v1/projects/{project_pk}/segments/{id}/
  • PATCH /api/v1/projects/{project_pk}/segments/{id}/

I'm able to provide the following values under $.rules[].conditions[].property:

  • $.identity.identifier
  • $.identity.traits.{any trait name}
  • $.environment.name.

Then,

As an API user,
When performing

  • GET /api/v1/flags/
  • GET /api/v1/identities/

I can observe the Core API correctly fill the condition values for these properties when presenting the context for the engine, and evaluate flags using the expected segments.

Metadata

Metadata

Assignees

Labels

apiIssue related to the REST API

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions