Commit 23a47c18 authored by Anastasios Poimenidis's avatar Anastasios Poimenidis
Browse files

fix: various swagger definitions

parent 0198af00
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class OrganizationResource {
            content =
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = Organization.class)))
                            schema = @Schema(implementation = OrganizationResource.class)))
    @APIResponse(responseCode = "400", description = "Bad Request")
    @APIResponse(
            responseCode = "500",
@@ -84,7 +84,6 @@ public class OrganizationResource {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Operation(
            summary = "List or find all Organization objects",
            description = "This operation list or find Organization entities.")
@@ -94,7 +93,8 @@ public class OrganizationResource {
            content =
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = Organization.class, type = SchemaType.ARRAY)))
                            schema =
                                    @Schema(implementation = OrganizationResource.class, type = SchemaType.ARRAY)))
    public Response getAll(@RestQuery String fields, @Context UriInfo uriInfo) {
        Map<String, String> criteriaParams = UtilService.getRequestedCriteriaForFiltering(uriInfo);
        return Response.ok(organizationService.getByCriteria(fields, criteriaParams)).build();
@@ -103,7 +103,6 @@ public class OrganizationResource {
    @GET
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Operation(
            summary = "Retrieves a Organization by ID",
            description =
@@ -114,7 +113,7 @@ public class OrganizationResource {
            content =
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = Organization.class)))
                            schema = @Schema(implementation = OrganizationResource.class)))
    @APIResponse(
            responseCode = "404",
            description = "Not Found",
@@ -142,7 +141,7 @@ public class OrganizationResource {
            content =
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = Organization.class)))
                            schema = @Schema(implementation = OrganizationResource.class)))
    @APIResponse(
            responseCode = "400",
            description = "Bad Request",
@@ -173,7 +172,6 @@ public class OrganizationResource {
    @DELETE
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Operation(
            summary = "Deletes a Organization by ID",
            description = "This operation deletes a Organization entity.")
+7 −2
Original line number Diff line number Diff line
@@ -38,8 +38,6 @@ import org.jboss.resteasy.reactive.RestQuery;
                + ApplicationProperties.TMF_URL_VERSION
                + RESOURCE)
@Tag(name = "Resource Inventory")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Authenticated
public class ResourceInventoryResource {

@@ -57,6 +55,8 @@ public class ResourceInventoryResource {
    }

    @POST
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Operation(
            summary = "Creates a valid Resource",
            description = "This operation creates a Resource entity.")
@@ -88,6 +88,7 @@ public class ResourceInventoryResource {
    }

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @PermitAll
    @Operation(
            summary = "List or find all Resource Inventory objects",
@@ -105,6 +106,7 @@ public class ResourceInventoryResource {
    }

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @PermitAll
    @Path("/{id}")
    @Operation(
@@ -140,6 +142,8 @@ public class ResourceInventoryResource {

    @PATCH
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Operation(summary = "Updates partially a Resource")
    @APIResponse(
            responseCode = "200",
@@ -180,6 +184,7 @@ public class ResourceInventoryResource {

    @DELETE
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    @Operation(
            summary = "Deletes a Resource by ID",
            description = "This operation deletes a Resource entity.")
+13 −20
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@ import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;

import io.quarkus.security.Authenticated;
import jakarta.annotation.security.PermitAll;
import jakarta.inject.Inject;
import jakarta.validation.Valid;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
@@ -40,10 +39,14 @@ public class ResourceOrderResource {

    private static final Logger logger = Logger.getLogger(ResourceOrderResource.class);

    @Inject ResourceOrderService resourceOrderService;
    private final ResourceOrderService resourceOrderService;

    public static final String RESOURCE_ORDER = "resourceOrder";

    public ResourceOrderResource(ResourceOrderService resourceOrderService) {
        this.resourceOrderService = resourceOrderService;
    }

    @POST
    @Path(ApplicationProperties.TMF_URL_VERSION + "/" + RESOURCE_ORDER)
    @Produces(MediaType.APPLICATION_JSON)
@@ -77,9 +80,8 @@ public class ResourceOrderResource {
    @PermitAll
    @Path(ApplicationProperties.TMF_URL_VERSION + "/" + RESOURCE_ORDER)
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Operation(
            summary = "List or find all Service Order objects",
            summary = "List or find all Resource Order objects",
            description = "This operation list or find ResourceOrder entities.")
    @APIResponse(
            responseCode = "200",
@@ -97,7 +99,6 @@ public class ResourceOrderResource {
    @PermitAll
    @Path(ApplicationProperties.TMF_URL_VERSION + "/" + RESOURCE_ORDER + "/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Operation(
            summary = "Retrieves a ResourceOrder by ID",
            description =
@@ -116,8 +117,7 @@ public class ResourceOrderResource {
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = ErrorMessage.class)))
    public Response getById(@RestPath String id, @RestQuery String fields, @Context UriInfo uriInfo)
            throws Exception {
    public Response getById(@RestPath String id, @RestQuery String fields, @Context UriInfo uriInfo) {
        logger.info("Get service specification with id : " + id);
        Map<String, String> criteriaParams = UtilService.getRequestedCriteriaForFiltering(uriInfo);
        ResourceOrder retrievedResourceOrder =
@@ -160,7 +160,7 @@ public class ResourceOrderResource {
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = ErrorMessage.class)))
    public Response update(@Valid ResourceOrder resourceOrder, @RestPath String id) {
        logger.info("Update service order with id : " + id);
        logger.info("Update Resource order with id : " + id);
        logger.info("Request : " + resourceOrder.toString());
        return Response.ok(resourceOrderService.updateResourceOrder(id, resourceOrder)).build();
    }
@@ -168,17 +168,10 @@ public class ResourceOrderResource {
    @DELETE
    @Path(ApplicationProperties.TMF_URL_VERSION + "/" + RESOURCE_ORDER + "/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Operation(
            summary = "Deletes a ResourceOrder by ID",
            description = "This operation deletes a ResourceOrder entity.")
    @APIResponse(
            responseCode = "200",
            description = "Deleted",
            content =
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = ResourceOrder.class)))
    @APIResponse(responseCode = "204", description = "Deleted")
    @APIResponse(
            responseCode = "404",
            description = "Not Found",
@@ -187,9 +180,9 @@ public class ResourceOrderResource {
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = ErrorMessage.class)))
    public Response delete(@RestPath String id) {
        logger.info("Delete service specification with id : " + id);
        ResourceOrder deletedResourceOrder = resourceOrderService.deleteResourceOrder(id);
        logger.info("Successful delete service specification with id : " + id);
        return Response.ok(deletedResourceOrder).build();
        logger.infof("DELETE Resource Order with id: %s", id);
        resourceOrderService.deleteResourceOrder(id);
        logger.infof("DELETE Resource Order SUCCESS with id: %s", id);
        return Response.noContent().build();
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -74,10 +74,9 @@ public class ResourceOrderService {
    }

    @Transactional
    public ResourceOrder deleteResourceOrder(String id) {
    public void deleteResourceOrder(String id) {
        ResourceOrder resourceOrder = getById(id);
        resourceOrderRepository.delete(resourceOrder);
        return resourceOrder;
    }

    @Transactional
+21 −13
Original line number Diff line number Diff line
@@ -31,14 +31,11 @@ import org.etsi.osl.hypo.api.tmf.common.model.ErrorMessage;
import org.etsi.osl.hypo.api.tmf.services.common.model.ServiceDTO;
import org.etsi.osl.hypo.api.tmf.services.common.model.ServiceResponse;
import org.etsi.osl.hypo.api.tmf.services.inventory.api.services.ServiceInventoryService;
import org.etsi.osl.hypo.api.tmf.services.inventory.schema.Service;
import org.jboss.logging.Logger;
import org.jboss.resteasy.reactive.RestPath;
import org.jboss.resteasy.reactive.RestQuery;

@Path(ServiceInventoryResource.SERVICE_INVENTORY_PATH)
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Tag(name = "Service Inventory")
@Authenticated
public class ServiceInventoryResource {
@@ -58,6 +55,8 @@ public class ServiceInventoryResource {
    }

    @POST
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Operation(
            summary = "Creates a valid Service",
            description = "This operation creates a Service entity.")
@@ -65,7 +64,9 @@ public class ServiceInventoryResource {
            responseCode = "201",
            description = "Created",
            content =
                    @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = Service.class)))
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = ServiceResponse.class)))
    @APIResponse(responseCode = "400", description = "Bad Request")
    @APIResponse(
            responseCode = "500",
@@ -89,6 +90,7 @@ public class ServiceInventoryResource {
    }

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @PermitAll
    @Operation(
            summary = "List or find all Service objects",
@@ -99,13 +101,14 @@ public class ServiceInventoryResource {
            content =
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = Service.class, type = SchemaType.ARRAY)))
                            schema = @Schema(implementation = ServiceResponse.class, type = SchemaType.ARRAY)))
    public Response getServices(@RestQuery String fields, @Context UriInfo uriInfo) {
        Map<String, String> criteriaParams = UtilService.getRequestedCriteriaForFiltering(uriInfo);
        return Response.ok(serviceInventoryService.getByCriteria(fields, criteriaParams)).build();
    }

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/peeredOrganization")
    @PermitAll
    @Operation(
@@ -117,7 +120,7 @@ public class ServiceInventoryResource {
            content =
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = Service.class, type = SchemaType.ARRAY)))
                            schema = @Schema(implementation = ServiceResponse.class, type = SchemaType.ARRAY)))
    public Response getAllServicesWithPeeredOrganizationDetails(
            @RestQuery String fields, @Context UriInfo uriInfo) {
        Map<String, String> criteriaParams = UtilService.getRequestedCriteriaForFiltering(uriInfo);
@@ -127,6 +130,7 @@ public class ServiceInventoryResource {
    }

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @PermitAll
    @Path("/{id}")
    @Operation(
@@ -137,7 +141,9 @@ public class ServiceInventoryResource {
            responseCode = "200",
            description = "Success",
            content =
                    @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = Service.class)))
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = ServiceResponse.class)))
    @APIResponse(
            responseCode = "404",
            description = "Not Found",
@@ -157,13 +163,17 @@ public class ServiceInventoryResource {
    }

    @PATCH
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Path("/{id}")
    @Operation(summary = "Updates partially a Service")
    @APIResponse(
            responseCode = "200",
            description = "Updated",
            content =
                    @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = Service.class)))
                    @Content(
                            mediaType = APPLICATION_JSON,
                            schema = @Schema(implementation = ServiceResponse.class)))
    @APIResponse(
            responseCode = "400",
            description = "Bad Request",
@@ -204,15 +214,12 @@ public class ServiceInventoryResource {
    }

    @DELETE
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{id}")
    @Operation(
            summary = "Deletes a Service by ID",
            description = "This operation deletes a Service entity.")
    @APIResponse(
            responseCode = "204",
            description = "Deleted",
            content =
                    @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = Service.class)))
    @APIResponse(responseCode = "204", description = "Deleted")
    @APIResponse(
            responseCode = "404",
            description = "Not Found",
@@ -229,6 +236,7 @@ public class ServiceInventoryResource {

    @GET
    @Path("/count")
    @Produces(MediaType.APPLICATION_JSON)
    @Operation(
            summary = "Count of Services",
            description = "This operation counts the total number of Services.")
Loading