diff --git a/versions/1.0.0.md b/versions/1.0.0.md index 3368665..7bc91a9 100644 --- a/versions/1.0.0.md +++ b/versions/1.0.0.md @@ -474,7 +474,7 @@ stepId: joinWaitingListStep criteria: # assertions to determine if this success action should be executed - context: $response.body - condition: $.Pets.length() > 0 + condition: $[?count(@.pets) > 0] type: JSONPath ``` @@ -704,7 +704,7 @@ Field Name | Type | Description ---|:---:|--- context | `{expression}` | A [runtime expression](#runtime-expressions) used to set the context for the condition to be applied on. If `type` is specified, then the `context` MUST be provided (e.g. `$response.body` would set the context that a JSONPath query expression could be applied to). condition | `string` | **REQUIRED**. The condition to apply. Conditions can be simple (e.g. `$statusCode == 200` which applies a operator on a value obtained from a runtime expression), or a regex, or a JSONPath expression. For regex and [JSONPath](https://datatracker.ietf.org/doc/draft-ietf-jsonpath-base/21/), the `type` and `context` MUST be specified. -type | `string` | The type of condition to be applied. If specified, the options allowed are `simple`, `regex` or `JSONPath`. If omitted, then the condition is assumed to be `simple`, which at most combines literals, operators and [Runtime Expressions](#runtime-expressions). +type | `string` \| [Criterion Expression Type Object](#criterion-expression-type-object) | The type of condition to be applied. If specified, the options allowed are `simple`, `regex`, `jsonpath` or `xpath`. If omitted, then the condition is assumed to be `simple`, which at most combines literals, operators and [Runtime Expressions](#runtime-expressions). If `jsonpath`, then the expression MUST conform to [JSON Path](https://www.rfc-editor.org/rfc/rfc9535.html). If `xpath` the expression MUST conform to [XML Path Language 3.1](https://www.w3.org/TR/xpath-31/#d2e24229). Should other variants of JSON Path or XPath be required, then a [Criterion Expression Type Object](#criterion-expression-type-object) MUST be specified. This object MAY be extended with [Specification Extensions](#specificationExtensions). @@ -727,8 +727,38 @@ This object MAY be extended with [Specification Extensions](#specificationExtens **JSONPath Condition Example** ```yaml - context: $response.body - condition: $[?length(@.pets) > 0] - type: JSONPath + condition: $[?count(@.pets) > 0] + type: jsonpath +``` + +#### Criterion Expression Type Object + +An object used to describe the type and version of an expression used within a [Criterion Object](#criterion-object). If this object is not defined, then the following defaults apply: + - JSON Path as described by [RFC 9535](https://www.rfc-editor.org/rfc/rfc9535.html) + - XPath as described by [XML Path Language 3.1](https://www.w3.org/TR/xpath-31) + +Defining this object gives the ability to utilize tooling compatible with older versions of either JSON Path or XPath. + + ##### Fixed Fields +Field Name | Type | Description +---|:---:|--- +type | `string` | **REQUIRED**. The type of condition to be applied. The options allowed are `jsonpath` or `xpath`. +version | `string` | **REQUIRED**. A short hand string representing the version of the expression type being used. The allowed values for JSON Path are `draft-goessner-dispatch-jsonpath-00`. The allowed values for XPath are `xpath-30`, `xpath-20`, or `xpath-10`. + +This object MAY be extended with [Specification Extensions](#specificationExtensions). + +##### Criterion Expression Type Example + +**JSON Path Example** +```yaml + type: jsonpath + version: draft-goessner-dispatch-jsonpath-00 +``` + +**XPath Example** +```yaml + type: xpath + version: xpath-30 ``` #### Request Body Object