Skip to content

Commit

Permalink
docs: update API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
oproprioleonardo committed Oct 19, 2024
1 parent 3560839 commit e9fe78e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import br.com.ifsp.tickets.infra.contexts.event.sale.payment.models.CreatePaymentRequest;
import br.com.ifsp.tickets.infra.shared.APIErrorResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Webhook;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.media.Schema;
Expand Down Expand Up @@ -58,16 +57,13 @@ public interface EnrollmentAPI {
ResponseEntity<String> createUpsertEnrollment(@RequestBody CreateUpsertEnrollmentRequest request);

@PostMapping(consumes = "application/json", value = "/webhook")
@Webhook(
name = "Payment Webhook",
operation = @Operation(
summary = "Payment webhook",
description = "Webhook for payment",
responses = {
@ApiResponse(responseCode = "201", description = "Webhook received successfully"),
@ApiResponse(responseCode = "400", description = "Invalid request", content = @Content(schema = @Schema(implementation = APIErrorResponse.class), mediaType = "application/json"))
}
)
@Operation(
summary = "Payment",
description = "Receive payment webhook",
responses = {
@ApiResponse(responseCode = "201", description = "Webhook received successfully"),
@ApiResponse(responseCode = "400", description = "Invalid request", content = @Content(schema = @Schema(implementation = APIErrorResponse.class), mediaType = "application/json"))
}
)
ResponseEntity<Void> webhook(@RequestBody CreatePaymentRequest request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
import br.com.ifsp.tickets.domain.communication.message.type.MessageSubject;
import br.com.ifsp.tickets.domain.communication.message.type.MessageType;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn;
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
import io.swagger.v3.oas.annotations.info.Contact;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.security.SecurityScheme;
import io.swagger.v3.oas.annotations.security.SecuritySchemes;
import io.swagger.v3.oas.models.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
Expand Down Expand Up @@ -34,6 +38,17 @@
@OpenAPIDefinition(
info = @Info(title = "Tickets API", version = "v1", description = "Tickets API Documentation", contact = @Contact(name = "IFSP CBT - Informática", email = "ifspcbt.informatica@gmail.com", url = "https://linktr.ee/_oleonardosilva"))
)
@SecuritySchemes(
value = @SecurityScheme(
name = "bearer",
in = SecuritySchemeIn.HEADER,
description = "Bearer Token",
paramName = "Authorization",
type = SecuritySchemeType.HTTP,
bearerFormat = "JWT",
scheme = "bearer"
)
)
public class WebServerConfig {

private final ResourceLoader resourceLoader;
Expand Down

0 comments on commit e9fe78e

Please sign in to comment.