Skip to content

peterszatmary/spring-boot-jsondoc-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-boot-jsondoc-demo

Build Status Codacy Badge Docker Repository on Quay

Spring Boot with JsonDoc demo for your REST APIs documentation and playground. In this project is used also Lombok for simplifing POJOs.

How to run demo

mvn clean install
java -jar spring-boot-jsondoc-demo-0.0.1-SNAPSHOT.jar
go to http://localhost:8080/jsondoc-ui.html?url=jsondoc

How to run demo with docker from project (Linux, Mac OS)

cd bin
sh build.sh
sh run.sh
go to http://localhost:8080/jsondoc-ui.html?url=jsondoc

How to run demo with docker (All systems) from project

docker build -t spring-boot-jsondoc-demo:latest .
docker run -d -p 8080:8080 -ti spring-boot-jsondoc-demo:latest
go to http://localhost:8080/jsondoc-ui.html?url=jsondoc

How to run demo with docker (All systems) from Quay

docker pull quay.io/peterszatmary/spring-boot-jsondoc-demo
docker run -d -p 8080:8080 -ti spring-boot-jsondoc-demo:latest
go to http://localhost:8080/jsondoc-ui.html?url=jsondoc

How it looks like

JsonDoc hello REST

1

ApplicationController.java hello endpoint

  @RequestMapping(value = "/hello")
    public @ResponseBody
    String hello() {
        return "hello";
    }

JsonDoc car REST

2

ApplicationController.java car endpoint

@RequestMapping(value = "/car")
    public @ResponseBody
    Car car() {
        return new Car("BMW", new Owner("owner of BMW"));
    }

Car.java

@ApiObject(name="Car", description = "Car object represents cars.")
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Car {

    @ApiObjectField(description = "Just simple car name")
    private String name;

    @ApiObjectField(description = "Car owner")
    private Owner owner;
}

Owner.java

@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiObject(name="Owner", description = "Owner of car.")
public class Owner {
    @ApiObjectField(description = "Owner name and surname.")
    private String name;
}

JsonDoc objects

3

About

Spring Boot with JsonDoc demo for REST APIs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published