Rui Fernandes
Rui Fernandes

Reputation: 51

No such snippet is present in configuration warning

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)

Upvotes: 3

Views: 209

Answers (2)

seed
seed

Reputation: 1

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();

Upvotes: 0

Rui Fernandes
Rui Fernandes

Reputation: 51

Fixed. I Was Missing this on my Pom :

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

Upvotes: 2

Related Questions