Search code examples
enunciate

Deactivate XML examples and XML documentation in enunciate


I have a REST service that is documented using enunciate. None of my endpoints provide application/xml output. Still I get documentation similar to here: http://enunciate.codehaus.org/wannabecool/step4/el_persona_persona.html (example XML) and here: http://enunciate.codehaus.org/wannabecool/step4/persona_persona.html (XML attributes).

I only provide a service with JSON output (don't ask me why, it's not my decision). Thus I do not need the XML output since it would suggest to an interface user that it is possible to use the interface with XML data.

Below you can find my enunciate.xml. You can see that I already tried to disable XML generation by only putting content-type application/json in the content-types and by putting xml/disabled=true:

<?xml version="1.0" encoding="UTF-8"?>
<enunciate label="blubb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.28.xsd">
    <deployment protocol="https" host="blubb" context="blubbService/v1"/>
    <namespaces>
        <namespace id="api" uri="https://blubb.com/blubbService/v1/"/>
    </namespaces>
    <services>
        <rest>
            <content-types>
                <content-type type="application/json" id="json" />
            </content-types>
        </rest>
    </services>
    <modules>
        <docs splashPackage="blubbService.api" title="blubb API" copyright="blubb"/>
        <jersey useSubcontext="false" usePathBasedConneg="false"/>
        <xml disabled="true"/>
        <jaxws disabled="true" />
        <jaxws-client disabled="true" />
        <jaxws-ri disabled="true" />
    </modules>
</enunciate>

How do I properly deactivate XML documentation?


Solution

  • Try applying the following to your enunciate.xml configuration file:

      <enunciate>
        ...
        <modules>
          ...
          <docs includeExampleXml="false">
          ...