Skip to content
Snippets Groups Projects
Commit e64f6605 authored by Jan Tymel's avatar Jan Tymel
Browse files

Init version of swagger doc

parent 3b0cfd3d
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,19 @@
<version>4.4</version>
</dependency>
<!-- swagger -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<!-- <version>${swagger.version}</version>-->
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
<!-- <version>${swagger.version}</version>-->
</dependency>
</dependencies>
<build>
......
package com.example.demo.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
//@Configuration
//@ComponentScan(basePackages = { "com.example.demo"})
//@EnableNeo4jRepositories(basePackages = {"com.example.demo.domain", "com.example.demo.repository"})
public class CustomNeo4jConfiguration {
}
package com.example.demo.controller;
import com.example.demo.dto.GameLevelDto;
import com.example.demo.service.GameLevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/game-level")
@CrossOrigin(origins = "*", allowCredentials = "true", allowedHeaders = "*", methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.DELETE, RequestMethod.PUT})
@Api(value = "/game-level", tags = {"Game Level"})
public class GameLevelController {
private static final Logger LOG = LoggerFactory.getLogger(GameLevelController.class);
private final GameLevelService gameLevelService;
@Autowired
public GameLevelController(GameLevelService gameLevelService) {
this.gameLevelService = gameLevelService;
}
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Return game levels")
@ApiResponses(value = {@ApiResponse(code = 200, message = "Return game levels"),
@ApiResponse(code = 500, message = "Unexpected application error")})
public List<GameLevelDto> findGameLevels() {
return gameLevelService.findAllGameLevels();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment