wip: swagger p3

This commit is contained in:
2024-07-19 23:30:38 +02:00
parent fa54a58394
commit b3bfb7e267
9 changed files with 157 additions and 16 deletions

View File

@@ -7,13 +7,8 @@ import io.smallrye.mutiny.Uni;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@Tag(name = "Association", description = "Récupération des informations d'une association depuis la base de données Française")
@Path("api/asso")
public class AssoEndpoints {
@@ -23,14 +18,8 @@ public class AssoEndpoints {
@GET
@Path("siren/{siren}")
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "Renvoie les informations d'une association à partir de son numéro SIREN",
description = "Cette méthode renvoie les informations d'une association à partir de son numéro SIREN.")
@APIResponses(value = {
@APIResponse(responseCode = "200", description = "Réussite"),
@APIResponse(responseCode = "404", description = "Numéro SIREN introuvable")
})
public Uni<UniteLegaleRoot> getInfoSiren(
@Parameter(description = "Le numéro SIREN de l'association à récupérer") @PathParam("siren") String siren) {
@Operation(hidden = true)
public Uni<UniteLegaleRoot> getInfoSiren(@PathParam("siren") String siren) {
return sirenService.get_unite(siren).onFailure().transform(throwable -> {
if (throwable instanceof WebApplicationException exception) {
if (exception.getResponse().getStatus() == 400)