Skip to content

Commit 6af236d

Browse files
committed
use patch call w values not value
1 parent 1c0827d commit 6af236d

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

dist/index.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -335,19 +335,17 @@ async function getFeatureFlag(apiKey, projectKey, flagKey) {
335335
async function setCustomProperty(apiKey, projectKey, flagKey, propertyName, propertyValue) {
336336
const url = `https://app.launchdarkly.com/api/v2/flags/${projectKey}/${flagKey}`;
337337

338-
// Prepare the patch operation with semantic instructions
339-
// Using LaunchDarkly's patch format with instructions inside
338+
// Prepare the JSON patch operation to set the custom property
339+
// Using standard JSON patch format with correct "values" field
340340
const patchData = {
341341
patch: [
342342
{
343-
instructions: [
344-
{
345-
kind: 'addCustomProperties',
346-
key: propertyName,
347-
name: propertyName,
348-
values: [propertyValue]
349-
}
350-
]
343+
op: 'add',
344+
path: `/customProperties/${propertyName}`,
345+
value: {
346+
name: propertyName,
347+
values: [propertyValue] // Note: "values" not "value"
348+
}
351349
}
352350
]
353351
};

index.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -329,19 +329,17 @@ async function getFeatureFlag(apiKey, projectKey, flagKey) {
329329
async function setCustomProperty(apiKey, projectKey, flagKey, propertyName, propertyValue) {
330330
const url = `https://app.launchdarkly.com/api/v2/flags/${projectKey}/${flagKey}`;
331331

332-
// Prepare the patch operation with semantic instructions
333-
// Using LaunchDarkly's patch format with instructions inside
332+
// Prepare the JSON patch operation to set the custom property
333+
// Using standard JSON patch format with correct "values" field
334334
const patchData = {
335335
patch: [
336336
{
337-
instructions: [
338-
{
339-
kind: 'addCustomProperties',
340-
key: propertyName,
341-
name: propertyName,
342-
values: [propertyValue]
343-
}
344-
]
337+
op: 'add',
338+
path: `/customProperties/${propertyName}`,
339+
value: {
340+
name: propertyName,
341+
values: [propertyValue] // Note: "values" not "value"
342+
}
345343
}
346344
]
347345
};

0 commit comments

Comments
 (0)