2

私の目標は、Jersey リソースからこのような闊歩定義を生成することです。

これを取得するには、私の pom.xml は次のようになります。

 <plugin>
            <groupId>com.github.kongchen</groupId>
            <artifactId>swagger-maven-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
                <apiSources>
                    <apiSource>
                        <locations>com.rest.resources</locations>
                        <apiVersion>1.0</apiVersion> 
                       <swaggerDirectory>${basedir}/src/main/webapp/docs</swaggerDirectory>
                    </apiSource>
                </apiSources>
            </configuration>
        </plugin>

また、swagger/jersey 依存関係もありました。

    <dependency>
        <groupId>com.wordnik</groupId>
        <artifactId>swagger-jaxrs_2.10</artifactId>
        <version>1.3.10</version>
        <scope>compile</scope>
    </dependency>

json は適切に生成されていますが、1 つだけではなく、リソースごとに 1 つの json ファイルを取得しています

私が欠けているもの

4

1 に答える 1

2

何も欠けていません。期待どおりに機能しています。

あなたが提供したリンクでも、リソースごとにファイルがあります。これらのリンクをチェックしてください:

http://petstore.swagger.wordnik.com/api/api-docs/pet

http://petstore.swagger.wordnik.com/api/api-docs/user

http://petstore.swagger.wordnik.com/api/api-docs/store

于 2014-11-24T19:15:17.763 に答える