[DEV] update comment of swagger

This commit is contained in:
Edouard DUPIN 2023-12-31 09:31:34 +01:00
parent 5b7fdce349
commit 6ac2f1dcfc
7 changed files with 31 additions and 23 deletions

View File

@ -31,6 +31,7 @@ import org.kar.archidata.tools.ConfigBaseVariable;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.security.RolesAllowed; import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.Consumes; import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET; import jakarta.ws.rs.GET;
@ -220,6 +221,7 @@ public class DataResource {
@Path("/upload/") @Path("/upload/")
@Consumes({ MediaType.MULTIPART_FORM_DATA }) @Consumes({ MediaType.MULTIPART_FORM_DATA })
@RolesAllowed("ADMIN") @RolesAllowed("ADMIN")
@Operation(description = "Insert a new data in the data environment", tags = "SYSTEM")
public Response uploadFile(@Context final SecurityContext sc, @FormDataParam("file") final InputStream fileInputStream, @FormDataParam("file") final FormDataContentDisposition fileMetaData) { public Response uploadFile(@Context final SecurityContext sc, @FormDataParam("file") final InputStream fileInputStream, @FormDataParam("file") final FormDataContentDisposition fileMetaData) {
final GenericContext gc = (GenericContext) sc.getUserPrincipal(); final GenericContext gc = (GenericContext) sc.getUserPrincipal();
LOGGER.info("==================================================="); LOGGER.info("===================================================");
@ -243,6 +245,7 @@ public class DataResource {
@PermitTokenInURI @PermitTokenInURI
@RolesAllowed("USER") @RolesAllowed("USER")
@Produces(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_OCTET_STREAM)
@Operation(description = "Get back some data from the data environment", tags = "SYSTEM")
public Response retriveDataId(@Context final SecurityContext sc, @QueryParam(HttpHeaders.AUTHORIZATION) final String token, @HeaderParam("Range") final String range, public Response retriveDataId(@Context final SecurityContext sc, @QueryParam(HttpHeaders.AUTHORIZATION) final String token, @HeaderParam("Range") final String range,
@PathParam("id") final Long id) throws Exception { @PathParam("id") final Long id) throws Exception {
final GenericContext gc = (GenericContext) sc.getUserPrincipal(); final GenericContext gc = (GenericContext) sc.getUserPrincipal();
@ -261,6 +264,7 @@ public class DataResource {
@RolesAllowed("USER") @RolesAllowed("USER")
@PermitTokenInURI @PermitTokenInURI
@Produces(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_OCTET_STREAM)
@Operation(description = "Get a thumbnail of from the data environment (if resize is possible)", tags = "SYSTEM")
// @CacheMaxAge(time = 10, unit = TimeUnit.DAYS) // @CacheMaxAge(time = 10, unit = TimeUnit.DAYS)
public Response retriveDataThumbnailId(@Context final SecurityContext sc, @QueryParam(HttpHeaders.AUTHORIZATION) final String token, @HeaderParam("Range") final String range, public Response retriveDataThumbnailId(@Context final SecurityContext sc, @QueryParam(HttpHeaders.AUTHORIZATION) final String token, @HeaderParam("Range") final String range,
@PathParam("id") final Long id) throws Exception { @PathParam("id") final Long id) throws Exception {
@ -320,6 +324,7 @@ public class DataResource {
@PermitTokenInURI @PermitTokenInURI
@RolesAllowed("USER") @RolesAllowed("USER")
@Produces(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_OCTET_STREAM)
@Operation(description = "Get back some data from the data environment (with a beautifull name (permit download with basic name)", tags = "SYSTEM")
public Response retriveDataFull(@Context final SecurityContext sc, @QueryParam(HttpHeaders.AUTHORIZATION) final String token, @HeaderParam("Range") final String range, public Response retriveDataFull(@Context final SecurityContext sc, @QueryParam(HttpHeaders.AUTHORIZATION) final String token, @HeaderParam("Range") final String range,
@PathParam("id") final Long id, @PathParam("name") final String name) throws Exception { @PathParam("id") final Long id, @PathParam("name") final String name) throws Exception {
final GenericContext gc = (GenericContext) sc.getUserPrincipal(); final GenericContext gc = (GenericContext) sc.getUserPrincipal();

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.security.PermitAll; import jakarta.annotation.security.PermitAll;
import jakarta.ws.rs.GET; import jakarta.ws.rs.GET;
import jakarta.ws.rs.NotFoundException; import jakarta.ws.rs.NotFoundException;
@ -88,6 +89,7 @@ public class FrontGeneric {
@GET @GET
@PermitAll() @PermitAll()
@Operation(description = "Retrieve native element (index)", tags = "SYSTEM")
// @Produces(MediaType.APPLICATION_OCTET_STREAM) // @Produces(MediaType.APPLICATION_OCTET_STREAM)
// @CacheMaxAge(time = 1, unit = TimeUnit.DAYS) // @CacheMaxAge(time = 1, unit = TimeUnit.DAYS)
public Response retrive0() throws Exception { public Response retrive0() throws Exception {
@ -97,6 +99,7 @@ public class FrontGeneric {
@GET @GET
@Path("{any: .*}") @Path("{any: .*}")
@PermitAll() @PermitAll()
@Operation(description = "Get specific file from the front environment", tags = "SYSTEM")
// @Produces(MediaType.APPLICATION_OCTET_STREAM) // @Produces(MediaType.APPLICATION_OCTET_STREAM)
// @CacheMaxAge(time = 10, unit = TimeUnit.DAYS) // @CacheMaxAge(time = 10, unit = TimeUnit.DAYS)
public Response retrive1(@PathParam("any") final List<PathSegment> segments) throws Exception { public Response retrive1(@PathParam("any") final List<PathSegment> segments) throws Exception {

View File

@ -23,12 +23,11 @@ public class openApiResource extends BaseOpenApiResource {
Application app; Application app;
@GET @GET
@Path("swagger.json")
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
@Operation(hidden = true)
@PermitAll @PermitAll
@Operation(hidden = true, description = "Get the OPEN-API description", tags = "SYSTEM")
public Response getDescription(@Context final HttpHeaders headers, @Context final UriInfo uriInfo) throws Exception { public Response getDescription(@Context final HttpHeaders headers, @Context final UriInfo uriInfo) throws Exception {
return getOpenApi(headers, this.config, this.app, uriInfo, "json"); return getOpenApi(headers, this.config, this.app, uriInfo, "json");
} }
} }

View File

@ -1,11 +1,11 @@
package org.kar.archidata.dataAccess.addOn.model; package org.kar.archidata.dataAccess.addOn.model;
import org.kar.archidata.annotation.DataComment; import org.kar.archidata.model.GenericData;
import org.kar.archidata.model.GenericDataSoftDelete;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column; import jakarta.persistence.Column;
public class LinkTable extends GenericDataSoftDelete { public class LinkTable extends GenericData {
public LinkTable() { public LinkTable() {
// nothing to do... // nothing to do...
} }
@ -15,10 +15,10 @@ public class LinkTable extends GenericDataSoftDelete {
this.object2Id = object2Id; this.object2Id = object2Id;
} }
@DataComment("Object reference 1") @Schema(description = "Object reference 1")
@Column(nullable = false) @Column(nullable = false)
public Long object1Id; public Long object1Id;
@DataComment("Object reference 2") @Schema(description = "Object reference 2")
@Column(nullable = false) @Column(nullable = false)
public Long object2Id; public Long object2Id;

View File

@ -1,6 +1,5 @@
package org.kar.archidata.migration.model; package org.kar.archidata.migration.model;
import org.kar.archidata.annotation.DataComment;
import org.kar.archidata.annotation.DataDefault; import org.kar.archidata.annotation.DataDefault;
import org.kar.archidata.annotation.DataIfNotExists; import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.annotation.DataNotRead; import org.kar.archidata.annotation.DataNotRead;
@ -8,33 +7,35 @@ import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Table; import jakarta.persistence.Table;
// For logs only // For logs only
//public static final String TABLE_NAME = "KAR_migration"; //public static final String TABLE_NAME = "KAR_migration";
// TODO: Add a migration Hash to be sure that the current migration init is correct and has not change...
@Table(name = "KAR_migration") @Table(name = "KAR_migration")
@DataIfNotExists @DataIfNotExists
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class Migration extends GenericDataSoftDelete { public class Migration extends GenericDataSoftDelete {
final static int VERSION_MIGRATION = 2; final static int VERSION_MIGRATION = 2;
@DataComment("Name of the migration") @Schema(description = "Name of the migration")
@Column(length = 256) @Column(length = 256)
public String name; public String name;
@DataNotRead @DataNotRead
@DataDefault("'2'") @DataDefault("'2'")
@DataComment("Version of the migration engine") @Schema(description = "Version of the migration engine")
public Integer version; public Integer version;
@Column(nullable = false) @Column(nullable = false)
@DataDefault("'0'") @DataDefault("'0'")
@DataComment("if the migration is well terminated or not") @Schema(description = "if the migration is well terminated or not")
public Boolean terminated = false; public Boolean terminated = false;
@DataComment("index in the migration progression") @Schema(description = "index in the migration progression")
public Integer stepId = 0; public Integer stepId = 0;
@DataComment("number of element in the migration") @Schema(description = "number of element in the migration")
public Integer count; public Integer count;
@DataComment("Log generate by the migration") @Schema(description = "Log generate by the migration")
@Column(length = 0) @Column(length = -1)
public String log = ""; public String log = "";
} }

View File

@ -1,12 +1,12 @@
package org.kar.archidata.migration.model; package org.kar.archidata.migration.model;
import org.kar.archidata.annotation.DataComment;
import org.kar.archidata.annotation.DataDefault; import org.kar.archidata.annotation.DataDefault;
import org.kar.archidata.annotation.DataIfNotExists; import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.model.GenericDataSoftDelete; import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column; import jakarta.persistence.Column;
import jakarta.persistence.Table; import jakarta.persistence.Table;
@ -18,18 +18,18 @@ import jakarta.persistence.Table;
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
public class Migration1 extends GenericDataSoftDelete { public class Migration1 extends GenericDataSoftDelete {
final static int VERSION_MIGRATION = 1; final static int VERSION_MIGRATION = 1;
@DataComment("Name of the migration") @Schema(description = "Name of the migration")
@Column(length = 256) @Column(length = 256)
public String name; public String name;
@Column(nullable = false) @Column(nullable = false)
@DataDefault("'0'") @DataDefault("'0'")
@DataComment("if the migration is well terminated or not") @Schema(description = "if the migration is well terminated or not")
public Boolean terminated = false; public Boolean terminated = false;
@DataComment("index in the migration progression") @Schema(description = "index in the migration progression")
public Integer stepId = 0; public Integer stepId = 0;
@DataComment("number of element in the migration") @Schema(description = "number of element in the migration")
public Integer count; public Integer count;
@DataComment("Log generate by the migration") @Schema(description = "Log generate by the migration")
@Column(length = 0) @Column(length = 0)
public String log = ""; public String log = "";
} }

View File

@ -19,7 +19,7 @@ public class GenericData {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false, unique = true) @Column(nullable = false, unique = true)
@Schema(description = "Unique Id of the object", required = false, readOnly = true) @Schema(description = "Unique Id of the object", required = false, readOnly = true, example = "123456")
public Long id = null; public Long id = null;
@DataNotRead @DataNotRead
@CreationTimestamp @CreationTimestamp