Plyson
DocumentationJSON Reference

Assertion Operators

A complete catalog of all operators available for response validation in Plyson.

Plyson provides a wide range of operators to validate API responses. These operators are powered by Playwright's expect library and can be used against both response bodies and headers.

Equality & Existence

OperatorValueDescription
equalsAnyChecks if the actual value is equal to the expected value.
notEqualsAnyChecks if the actual value is NOT equal to the expected value.
equalsIgnoreCaseStringCase-insensitive string equality check.
exists(None)Checks if the value is defined (not undefined).
notExists(None)Checks if the value is undefined.
isNull(None)Checks if the value is explicitly null.
isNotNull(None)Checks if the value is NOT null.

Numeric Comparisons

OperatorValueDescription
isGreaterThanNumberActual > Value
isLessThanNumberActual < Value
isGreaterThanOrEqualsNumberActual >= Value
isLessThanOrEqualsNumberActual <= Value

Strings & Arrays

OperatorValueDescription
containsStringChecks if a string contains a substring.
notContainsStringChecks if a string does NOT contain a substring.
matchesString (Regex)Validates a string against a Regular Expression.
hasLengthNumberChecks if a string or array has an exact length.
hasMinLengthNumberChecks for minimum length.
hasMaxLengthNumberChecks for maximum length.
includesAnyChecks if an array contains a specific item.
notIncludesAnyChecks if an array does NOT contain an item.
isEmpty(None)Checks if a string or array is empty.
isNotEmpty(None)Checks if a string or array is NOT empty.

Advanced Validation

containsSubset

Checks if the response object contains the specified properties and values. This is great for partial object matches.

{
  "operator": "containsSubset",
  "value": { "role": "ADMIN", "active": true }
}

notContainsSubset

Ensures that the response object does NOT match the provided subset of properties.

Type Checks

Validate the data type of the response field:

  • isString
  • isNumber
  • isBoolean
  • isArray
  • isObject

Complete Example

{
  "title": "Validate User Details",
  "from": "body",
  "path": "$.user",
  "operator": "containsSubset",
  "value": {
    "email": "jane@example.com",
    "settings": { "theme": "dark" }
  }
}

On this page