[FIX] annotation in the common model
This commit is contained in:
parent
44df939873
commit
c627484b49
@ -13,7 +13,7 @@ import java.lang.annotation.Target;
|
||||
* to ensure precise validation and documentation of method parameters.
|
||||
*
|
||||
* <p>Usage:
|
||||
* - Target: This annotation can be applied to parameters.
|
||||
* - Target: This annotation can be applied to field.
|
||||
* - Retention: The annotation is retained at runtime, allowing it to be
|
||||
* processed by frameworks or libraries that handle code generation logic.
|
||||
*
|
||||
@ -33,7 +33,7 @@ import java.lang.annotation.Target;
|
||||
*
|
||||
* In this example, the `username` field in the `User` class is explicitly marked as non-null in the generated API.
|
||||
*/
|
||||
@Target({ ElementType.PARAMETER })
|
||||
@Target({ ElementType.FIELD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface ApiNotNull {
|
||||
/**
|
||||
|
@ -2,6 +2,8 @@ package org.kar.archidata.model;
|
||||
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiAccessLimitation;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiGenerationMode;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiNotNull;
|
||||
import org.kar.archidata.annotation.checker.ReadOnlyField;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Column;
|
||||
@ -15,6 +17,8 @@ public class GenericData extends GenericTiming {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(nullable = false, unique = true)
|
||||
@Schema(description = "Unique Id of the object", example = "123456")
|
||||
@ReadOnlyField
|
||||
@ApiNotNull
|
||||
@ApiAccessLimitation(creatable = false, updatable = false)
|
||||
public Long id = null;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import org.kar.archidata.annotation.DataDeleted;
|
||||
import org.kar.archidata.annotation.DataNotRead;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiAccessLimitation;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiGenerationMode;
|
||||
import org.kar.archidata.annotation.checker.ReadOnlyField;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Nullable;
|
||||
@ -18,6 +19,7 @@ public class GenericDataSoftDelete extends GenericData {
|
||||
@DataDeleted
|
||||
@Schema(description = "Deleted state", hidden = true)
|
||||
@Nullable
|
||||
@ReadOnlyField
|
||||
@ApiAccessLimitation(creatable = false, updatable = false)
|
||||
public Boolean deleted = null;
|
||||
}
|
||||
|
@ -3,11 +3,12 @@ package org.kar.archidata.model;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiAccessLimitation;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiGenerationMode;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiNotNull;
|
||||
import org.kar.archidata.annotation.checker.ReadOnlyField;
|
||||
|
||||
import dev.morphia.annotations.Id;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@ApiGenerationMode(create = true, update = true)
|
||||
public class OIDGenericData extends GenericTiming {
|
||||
@ -15,7 +16,8 @@ public class OIDGenericData extends GenericTiming {
|
||||
@jakarta.persistence.Id
|
||||
@Column(nullable = false, unique = true, name = "_id")
|
||||
@Schema(description = "Unique ObjectID of the object", example = "65161616841351")
|
||||
@NotNull
|
||||
@ReadOnlyField
|
||||
@ApiNotNull
|
||||
@ApiAccessLimitation(creatable = false, updatable = false)
|
||||
public ObjectId oid = null;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import org.kar.archidata.annotation.DataDeleted;
|
||||
import org.kar.archidata.annotation.DataNotRead;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiAccessLimitation;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiGenerationMode;
|
||||
import org.kar.archidata.annotation.checker.ReadOnlyField;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.annotation.Nullable;
|
||||
@ -18,6 +19,7 @@ public class OIDGenericDataSoftDelete extends OIDGenericData {
|
||||
@DataDeleted
|
||||
@Schema(description = "Deleted state", hidden = true)
|
||||
@Nullable
|
||||
@ReadOnlyField
|
||||
@ApiAccessLimitation(creatable = false, updatable = false)
|
||||
public Boolean deleted = null;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.UUID;
|
||||
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiAccessLimitation;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiGenerationMode;
|
||||
import org.kar.archidata.annotation.apiGenerator.ApiNotNull;
|
||||
import org.kar.archidata.annotation.checker.ReadOnlyField;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@ -18,6 +19,7 @@ public class UUIDGenericData extends GenericTiming {
|
||||
@Column(nullable = false, unique = true)
|
||||
@Schema(description = "Unique UUID of the object", example = "e6b33c1c-d24d-11ee-b616-02420a030102")
|
||||
@ReadOnlyField
|
||||
@ApiNotNull
|
||||
@ApiAccessLimitation(creatable = false, updatable = false)
|
||||
public UUID uuid = null;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class JwtPayload {
|
||||
public String iss;
|
||||
// Access Right Map<application, Map< section, right>>
|
||||
@NotNull
|
||||
public Map<String, Map<String, Long>> right;
|
||||
public Map<@NotNull String, Map<@NotNull String, @NotNull Long>> right;
|
||||
// user name
|
||||
@NotNull
|
||||
public String login;
|
||||
|
@ -1,11 +1,14 @@
|
||||
package org.kar.archidata.model.token;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public class JwtToken {
|
||||
@NotNull
|
||||
@Valid
|
||||
public JwtHeader header;
|
||||
@NotNull
|
||||
@Valid
|
||||
public JwtPayload payload;
|
||||
@NotNull
|
||||
public String signature;
|
||||
|
Loading…
x
Reference in New Issue
Block a user