Marklogic Rest资源扩展不支持metadata.xml
我有一个rest资源扩展,我在其中指定参数类型。。但我注意到,我在POST或get中获得的参数与metadata.xml中的参数类型不同。。它们都是xs:string。但当我看到开箱即用的搜索API时,它确实尊重参数类型。。我深入挖掘了一下,注意到在/MarkLogic/restapi/endpoints/config.xqy中,get-rsrc-list查询规则没有获取我在metadata.xml中指定的元数据规则,但对于开箱即用的搜索restapi,它确实获取了正确的规则Marklogic Rest资源扩展不支持metadata.xml,marklogic,marklogic-8,Marklogic,Marklogic 8,我有一个rest资源扩展,我在其中指定参数类型。。但我注意到,我在POST或get中获得的参数与metadata.xml中的参数类型不同。。它们都是xs:string。但当我看到开箱即用的搜索API时,它确实尊重参数类型。。我深入挖掘了一下,注意到在/MarkLogic/restapi/endpoints/config.xqy中,get-rsrc-list查询规则没有获取我在metadata.xml中指定的元数据规则,但对于开箱即用的搜索restapi,它确实获取了正确的规则 declare f
declare function conf:get-rsrc-list-query-rule() as element(rest:request) {
<rest:request
allow-post-alias="true"
fast-match="/*/config/resources"
uri="^/(v1|get-rsrc-list-query-ruleLATEST)/config/resources/?$"
endpoint="/MarkLogic/rest-api/endpoints/resource-list-query.xqy">
<rest:http method="GET">
<rest:param name="format" required="false" values="json|xml"/>
<rest:param name="refresh" required="false" as="boolean"/>
</rest:http>
</rest:request>
};
而对于开箱即用的搜索RESTAPI,则会发送正确的规则
declare function conf:get-search-query-request-rule() as element(rest:request) {
<rest:request
allow-post-alias="true"
fast-match="/*/search"
uri="^/(v1|LATEST)/search(/)?$"
endpoint="/MarkLogic/rest-api/endpoints/search-list-query.xqy"
user-params="allow-dups">
<rest:http method="GET">
<rest:param name="q" required="false"/>
<rest:param name="format" required="false" values="json|xml"/>
<rest:param name="start" as="unsignedLong" required="false"/>
<rest:param name="pageLength" as="unsignedLong" required="false"/>
<rest:param name="category" required="false" repeatable="true"
values="content|metadata|{string-join(docmodcom:list-metadata-categories(),"|")}"/>
<rest:param name="options" as="string" required="false"/>
<rest:param name="collection" as="string" required="false" repeatable="true"/>
<rest:param name="directory" as="string" required="false" repeatable="false"/>
<rest:param name="view" as="string" values="metadata|results|facets|all|none"/>
<rest:param name="txid" as="string" required="false"/>
<rest:param name="database" required="false"/>
<rest:param name="transform" required="false"/>
<rest:param name="structuredQuery" required="false"/>
<rest:auth>
<rest:privilege>http://marklogic.com/xdmp/privileges/rest-reader</rest:privilege>
<rest:kind>execute</rest:kind>
</rest:auth>
</rest:http>
<rest:http method="POST">
<rest:param name="q" required="false"/>
<rest:param name="format" required="false" values="json|xml"/>
<rest:param name="category" required="false" repeatable="true"
values="content|metadata|{string-join(docmodcom:list-metadata-categories(),"|")}"/>
<rest:param name="start" as="unsignedLong" required="false"/>
<rest:param name="pageLength" as="unsignedLong" required="false"/>
<rest:param name="options" as="string" required="false"/>
<rest:param name="collection" as="string" required="false" repeatable="true"/>
<rest:param name="directory" as="string" required="false" repeatable="false"/>
<rest:param name="view" as="string" values="metadata|results|facets|all|none"/>
<rest:param name="txid" as="string" required="false"/>
<rest:param name="database" required="false"/>
<rest:param name="transform" required="false"/>
<rest:content-type>text/xml</rest:content-type>
<rest:content-type>text/json</rest:content-type>
<rest:content-type>application/xml</rest:content-type>
<rest:content-type>application/json</rest:content-type>
<rest:auth>
<rest:privilege>http://marklogic.com/xdmp/privileges/rest-reader</rest:privilege>
<rest:kind>execute</rest:kind>
</rest:auth>
</rest:http>
<rest:http method="HEAD"/>
<rest:http method="OPTIONS"/>
</rest:request>
};
我认为在指定参数类型时,资源rest api将强制执行这些类型,否则将引发错误,但事实并非如此。。它使用现成的RESTAPI
我不明白这是对的吗?我弄错了吗?如何让rest资源扩展遵守在my metadata.xml中指定的参数类型元数据是关于资源服务扩展的可选信息,您可以从中找到可用的扩展 文件是这样说的: 如果扩展服务需要参数,则可以在安装扩展时使用请求参数选择性地“声明”参数。此信息是可以通过GET请求返回到/config/resources的元数据。它不用于检查对扩展的请求的参数 MarkLogic Server以XML或JSON格式返回已安装扩展的摘要。。。。关于给定扩展的可用信息量取决于安装扩展期间提供的元数据量 您可以将字符串强制转换为扩展中的任何类型,例如通过调用xs:int或xs:double
希望这能有所帮助,您能告诉我您正在运行的MarkLogic的哪个版本,以及您是如何部署rest扩展的吗?ML版本是8.0-5.4,我正在使用ML gradle进行部署。。我确实在/marklogic.rest.resource/crSearch/assets/metadata.xml上看到了我的“metadata.xml”