wip: swagger
This commit is contained in:
@@ -6,8 +6,14 @@ import fr.titionfire.ffsaf.rest.exception.DNotFoundException;
|
||||
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 {
|
||||
|
||||
@@ -17,7 +23,14 @@ public class AssoEndpoints {
|
||||
@GET
|
||||
@Path("siren/{siren}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Uni<UniteLegaleRoot> getInfoSiren(@PathParam("siren") String siren) {
|
||||
@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) {
|
||||
return sirenService.get_unite(siren).onFailure().transform(throwable -> {
|
||||
if (throwable instanceof WebApplicationException exception) {
|
||||
if (exception.getResponse().getStatus() == 400)
|
||||
|
||||
Reference in New Issue
Block a user