[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.LoggerFactory;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
@ -220,6 +221,7 @@ public class DataResource {
@Path("/upload/")
@Consumes({ MediaType.MULTIPART_FORM_DATA })
@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) {
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
LOGGER.info("===================================================");
@ -243,6 +245,7 @@ public class DataResource {
@PermitTokenInURI
@RolesAllowed("USER")
@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,
@PathParam("id") final Long id) throws Exception {
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
@ -261,6 +264,7 @@ public class DataResource {
@RolesAllowed("USER")
@PermitTokenInURI
@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)
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 {
@ -320,6 +324,7 @@ public class DataResource {
@PermitTokenInURI
@RolesAllowed("USER")
@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,
@PathParam("id") final Long id, @PathParam("name") final String name) throws Exception {
final GenericContext gc = (GenericContext) sc.getUserPrincipal();

View File

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

View File

@ -23,12 +23,11 @@ public class openApiResource extends BaseOpenApiResource {
Application app;
@GET
@Path("swagger.json")
@Produces({ MediaType.APPLICATION_JSON })
@Operation(hidden = true)
@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 {
return getOpenApi(headers, this.config, this.app, uriInfo, "json");
}
}

View File

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

View File

@ -1,6 +1,5 @@
package org.kar.archidata.migration.model;
import org.kar.archidata.annotation.DataComment;
import org.kar.archidata.annotation.DataDefault;
import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.annotation.DataNotRead;
@ -8,33 +7,35 @@ import org.kar.archidata.model.GenericDataSoftDelete;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column;
import jakarta.persistence.Table;
// For logs only
//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")
@DataIfNotExists
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Migration extends GenericDataSoftDelete {
final static int VERSION_MIGRATION = 2;
@DataComment("Name of the migration")
@Schema(description = "Name of the migration")
@Column(length = 256)
public String name;
@DataNotRead
@DataDefault("'2'")
@DataComment("Version of the migration engine")
@Schema(description = "Version of the migration engine")
public Integer version;
@Column(nullable = false)
@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;
@DataComment("index in the migration progression")
@Schema(description = "index in the migration progression")
public Integer stepId = 0;
@DataComment("number of element in the migration")
@Schema(description = "number of element in the migration")
public Integer count;
@DataComment("Log generate by the migration")
@Column(length = 0)
@Schema(description = "Log generate by the migration")
@Column(length = -1)
public String log = "";
}

View File

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

View File

@ -19,7 +19,7 @@ public class GenericData {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@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;
@DataNotRead
@CreationTimestamp