Generate JSON definition from jersey using swagger

961 views Asked by At

My goal is to generate a swagger definition like this from my Jersey ressources.

To get this, my pom.xml looks like :

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

I had also the swagger/jersey dependency:

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

The json is well generated, BUT i'm getting one json file for each of my resources instead of only one

What i'm missing

1

There are 1 answers

0
Ron On BEST ANSWER

You're missing nothing, it's working as expected.

Even in the link you provided, there's a file per resource. Check out these links:

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