Skip to content

Can't send addValuesToClause operation via api-client #10

Description

@michaelk-redis

Hey,

I know this is auto generated client, but hopefully you would have a solution.

When i use the api-client-typescript package, and try to send a .patchFeatureFlag() with a payload example:

    "environmentKey": "environment-key-123abc",
    "instructions": [{
        "kind": "addValuesToClause",
        "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29",
        "clauseId": "10a58772-3121-400f-846b-b8a04e8944ed",
        "values": ["beta_testers"]
    }]
}

There are 2 problems:

  1. type PatchOperation only supports properties: op, path and value, so there is a TS compile error.
  2. Even after getting over the compile error, i've debugged and noticed that the request being sent with the following payload:
    "patch": [
        {
            "environmentKey": "environment-key-123abc",
            "instructions": [
                {
                    "kind": "addValuesToClause",
                    "ruleId": "a902ef4a-2faf-4eaf-88e1-ecc356708a29,
                    "clauseId": "10a58772-3121-400f-846b-b8a04e8944ed",
                    "values": [
                        "please-work"
                    ]
                }
            ]
        }
    ]
}

And the response from the REST API is 400 Error

    "code": "invalid_patch",
    "message": "must have at least one instruction"
}

Please advise, is there a way to use all the different patch operations via the client?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions