Features

Validate constraint

Changed on

Validates a constraint definition. Checks whether the context field exists and whether the applied configuration is valid. Additional properties are not allowed on data objects that you send to this endpoint.

post/api/admin/constraints/validate

Request

  • Base URL
    https://app.unleash-instance.example.com
  • URL
    https://app.unleash-instance.example.com/api/admin/constraints/validate
  • Auth
    • API key in header Authorization
    • or HTTP bearer

Request body

contextNamestring required

The name of the context field that this constraint should apply to.

operator'NOT_IN' | 'IN' | 'STR_ENDS_WITH' | 'STR_STARTS_WITH' | 'STR_CONTAINS' | 'NUM_EQ' | 'NUM_GT' | 'NUM_GTE' | 'NUM_LT' | 'NUM_LTE' | 'DATE_AFTER' | 'DATE_BEFORE' | 'SEMVER_EQ' | 'SEMVER_GT' | 'SEMVER_LT' | 'SEMVER_GTE' | 'SEMVER_LTE' | 'REGEX' required

The operator to use when evaluating this constraint. For more information about the various operators, refer to the strategy constraint operator documentation.

caseInsensitiveboolean

Whether the operator should be case sensitive or not. Defaults to false (being case sensitive).

invertedboolean

Whether the result should be negated or not. If true, will turn a true result into a false result and vice versa.

valuesstring[]

The context values that should be used for constraint evaluation. Use this property instead of value for properties that accept multiple values.

valuestring

The context value that should be used for constraint evaluation. Use this property instead of values for properties that only accept single values.

Example request

{
  "contextName": "appName",
  "operator": "IN",
  "values": [
    "my-app",
    "my-other-app"
  ],
  "value": "my-app"
}

Response

The constraint is valid

Changes

    • breaking

      the request property's minLength was increased from 0 to 1

    • info

      added the new SEMVER_GTE enum value to the request property

    • info

      added the new SEMVER_LTE enum value to the request property

    • info

      added the new REGEX enum value to the request property