Skip to content

Commit

Permalink
adding swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
banderan committed Jul 27, 2024
1 parent d650e01 commit a0af0ab
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@
<version>1.5.2.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.6.0</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package mate.academy.rickandmorty.controller;

import java.util.List;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import mate.academy.rickandmorty.dto.internal.OutputCharacterResponseDto;
import mate.academy.rickandmorty.service.CharacterService;
Expand All @@ -9,17 +12,29 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "Character management",
description = "Endpoints for managing characters")
@RequiredArgsConstructor
@RestController
@RequestMapping("/animation")
@RequestMapping("/character")
public class CharacterController {
private final CharacterService animationService;

@Operation(
summary = "Retrieve character",
description = "Get a character with random id from "
+ "rick & morty"
)
@GetMapping
public OutputCharacterResponseDto getCharacter() {
return animationService.findCharacterByRandomId();
}

@Operation(
summary = "searching characters",
description = "get a character with your parameters"
+ "u can search by letter or full name"
)
@GetMapping("/search")
public List<OutputCharacterResponseDto> getWithLettersInName(
@RequestParam String name) {
Expand Down

0 comments on commit a0af0ab

Please sign in to comment.