Skip to content

Commit

Permalink
feat: intitial setup for swagger documentation #540
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Oct 7, 2023
1 parent 90e9ead commit 9302536
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***
<p>
Licensed under MIT License Copyright (c) 2023 Raja Kolli.
</p>
***/

package com.example.orderservice.web.api;

import com.example.common.dtos.OrderDto;
import com.example.orderservice.utils.AppConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import java.util.List;

public interface OrderApi {

@Operation(summary = "fetches all orders from Kinesis Stream")
List<OrderDto> all(
@Parameter(name = "pageNo", example = AppConstants.DEFAULT_PAGE_SIZE) int pageNo,
@Parameter(name = "pageSize", example = AppConstants.DEFAULT_PAGE_SIZE) int pageSize);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Licensed under MIT License Copyright (c) 2021-2023 Raja Kolli.
import com.example.orderservice.services.OrderKafkaStreamService;
import com.example.orderservice.services.OrderService;
import com.example.orderservice.utils.AppConstants;
import com.example.orderservice.web.api.OrderApi;
import io.github.resilience4j.bulkhead.annotation.Bulkhead;
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
import io.github.resilience4j.ratelimiter.annotation.RateLimiter;
Expand All @@ -38,7 +39,7 @@ Licensed under MIT License Copyright (c) 2021-2023 Raja Kolli.
@RequestMapping("/api/orders")
@RequiredArgsConstructor
@Validated
public class OrderController {
public class OrderController implements OrderApi {

private final OrderService orderService;
private final OrderGeneratorService orderGeneratorService;
Expand Down Expand Up @@ -95,7 +96,7 @@ public ResponseEntity<OrderResponse> createOrder(

@PutMapping("/{id}")
public ResponseEntity<OrderResponse> updateOrder(
@PathVariable Long id, @RequestBody OrderRequest orderRequest) {
@PathVariable Long id, @RequestBody @Valid OrderRequest orderRequest) {
return orderService
.findOrderById(id)
.map(
Expand Down Expand Up @@ -123,6 +124,7 @@ public boolean create() {
}

@GetMapping("/all")
@Override
public List<OrderDto> all(
@RequestParam(
value = "pageNo",
Expand Down

0 comments on commit 9302536

Please sign in to comment.