Giter VIP home page Giter VIP logo

swagger-springweb-maven-plugin's Introduction

Swagger SpringWeb Maven plugin

Setup guide

Use Maven to build.

mvn clean install

How to use the plugin

Integrate the swagger-springweb-maven-plugin in your project by adding

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>com.moreapps</groupId>
                <artifactId>swagger-springweb-maven-plugin</artifactId>
                <version>1.0-SNAPSHOT</version>
                <configuration>
                    <title>Acme Services API</title>
                    <description>Programming API for the Acme platform.</description>
                    <termsOfServiceUrl>http://www.acme.com</termsOfServiceUrl>
                    <contact>[email protected]</contact>
                    <license>Commercial</license>
                    <licenseUrl>http://www.acme.com/license</licenseUrl>
                    <baseControllerPackage>com.acme.api.endpoints</baseControllerPackage>
                    <basePath>/docs</basePath>
                    <apiVersion>v1.0</apiVersion>
                    <outputDirectory>${project.build.outputDirectory}/docs</outputDirectory>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>swagger-springweb</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

In the compile phase the service.json and the other JSON files are generated to the outputDirectory. You need to place the JSON files in a webserver for use.

Swagger-UI

Download Swagger UI from: https://github.com/wordnik/swagger-ui/tree/master/dist Place it in an Apache web server folder. In the index.html file you can change the default url to location of the generated JSON files:

url: "http://localhost/swagger-files/service.json"

Apache might also need access control set, to allow for localhost to retrieve the JSON files:

Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

swagger-springweb-maven-plugin's People

Contributors

jlagerweij avatar stil4m avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

easonfeng5870

swagger-springweb-maven-plugin's Issues

Use JsonSubTypes annotations for polymorphic types

Annotations like:

@JsonTypeInfo(  
    use = JsonTypeInfo.Id.NAME,  
    include = JsonTypeInfo.As.PROPERTY,  
    property = "type")  
@JsonSubTypes({  
    @Type(value = Cat.class, name = "cat"),  
    @Type(value = Dog.class, name = "dog") })  

should become swagger subtypes.
Subtypes should also be added to the model.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.