Skip to content

Commit

Permalink
Reverted springfox specific changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechruz committed Feb 16, 2018
1 parent 0ec0790 commit 56853c7
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 112 deletions.
4 changes: 2 additions & 2 deletions README.md
@@ -1,2 +1,2 @@
# springfox-example
Example project implementing Swagger rest documentation using SpringFox.
# Rest Docs Starter
Starter repository with a simple REST controller used as a starting point for trying REST API documentation.
19 changes: 0 additions & 19 deletions pom.xml
Expand Up @@ -22,7 +22,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<springfox.version>2.8.0</springfox.version>
</properties>

<dependencies>
Expand All @@ -31,24 +30,6 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox.version}</version>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox.version}</version>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
<version>${springfox.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down

This file was deleted.

Expand Up @@ -2,46 +2,34 @@

import com.vojtechruzicka.springfoxexample.domain.Person;
import com.vojtechruzicka.springfoxexample.services.PersonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/v2/persons/")
@Api(description = "Set of endpoints for Creating, Retrieving, Updating and Deleting of Persons.")
public class PersonController {

private PersonService personService;

@RequestMapping(method = RequestMethod.GET, produces = "application/json")
@ApiOperation("${personcontroller.getallpersons}")
public List<Person> getAllPersons() {
return personService.getAllPersons();
}

@RequestMapping(method = RequestMethod.GET, path = "/{id}", produces = "application/json")
@ApiOperation("${personcontroller.getpersonbyid}")
public Person getPersonById(@ApiParam("Id of the person to be obtained. Cannot be empty.")
@PathVariable int id) {
public Person getPersonById(@PathVariable int id) {
return personService.getPersonById(id);
}

@RequestMapping(method = RequestMethod.DELETE, path = "/{id}")
@ApiOperation("${personcontroller.deleteperson}")
public void deletePerson(@ApiParam("Id of the person to be deleted. Cannot be empty.")
@PathVariable int id) {
public void deletePerson(@PathVariable int id) {
personService.deletePerson(id);
}

@RequestMapping(method = RequestMethod.POST, produces = "application/json")
@ApiOperation("${personcontroller.createperson}")
public Person createPerson(@ApiParam("Person information for a new person to be created.")
@RequestBody Person person) {
public Person createPerson(@RequestBody Person person) {
return personService.createPerson(person);
}

Expand Down
@@ -1,30 +1,12 @@
package com.vojtechruzicka.springfoxexample.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.*;

@ApiModel(description = "Class representing a person tracked by the application.")
public class Person {
@NotNull
@ApiModelProperty(notes = "${person.id}", example = "1", required = true, position = 0)
private int id;

@NotBlank
@Size(min = 1, max = 20)
@ApiModelProperty(notes = "${person.firstname}", example = "John", required = true, position = 1)
private String firstName;

@NotBlank
@Pattern(regexp ="[SOME REGULAR EXPRESSION]")
@ApiModelProperty(notes = "${person.lastlame}", example = "Doe", required = true, position = 2)
private String lastName;

@Min(0)
@Max(100)
@ApiModelProperty(notes = "${person.age}", example = "42", position = 3)
private int age;

public Person() {
Expand Down
11 changes: 0 additions & 11 deletions src/main/resources/swagger.properties

This file was deleted.

0 comments on commit 56853c7

Please sign in to comment.