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") @Schema(name = "AttachmentData")
public record JsonAttachmentData( public record JsonAttachmentData(
String data @Schema(required = true) String data
) {} ) {}

View File

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

View File

@ -3,7 +3,7 @@ package org.asamk.signal.json;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "Error") @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) { public static JsonError from(Throwable exception) {
return new JsonError(exception.getMessage(), exception.getClass().getSimpleName()); return new JsonError(exception.getMessage(), exception.getClass().getSimpleName());

View File

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

View File

@ -7,7 +7,10 @@ import java.util.UUID;
@Schema(name = "SyncReadMessage") @Schema(name = "SyncReadMessage")
record JsonSyncReadMessage( 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) { static JsonSyncReadMessage from(MessageEnvelope.Sync.Read readMessage) {

View File

@ -8,7 +8,9 @@ import org.asamk.signal.manager.api.MessageEnvelope;
@Schema(name = "TypingMessage") @Schema(name = "TypingMessage")
record JsonTypingMessage( 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) { static JsonTypingMessage from(MessageEnvelope.Typing typingMessage) {