Search code examples
marklogicmarklogic-8ml-gradle

ml-gradle xsd for metadata for services


I am deploying my resource extensions using ML-Gradle. I want to specify the parameter types and cardinality. What is the format of the metadata.xml for a given marklogic resource service extension ? Is there a documentation or an xsd that I can use ? I did the following but it did not work

<?xml  version="1.0" encoding="UTF-8"?>
<rapi:resource-metadata xmlns:rapi="http://marklogic.com/rest-api">
    <rapi:name>crSearch</rapi:name>
    <rapi:source-format>xquery</rapi:source-format>
    <rapi:title>crSearch</rapi:title>
    <rapi:methods>
        <rapi:method>
            <rapi:method-name>delete</rapi:method-name>
        </rapi:method>
        <rapi:method>
            <rapi:method-name>get</rapi:method-name>
            <rapi:parameter>
                <rapi:parameter-name>pageLength</rapi:parameter-name>
                <rapi:parameter-type>xs:unsignedLong</rapi:parameter-type>
            </rapi:parameter>
            <rapi:parameter>
                <rapi:parameter-name>start</rapi:parameter-name>
                <rapi:parameter-type>xs:unsignedLong</rapi:parameter-type>
            </rapi:parameter>
        </rapi:method>
        <rapi:method>
            <rapi:method-name>put</rapi:method-name>
        </rapi:method>
        <rapi:method>
            <rapi:method-name>post</rapi:method-name>
            <rapi:parameter>
                <rapi:parameter-name>pageLength</rapi:parameter-name>
                <rapi:parameter-type>xs:unsignedLong</rapi:parameter-type>
            </rapi:parameter>
            <rapi:parameter>
                <rapi:parameter-name>start</rapi:parameter-name>
                <rapi:parameter-type>xs:unsignedLong</rapi:parameter-type>
            </rapi:parameter>
        </rapi:method>
    </rapi:methods>
</rapi:resource-metadata>

Can anyone tell me what the metadata xml should look like


Solution

  • I was able to figure out, after looking at the code in ml-gradle/src/main/groovy/com/marklogic/gradle/task/client/CreateResourceTask.groovy and ml-javaclient-util/src/main/java/com/marklogic/client/modulesloader/impl/DefaultExtensionMetadataProvider.java ..

    If anyone is interested, following is the structure of my metadata.xml

    <?xml  version="1.0" encoding="UTF-8"?>
    <metadata>
        <title>crSearch</title>
        <description>CR Search Web Service</description>
        <method name="DELETE"/>
        <method name="PUT"/>
        <method name="POST">
            <param name="pageLength" type="xs:unsignedLong"/>
            <param name="start" type="xs:unsignedLong"/>
        </method>
        <method name="GET">
            <param name="pageLength" type="xs:unsignedLong"/>
            <param name="start" type="xs:unsignedLong"/>
        </method>
    </metadata>
    

    All the fields are required especially <title> and <description>