【问题标题】:Deactivate XML examples and XML documentation in enunciate以 enunciate 停用 XML 示例和 XML 文档
【发布时间】:2014-03-31 14:03:13
【问题描述】:

我有一个使用 enunciate 记录的 REST 服务。我的端点都没有提供应用程序/xml 输出。我仍然得到类似于这里的文档:http://enunciate.codehaus.org/wannabecool/step4/el_persona_persona.html(示例 XML)和这里:http://enunciate.codehaus.org/wannabecool/step4/persona_persona.html(XML 属性)。

我只提供 JSON 输出的服务(不要问我为什么,这不是我的决定)。因此,我不需要 XML 输出,因为它会向界面用户建议可以将界面与 XML 数据一起使用。

您可以在下面找到我的 enunciate.xml。您可以看到我已经尝试通过仅将 content-type application/json 放入 content-types 并放入 xml/disabled=true 来禁用 XML 生成:

<?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>

如何正确停用 XML 文档?

【问题讨论】:

    标签: enunciate


    【解决方案1】:

    尝试将以下内容应用于您的 enunciate.xml 配置文件:

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

    【讨论】:

    • 您能否解释一下这段代码(在您的回答中)?这样你可能会得到更多的支持!
    猜你喜欢
    • 1970-01-01
    • 2014-09-18
    • 1970-01-01
    • 1970-01-01
    • 2020-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-07
    相关资源
    最近更新 更多