#java #javadoc #asciidoc #spring-restdocs
#java #Javadoc #asciidoc #spring-restdocs
Вопрос:
Я создаю документацию, используя Spring rest auto docs и AsciiDoc. Ниже приведено мое сообщение об ошибке
Сообщение об ошибке
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
Генерируется путь к автоматическому методу, поэтому я понятия не имею, откуда берется предупреждение. Но автоматическое описание соответствует документации, javaDoc контроллера, поэтому я понятия не имею, почему эта документация не генерируется.
Javadoc
/**
* Returns a Customer
*
* @param id the id of the customer
* @return the customer
*/
@GetMapping(path = "api/customer/{id}", produces = HAL_JSON_VALUE)
Комментарии:
1. вы забыли закрыть строку path двойной кавычкой?
2. @ChrisMaggiulli Только здесь, в stack overflow! Я переписал путь вручную, потому что исходный содержал название моей компании.
Ответ №1:
Исправлено. Мне не хватало этого в моем 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>
Ответ №2:
удалите SnippetRegistry.AUTO_METHOD_PATH
и SnippetRegistry.AUTO_DESCRIPTION
из вашей автодокументации.sectionBuilder().snippetNames(…)
// from
AutoDocumentation.sectionBuilder().snippetNames(
AUTO_METHOD_PATH,
AUTO_DESCRIPTION,
AUTO_AUTHORIZATION,
...
).build();
// to
AutoDocumentation.sectionBuilder().snippetNames(
AUTO_AUTHORIZATION,
...
).build();