I am trying to load a transformation to the marklogic database but it fails resulting in "either is not a valid module or does not provide extension functions (transform) in the http://marklogic.com/rest-api/transform/validate namespace".
My xqy file is below:
xquery version "1.0-ml";
module namespace trans = "http://marklogic.com/rest-api/transform/validate";
declare function trans:transform(
$context as map:map,
$params as map:map,
$content as document-node()
) as document-node()
{
let $validate := validate strict { $content }
return $content;
};
I am running the following command:
curl --anyauth --user admin:admin -X PUT -d@"./filetype_xform.xqy" -i -H "Content-type: application/xquery" 'http://localhost:8061/v1/config/transforms/validate'
And the error that I am seeing is: HTTP/1.1 400 Bad Request Content-type: application/json; charset=UTF-8 Server: MarkLogic Content-Length: 557 Connection: Keep-Alive Keep-Alive: timeout=5
{"errorResponse":{"statusCode":400, "status":"Bad Request", "messageCode":"RESTAPI-INVALIDCONTENT", "message":"RESTAPI-INVALIDCONTENT: (err:FOER0000) Invalid content: invalid validate extension: could not parse XQuery extension validate; please see the server error log for detail XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected Rbrace_, expecting Function30_ or Percent_; validate either is not a valid module or does not provide extension functions (transform) in the http://marklogic.com/rest-api/transform/validate namespace"}}[admin@localhost transformations]
I appreciate any help in solving this issue.