2

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

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
Ravi
  • 1,179
  • 6
  • 13

1 Answers1

2

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>

Ravi
  • 1,179
  • 6
  • 13
  • Be sure to select your answer, to indicate that the question has been answered. – Mads Hansen Jan 26 '17 at 13:00
  • I've added an issue to ml-javaclient-util to make this more obvious. Here's a sample that I think it outdated, as I believe HTML is actually supported in the description element - that was one of the goals of this feature - https://github.com/rjrudin/ml-javaclient-util/blob/master/src/test/resources/sample-base-dir/services/metadata/sample.xml – rjrudin Jan 26 '17 at 13:46
  • 1
    @rjrudin, Can you please add the same to ml-gradle project, or better if one of your examples has this..-- Thanks – Ravi Jan 26 '17 at 14:13