没有在配置中找到此代码片段警告。

huangapple go评论78阅读模式
英文:

No such snippet is present in configuration warning

问题

以下是您的翻译内容:

错误信息

配置了包含在部分中的“auto-method-path”段落片段,但在配置中没有找到此类片段

配置了包含在部分中的“auto-description”段落片段,但在配置中没有找到此类片段

自动生成的“auto-method-path”正在生成,所以我不知道警告是从哪里产生的。但根据文档,自动描述是控制器的javaDoc,所以我不知道为什么没有生成此文档。

JavaDoc

/**
   * 返回客户信息
   *
   * @param id       客户的ID
   * @return 客户
   */
  @GetMapping(path = "api/customer/{id}", produces = HAL_JSON_VALUE)
英文:

I'm doing documentation using Spring rest auto docs and AsciiDoc. Below is my error message

Error Message

Section snippet 'auto-method-path' is configured to be included in the section but no such snippet is present in configuration

Section snippet 'auto-description' is configured to be included in the section but no such snippet is present in configuration

The auto-method-path is being generated so I have no idea where the warning comes from. But the auto-description is according to the documentation, the javaDoc of the controller so I have no idea why is this documentation not being generated.

JavaDoc

/**
   * Returns a Customer
   *
   * @param id       the id of the customer
   * @return the customer
   */
  @GetMapping(path = "api/customer/{id}", produces = HAL_JSON_VALUE)

答案1

得分: 2

<execution>
    <id>generate-javadoc-json</id>
    <phase>compile</phase>
    <goals>
        <goal>javadoc-no-fork</goal>
    </goals>
    <configuration>
        <doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
        <docletArtifact>
            <groupId>capital.scalable</groupId>
            <artifactId>spring-auto-restdocs-json-doclet</artifactId>
            <version>2.0.9</version>
        </docletArtifact>
        <destDir>generated-javadoc-json</destDir>
        <reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
        <useStandardDocletOptions>false</useStandardDocletOptions>
        <show>package</show>
    </configuration>
</execution>
英文:

Fixed. I Was Missing this on my Pom :

   &lt;execution&gt;
            &lt;id&gt;generate-javadoc-json&lt;/id&gt;
            &lt;phase&gt;compile&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;javadoc-no-fork&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;doclet&gt;capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet&lt;/doclet&gt;
              &lt;docletArtifact&gt;
                &lt;groupId&gt;capital.scalable&lt;/groupId&gt;
                &lt;artifactId&gt;spring-auto-restdocs-json-doclet&lt;/artifactId&gt;
                &lt;version&gt;2.0.9&lt;/version&gt;
              &lt;/docletArtifact&gt;
              &lt;destDir&gt;generated-javadoc-json&lt;/destDir&gt;
              &lt;reportOutputDirectory&gt;${project.build.directory}&lt;/reportOutputDirectory&gt;
              &lt;useStandardDocletOptions&gt;false&lt;/useStandardDocletOptions&gt;
              &lt;show&gt;package&lt;/show&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;

答案2

得分: 0

从您的AutoDocumentation.sectionBuilder().snippetNames(...)中移除SnippetRegistry.AUTO_METHOD_PATHSnippetRegistry.AUTO_DESCRIPTION

// 从
AutoDocumentation.sectionBuilder().snippetNames(
                    AUTO_METHOD_PATH,
                    AUTO_DESCRIPTION,
                    AUTO_AUTHORIZATION,
                    ...
                    ).build();

// 至
AutoDocumentation.sectionBuilder().snippetNames(
                    AUTO_AUTHORIZATION,
                    ...
                    ).build();
英文:

remove SnippetRegistry.AUTO_METHOD_PATH and SnippetRegistry.AUTO_DESCRIPTION from your AutoDocumentation.sectionBuilder().snippetNames(...)

// from
AutoDocumentation.sectionBuilder().snippetNames(
                    AUTO_METHOD_PATH,
                    AUTO_DESCRIPTION,
                    AUTO_AUTHORIZATION,
                    ...
                    ).build();

// to
AutoDocumentation.sectionBuilder().snippetNames(
                    AUTO_AUTHORIZATION,
                    ...
                    ).build();

huangapple
  • 本文由 发表于 2020年8月25日 22:52:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/63581548.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定