Add missing required = true schemas

This commit is contained in:
Era Dorta 2026-03-02 02:04:24 +01:00
parent 04b7b1e47d
commit a38b7edbdf
6 changed files with 45 additions and 40 deletions

View File

@ -4,5 +4,5 @@ import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "AttachmentData")
public record JsonAttachmentData(
String data
@Schema(required = true) String data
) {}

View File

@ -7,42 +7,42 @@ import java.util.List;
@Schema(name = "Contact")
public record JsonContact(
String number,
String uuid,
String username,
String name,
String givenName,
String familyName,
String nickName,
String nickGivenName,
String nickFamilyName,
String note,
String color,
boolean isBlocked,
boolean isHidden,
int messageExpirationTime,
boolean profileSharing,
boolean unregistered,
JsonProfile profile,
@Schema(required = true) String number,
@Schema(required = true) String uuid,
@Schema(required = true) String username,
@Schema(required = true) String name,
@Schema(required = true) String givenName,
@Schema(required = true) String familyName,
@Schema(required = true) String nickName,
@Schema(required = true) String nickGivenName,
@Schema(required = true) String nickFamilyName,
@Schema(required = true) String note,
@Schema(required = true) String color,
@Schema(required = true) boolean isBlocked,
@Schema(required = true) boolean isHidden,
@Schema(required = true) int messageExpirationTime,
@Schema(required = true) boolean profileSharing,
@Schema(required = true) boolean unregistered,
@Schema(required = true) JsonProfile profile,
@JsonInclude(JsonInclude.Include.NON_NULL) JsonInternal internal
) {
@Schema(name = "Profile")
public record JsonProfile(
long lastUpdateTimestamp,
String givenName,
String familyName,
String about,
String aboutEmoji,
boolean hasAvatar,
String mobileCoinAddress
@Schema(required = true) long lastUpdateTimestamp,
@Schema(required = true) String givenName,
@Schema(required = true) String familyName,
@Schema(required = true) String about,
@Schema(required = true) String aboutEmoji,
@Schema(required = true) boolean hasAvatar,
@Schema(required = true) String mobileCoinAddress
) {}
@Schema(name = "Internal")
public record JsonInternal(
List<String> capabilities,
String unidentifiedAccessMode,
Boolean sharesPhoneNumber,
Boolean discoverableByPhonenumber
@Schema(required = true) List<String> capabilities,
@Schema(required = true) String unidentifiedAccessMode,
@Schema(required = true) Boolean sharesPhoneNumber,
@Schema(required = true) Boolean discoverableByPhonenumber
) {}
}

View File

@ -3,7 +3,7 @@ package org.asamk.signal.json;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Error")
public record JsonError(String message, String type) {
public record JsonError(@Schema(required = true) String message, @Schema(required = true) String type) {
public static JsonError from(Throwable exception) {
return new JsonError(exception.getMessage(), exception.getClass().getSimpleName());

View File

@ -13,14 +13,14 @@ import java.util.UUID;
@Schema(name = "MessageEnvelope")
public record JsonMessageEnvelope(
@Deprecated String source,
String sourceNumber,
String sourceUuid,
String sourceName,
Integer sourceDevice,
long timestamp,
long serverReceivedTimestamp,
long serverDeliveredTimestamp,
@Schema(required = true) @Deprecated String source,
@Schema(required = true) String sourceNumber,
@Schema(required = true) String sourceUuid,
@Schema(required = true) String sourceName,
@Schema(required = true) Integer sourceDevice,
@Schema(required = true) long timestamp,
@Schema(required = true) long serverReceivedTimestamp,
@Schema(required = true) long serverDeliveredTimestamp,
@JsonInclude(JsonInclude.Include.NON_NULL) JsonDataMessage dataMessage,
@JsonInclude(JsonInclude.Include.NON_NULL) JsonEditMessage editMessage,
@JsonInclude(JsonInclude.Include.NON_NULL) JsonStoryMessage storyMessage,

View File

@ -7,7 +7,10 @@ import java.util.UUID;
@Schema(name = "SyncReadMessage")
record JsonSyncReadMessage(
@Deprecated String sender, String senderNumber, String senderUuid, long timestamp
@Schema(required = true) @Deprecated String sender,
@Schema(required = true) String senderNumber,
@Schema(required = true) String senderUuid,
@Schema(required = true) long timestamp
) {
static JsonSyncReadMessage from(MessageEnvelope.Sync.Read readMessage) {

View File

@ -8,7 +8,9 @@ import org.asamk.signal.manager.api.MessageEnvelope;
@Schema(name = "TypingMessage")
record JsonTypingMessage(
String action, long timestamp, @JsonInclude(JsonInclude.Include.NON_NULL) String groupId
@Schema(required = true) String action,
@Schema(required = true) long timestamp,
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId
) {
static JsonTypingMessage from(MessageEnvelope.Typing typingMessage) {