This module implements the
QueryAdapter
interface to use the JSONPath
query language as part of JM2MP projection documents.
This module only supports jsonpath-plus 10.x versions. Other versions must be tested previously to be considered as well.
By compliance with JM2MP, the
QueryAdapter
created by
createJsonataAdapter
maintains the expected behaviour:
undefined,nulland empty arrays -->null.nullinput -->nulloutput without calling [JSONPath+external:JSONPath external library.- Array with just one item --> Unwrap to single result.
- Array with several items --> array (as-is).
- Invalid expression during validation --> ValidationError.
- Invalid expression during runtime --> EvaluationError.
The jsonpath-plus library is dynamically loaded when constructing its corresponding QueryAdapter. If not previously installed, an AdapterError exception will be raised from createJsonPathAdapter with a clear message about it.
Source
Methods
static
createJsonPathAdapter() → {Promise.<module:jm2mp/adapters/registry.QueryAdapter>}
It creates a new QueryAdapter dynamically loading JSONPath version 10.x.
Returns
-
Promise.<module:jm2mp/adapters/registry.QueryAdapter>