无法将我的javadocs与spring自动休息文档链接起来

时间:2018-04-02 02:28:28

标签: spring-boot maven-javadoc-plugin spring-restdocs spring-auto-restdocs

我不知道如何使用Spring Auto Rest Docs来使用JavaDocs。我可以使用STS,UI选项在本地生成我的java-docs。但是,我不知道如何使用Spring Auto Rest Docs生成java-docs。我尝试在POM中编写一些插件。但是auto-description.adoc和许多其他文档仍然是空的。

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.3</version>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.0.0</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                    <configuration>
                        <!-- switch on dependency-driven aggregation -->
                        <includeDependencySources>true</includeDependencySources>
                    </configuration>
                </execution>
                <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>
                        </docletArtifact>
                        <additionalparam>
                                -d ${project.build.directory}/site/doccheck
                        </additionalparam>
                        <reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
                        <useStandardDocletOptions>false</useStandardDocletOptions>
                        <show>package</show>
                    </configuration>
                </execution>
            </executions>
        </plugin>

基本上我没有得到如何使Spring Auto Rest Docs使用Java Docs来查找路径参数。我可以在终端上使用mvn javadoc:javadoc命令来创建在target / site / apidocs /文件夹中创建的Javadoc。但是我的auto-path-parameters.adoc

中仍然没有参数

这是控制器,我正在使用GraphQL,因此它的不同之处在于:

/**
 * Query Controller Class
 * @author shantanu
 *
 */
@RestController
@RequestMapping(value="/graphql")
public class QueryController {

    @Value("classpath:/graphql/actionItm.graphqls")
    private Resource schemaResource;



    private GraphQL graphQL;


    @Autowired
    @Qualifier("graphQLDate")
    private GraphQLScalarType Date;



    @Autowired
    private AllActionItemsDataFetcher allActionItemsDataFetcher;

    @Autowired
    private ActionItemDataFetcher actionItemDataFetcher;


    @Autowired
    private PageActionItemDataFetcher pageActionItemDataFetcher;

    @PostConstruct
    public void loadSchema() throws IOException {
        File schemaFile = schemaResource.getFile();
        TypeDefinitionRegistry typeRegistry = new SchemaParser().parse(schemaFile);
        RuntimeWiring wiring = buildRuntimeWiring();
        GraphQLSchema schema = new SchemaGenerator().makeExecutableSchema(typeRegistry, wiring);
        graphQL = GraphQL.newGraphQL(schema).build();

    }

    private RuntimeWiring buildRuntimeWiring() {


        return RuntimeWiring.newRuntimeWiring()
                .type("Query", typeWiring -> typeWiring
                        .dataFetcher("findAllActionItems", allActionItemsDataFetcher)
                        .dataFetcher("findActionItem", actionItemDataFetcher)
                        .dataFetcher("pageActionItems", pageActionItemDataFetcher))
                        .scalar(Date)

                .build();
    }

    /**
     * This
     * @param query Description
     * @return ResponseEntity responseEntity
     */
    @PostMapping
    public ResponseEntity query(@RequestBody String query) {
        ExecutionResult result = graphQL.execute(query);
        return ResponseEntity.ok(result.getData());

    }

}

我没有通过路径参数得到我错的地方。并且只有.adoc文件是使用Spring Auto Rest Docs生成的,并且没有JSON文件。

0 个答案:

没有答案