Remove @JsonProperty(required = true)

This commit is contained in:
Era Dorta 2026-03-07 00:30:36 +01:00
parent 1b3c898415
commit 6135dae301
39 changed files with 169 additions and 169 deletions

View File

@ -9,9 +9,9 @@ import java.util.UUID;
@JsonSchema(title = "AdminDelete")
public record JsonAdminDelete(
@Deprecated String targetAuthor,
@JsonProperty(required = true) String targetAuthorNumber,
@JsonProperty(required = true) String targetAuthorUuid,
@JsonProperty(required = true) long targetSentTimestamp
String targetAuthorNumber,
String targetAuthorUuid,
long targetSentTimestamp
) {
static JsonAdminDelete from(MessageEnvelope.Data.AdminDelete adminDelete) {

View File

@ -7,14 +7,14 @@ import org.asamk.signal.manager.api.MessageEnvelope;
@JsonSchema(title = "Attachment")
record JsonAttachment(
@JsonProperty(required = true) String contentType,
@JsonProperty(required = true) String filename,
@JsonProperty(required = true) String id,
@JsonProperty(required = true) Long size,
@JsonProperty(required = true) Integer width,
@JsonProperty(required = true) Integer height,
@JsonProperty(required = true) String caption,
@JsonProperty(required = true) Long uploadTimestamp
String contentType,
String filename,
String id,
Long size,
Integer width,
Integer height,
String caption,
Long uploadTimestamp
) {
static JsonAttachment from(MessageEnvelope.Data.Attachment attachment) {

View File

@ -6,5 +6,5 @@ import io.micronaut.jsonschema.JsonSchema;
@JsonSchema(title = "AttachmentData")
public record JsonAttachmentData(
@JsonProperty(required = true) String data
String data
) {}

View File

@ -27,9 +27,9 @@ record JsonCallMessage(
}
record Offer(
@JsonProperty(required = true) long id,
@JsonProperty(required = true) String type,
@JsonProperty(required = true) String opaque
long id,
String type,
String opaque
) {
public static Offer from(final MessageEnvelope.Call.Offer offer) {
@ -38,8 +38,8 @@ record JsonCallMessage(
}
public record Answer(
@JsonProperty(required = true) long id,
@JsonProperty(required = true) String opaque
long id,
String opaque
) {
public static Answer from(final MessageEnvelope.Call.Answer answer) {
@ -47,7 +47,7 @@ record JsonCallMessage(
}
}
public record Busy(@JsonProperty(required = true) long id) {
public record Busy(long id) {
public static Busy from(final MessageEnvelope.Call.Busy busy) {
return new Busy(busy.id());
@ -55,9 +55,9 @@ record JsonCallMessage(
}
public record Hangup(
@JsonProperty(required = true) long id,
@JsonProperty(required = true) String type,
@JsonProperty(required = true) int deviceId
long id,
String type,
int deviceId
) {
public static Hangup from(final MessageEnvelope.Call.Hangup hangup) {
@ -66,8 +66,8 @@ record JsonCallMessage(
}
public record IceUpdate(
@JsonProperty(required = true) long id,
@JsonProperty(required = true) String opaque
long id,
String opaque
) {
public static IceUpdate from(final MessageEnvelope.Call.IceUpdate iceUpdate) {

View File

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

View File

@ -8,15 +8,15 @@ import org.asamk.signal.util.Util;
@JsonSchema(title = "ContactAddress")
public record JsonContactAddress(
@JsonProperty(required = true) String type,
@JsonProperty(required = true) String label,
@JsonProperty(required = true) String street,
@JsonProperty(required = true) String pobox,
@JsonProperty(required = true) String neighborhood,
@JsonProperty(required = true) String city,
@JsonProperty(required = true) String region,
@JsonProperty(required = true) String postcode,
@JsonProperty(required = true) String country
String type,
String label,
String street,
String pobox,
String neighborhood,
String city,
String region,
String postcode,
String country
) {
static JsonContactAddress from(MessageEnvelope.Data.SharedContact.Address address) {

View File

@ -7,8 +7,8 @@ import org.asamk.signal.manager.api.MessageEnvelope;
@JsonSchema(title = "ContactAvatar")
public record JsonContactAvatar(
@JsonProperty(required = true) JsonAttachment attachment,
@JsonProperty(required = true) boolean isProfile
JsonAttachment attachment,
boolean isProfile
) {
static JsonContactAvatar from(MessageEnvelope.Data.SharedContact.Avatar avatar) {

View File

@ -8,9 +8,9 @@ import org.asamk.signal.util.Util;
@JsonSchema(title = "ContactEmail")
public record JsonContactEmail(
@JsonProperty(required = true) String value,
@JsonProperty(required = true) String type,
@JsonProperty(required = true) String label
String value,
String type,
String label
) {
static JsonContactEmail from(MessageEnvelope.Data.SharedContact.Email email) {

View File

@ -8,12 +8,12 @@ import org.asamk.signal.util.Util;
@JsonSchema(title = "ContactName")
public record JsonContactName(
@JsonProperty(required = true) String nickname,
@JsonProperty(required = true) String given,
@JsonProperty(required = true) String family,
@JsonProperty(required = true) String prefix,
@JsonProperty(required = true) String suffix,
@JsonProperty(required = true) String middle
String nickname,
String given,
String family,
String prefix,
String suffix,
String middle
) {
static JsonContactName from(MessageEnvelope.Data.SharedContact.Name name) {

View File

@ -8,9 +8,9 @@ import org.asamk.signal.util.Util;
@JsonSchema(title = "ContactPhone")
public record JsonContactPhone(
@JsonProperty(required = true) String value,
@JsonProperty(required = true) String type,
@JsonProperty(required = true) String label
String value,
String type,
String label
) {
static JsonContactPhone from(MessageEnvelope.Data.SharedContact.Phone phone) {

View File

@ -12,9 +12,9 @@ import java.util.List;
@JsonSchema(title = "DataMessage")
record JsonDataMessage(
@JsonProperty(required = true) long timestamp,
@JsonProperty(required = true) String message,
@JsonProperty(required = true) Integer expiresInSeconds,
long timestamp,
String message,
Integer expiresInSeconds,
@JsonInclude(JsonInclude.Include.NON_NULL) Boolean isExpirationUpdate,
@JsonInclude(JsonInclude.Include.NON_NULL) Boolean viewOnce,
@JsonInclude(JsonInclude.Include.NON_NULL) JsonReaction reaction,

View File

@ -8,8 +8,8 @@ import org.asamk.signal.manager.api.MessageEnvelope;
@JsonSchema(title = "EditMessage")
record JsonEditMessage(
@JsonProperty(required = true) long targetSentTimestamp,
@JsonProperty(required = true) JsonDataMessage dataMessage
long targetSentTimestamp,
JsonDataMessage dataMessage
) {
static JsonEditMessage from(MessageEnvelope.Edit editMessage, Manager m) {

View File

@ -5,7 +5,7 @@ import io.micronaut.jsonschema.JsonSchema;
@JsonSchema(title = "Error")
public record JsonError(@JsonProperty(required = true) String message, @JsonProperty(required = true) String type) {
public record JsonError(String message, String type) {
public static JsonError from(Throwable exception) {
return new JsonError(exception.getMessage(), exception.getClass().getSimpleName());

View File

@ -8,10 +8,10 @@ import org.asamk.signal.manager.api.MessageEnvelope;
@JsonSchema(title = "GroupInfo")
record JsonGroupInfo(
@JsonProperty(required = true) String groupId,
@JsonProperty(required = true) String groupName,
@JsonProperty(required = true) int revision,
@JsonProperty(required = true) String type
String groupId,
String groupName,
int revision,
String type
) {
static JsonGroupInfo from(MessageEnvelope.Data.GroupContext groupContext, Manager m) {

View File

@ -10,10 +10,10 @@ import java.util.UUID;
@JsonSchema(title = "Mention")
public record JsonMention(
@Deprecated String name,
@JsonProperty(required = true) String number,
@JsonProperty(required = true) String uuid,
@JsonProperty(required = true) int start,
@JsonProperty(required = true) int length
String number,
String uuid,
int start,
int length
) {
static JsonMention from(MessageEnvelope.Data.Mention mention) {

View File

@ -16,13 +16,13 @@ import java.util.UUID;
@JsonSchema(title = "MessageEnvelope")
public record JsonMessageEnvelope(
@Deprecated String source,
@JsonProperty(required = true) String sourceNumber,
@JsonProperty(required = true) String sourceUuid,
@JsonProperty(required = true) String sourceName,
@JsonProperty(required = true) Integer sourceDevice,
@JsonProperty(required = true) long timestamp,
@JsonProperty(required = true) long serverReceivedTimestamp,
@JsonProperty(required = true) long serverDeliveredTimestamp,
String sourceNumber,
String sourceUuid,
String sourceName,
Integer sourceDevice,
long timestamp,
long serverReceivedTimestamp,
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,8 +7,8 @@ import org.asamk.signal.manager.api.MessageEnvelope;
@JsonSchema(title = "Payment")
public record JsonPayment(
@JsonProperty(required = true) String note,
@JsonProperty(required = true) byte[] receipt
String note,
byte[] receipt
) {
static JsonPayment from(MessageEnvelope.Data.Payment payment) {

View File

@ -10,10 +10,10 @@ import java.util.UUID;
@JsonSchema(title = "PinMessage")
public record JsonPinMessage(
@Deprecated String targetAuthor,
@JsonProperty(required = true) String targetAuthorNumber,
@JsonProperty(required = true) String targetAuthorUuid,
@JsonProperty(required = true) long targetSentTimestamp,
@JsonProperty(required = true) long pinDurationSeconds
String targetAuthorNumber,
String targetAuthorUuid,
long targetSentTimestamp,
long pinDurationSeconds
) {
static JsonPinMessage from(MessageEnvelope.Data.PinMessage pinMessage) {

View File

@ -9,9 +9,9 @@ import java.util.List;
@JsonSchema(title = "PollCreate")
public record JsonPollCreate(
@JsonProperty(required = true) String question,
@JsonProperty(required = true) boolean allowMultiple,
@JsonProperty(required = true) List<String> options
String question,
boolean allowMultiple,
List<String> options
) {
static JsonPollCreate from(MessageEnvelope.Data.PollCreate pollCreate) {

View File

@ -6,7 +6,7 @@ import io.micronaut.jsonschema.JsonSchema;
import org.asamk.signal.manager.api.MessageEnvelope;
@JsonSchema(title = "PollTerminate")
public record JsonPollTerminate(@JsonProperty(required = true) long targetSentTimestamp) {
public record JsonPollTerminate(long targetSentTimestamp) {
static JsonPollTerminate from(MessageEnvelope.Data.PollTerminate pollTerminate) {
final var targetSentTimestamp = pollTerminate.targetSentTimestamp();

View File

@ -11,11 +11,11 @@ import java.util.UUID;
@JsonSchema(title = "PollVote")
public record JsonPollVote(
@Deprecated String author,
@JsonProperty(required = true) String authorNumber,
@JsonProperty(required = true) String authorUuid,
@JsonProperty(required = true) long targetSentTimestamp,
@JsonProperty(required = true) List<Integer> optionIndexes,
@JsonProperty(required = true) int voteCount
String authorNumber,
String authorUuid,
long targetSentTimestamp,
List<Integer> optionIndexes,
int voteCount
) {
static JsonPollVote from(MessageEnvelope.Data.PollVote pollVote) {

View File

@ -7,10 +7,10 @@ import org.asamk.signal.manager.api.MessageEnvelope;
@JsonSchema(title = "Preview")
public record JsonPreview(
@JsonProperty(required = true) String url,
@JsonProperty(required = true) String title,
@JsonProperty(required = true) String description,
@JsonProperty(required = true) JsonAttachment image
String url,
String title,
String description,
JsonAttachment image
) {
static JsonPreview from(MessageEnvelope.Data.Preview preview) {

View File

@ -11,13 +11,13 @@ import java.util.UUID;
@JsonSchema(title = "Quote")
public record JsonQuote(
@JsonProperty(required = true) long id,
long id,
@Deprecated String author,
@JsonProperty(required = true) String authorNumber,
@JsonProperty(required = true) String authorUuid,
@JsonProperty(required = true) String text,
String authorNumber,
String authorUuid,
String text,
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonMention> mentions,
@JsonProperty(required = true) List<JsonQuotedAttachment> attachments,
List<JsonQuotedAttachment> attachments,
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonTextStyle> textStyles
) {

View File

@ -8,8 +8,8 @@ import org.asamk.signal.manager.api.MessageEnvelope;
@JsonSchema(title = "QuotedAttachment")
public record JsonQuotedAttachment(
@JsonProperty(required = true) String contentType,
@JsonProperty(required = true) String filename,
String contentType,
String filename,
@JsonInclude(JsonInclude.Include.NON_NULL) JsonAttachment thumbnail
) {

View File

@ -9,12 +9,12 @@ import java.util.UUID;
@JsonSchema(title = "Reaction")
public record JsonReaction(
@JsonProperty(required = true) String emoji,
String emoji,
@Deprecated String targetAuthor,
@JsonProperty(required = true) String targetAuthorNumber,
@JsonProperty(required = true) String targetAuthorUuid,
@JsonProperty(required = true) long targetSentTimestamp,
@JsonProperty(required = true) boolean isRemove
String targetAuthorNumber,
String targetAuthorUuid,
long targetSentTimestamp,
boolean isRemove
) {
static JsonReaction from(MessageEnvelope.Data.Reaction reaction) {

View File

@ -9,11 +9,11 @@ import java.util.List;
@JsonSchema(title = "ReceiptMessage")
record JsonReceiptMessage(
@JsonProperty(required = true) long when,
@JsonProperty(required = true) boolean isDelivery,
@JsonProperty(required = true) boolean isRead,
@JsonProperty(required = true) boolean isViewed,
@JsonProperty(required = true) List<Long> timestamps
long when,
boolean isDelivery,
boolean isRead,
boolean isViewed,
List<Long> timestamps
) {
static JsonReceiptMessage from(MessageEnvelope.Receipt receiptMessage) {

View File

@ -9,9 +9,9 @@ import java.util.UUID;
@JsonSchema(title = "RecipientAddress")
public record JsonRecipientAddress(
@JsonProperty(required = true) String uuid,
@JsonProperty(required = true) String number,
@JsonProperty(required = true) String username
String uuid,
String number,
String username
) {
public static JsonRecipientAddress from(RecipientAddress address) {

View File

@ -4,4 +4,4 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import io.micronaut.jsonschema.JsonSchema;
@JsonSchema(title = "RemoteDelete")
record JsonRemoteDelete(@JsonProperty(required = true) long timestamp) {}
record JsonRemoteDelete(long timestamp) {}

View File

@ -9,9 +9,9 @@ import org.asamk.signal.manager.api.SendMessageResult;
@JsonSchema(title = "SendMessageResult")
public record JsonSendMessageResult(
@JsonProperty(required = true) JsonRecipientAddress recipientAddress,
JsonRecipientAddress recipientAddress,
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId,
@JsonProperty(required = true) Type type,
Type type,
@JsonInclude(JsonInclude.Include.NON_NULL) String token,
@JsonInclude(JsonInclude.Include.NON_NULL) Long retryAfterSeconds
) {

View File

@ -10,12 +10,12 @@ import java.util.List;
@JsonSchema(title = "SharedContact")
public record JsonSharedContact(
@JsonProperty(required = true) JsonContactName name,
JsonContactName name,
@JsonInclude(JsonInclude.Include.NON_NULL) JsonContactAvatar avatar,
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonContactPhone> phone,
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonContactEmail> email,
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonContactAddress> address,
@JsonProperty(required = true) String organization
String organization
) {
static JsonSharedContact from(MessageEnvelope.Data.SharedContact contact) {

View File

@ -8,8 +8,8 @@ import org.asamk.signal.util.Hex;
@JsonSchema(title = "Sticker")
public record JsonSticker(
@JsonProperty(required = true) String packId,
@JsonProperty(required = true) int stickerId
String packId,
int stickerId
) {
static JsonSticker from(MessageEnvelope.Data.Sticker sticker) {

View File

@ -9,9 +9,9 @@ import java.util.UUID;
@JsonSchema(title = "StoryContext")
record JsonStoryContext(
@JsonProperty(required = true) String authorNumber,
@JsonProperty(required = true) String authorUuid,
@JsonProperty(required = true) long sentTimestamp
String authorNumber,
String authorUuid,
long sentTimestamp
) {
static JsonStoryContext from(MessageEnvelope.Data.StoryContext storyContext) {

View File

@ -12,7 +12,7 @@ import java.util.List;
@JsonSchema(title = "StoryMessage")
record JsonStoryMessage(
@JsonProperty(required = true) boolean allowsReplies,
boolean allowsReplies,
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId,
@JsonInclude(JsonInclude.Include.NON_NULL) JsonAttachment fileAttachment,
@JsonInclude(JsonInclude.Include.NON_NULL) TextAttachment textAttachment
@ -26,7 +26,7 @@ record JsonStoryMessage(
}
public record TextAttachment(
@JsonProperty(required = true) String text,
String text,
@JsonInclude(JsonInclude.Include.NON_NULL) String style,
@JsonInclude(JsonInclude.Include.NON_NULL) String textForegroundColor,
@JsonInclude(JsonInclude.Include.NON_NULL) String textBackgroundColor,
@ -46,11 +46,11 @@ record JsonStoryMessage(
}
public record Gradient(
@JsonProperty(required = true) String startColor,
@JsonProperty(required = true) String endColor,
@JsonProperty(required = true) List<String> colors,
@JsonProperty(required = true) List<Float> positions,
@JsonProperty(required = true) Integer angle
String startColor,
String endColor,
List<String> colors,
List<Float> positions,
Integer angle
) {
static Gradient from(MessageEnvelope.Story.TextAttachment.Gradient gradient) {

View File

@ -14,10 +14,10 @@ import java.util.UUID;
@JsonSchema(title = "SyncDataMessage")
record JsonSyncDataMessage(
@Deprecated String destination,
@JsonProperty(required = true) String destinationNumber,
@JsonProperty(required = true) String destinationUuid,
String destinationNumber,
String destinationUuid,
@JsonInclude(JsonInclude.Include.NON_NULL) JsonEditMessage editMessage,
@JsonProperty(required = true) @JsonUnwrapped JsonDataMessage dataMessage
@JsonUnwrapped JsonDataMessage dataMessage
) {
static JsonSyncDataMessage from(MessageEnvelope.Sync.Sent transcriptMessage, Manager m) {

View File

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

View File

@ -10,9 +10,9 @@ import java.util.UUID;
@JsonSchema(title = "SyncStoryMessage")
record JsonSyncStoryMessage(
@JsonProperty(required = true) String destinationNumber,
@JsonProperty(required = true) String destinationUuid,
@JsonProperty(required = true) @JsonUnwrapped JsonStoryMessage dataMessage
String destinationNumber,
String destinationUuid,
@JsonUnwrapped JsonStoryMessage dataMessage
) {
static JsonSyncStoryMessage from(MessageEnvelope.Sync.Sent transcriptMessage) {

View File

@ -7,9 +7,9 @@ import org.asamk.signal.manager.api.TextStyle;
@JsonSchema(title = "TextStyle")
public record JsonTextStyle(
@JsonProperty(required = true) String style,
@JsonProperty(required = true) int start,
@JsonProperty(required = true) int length
String style,
int start,
int length
) {
static JsonTextStyle from(TextStyle textStyle) {

View File

@ -9,8 +9,8 @@ import org.asamk.signal.manager.api.MessageEnvelope;
@JsonSchema(title = "TypingMessage")
record JsonTypingMessage(
@JsonProperty(required = true) String action,
@JsonProperty(required = true) long timestamp,
String action,
long timestamp,
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId
) {

View File

@ -10,9 +10,9 @@ import java.util.UUID;
@JsonSchema(title = "UnpinMessage")
public record JsonUnpinMessage(
@Deprecated String targetAuthor,
@JsonProperty(required = true) String targetAuthorNumber,
@JsonProperty(required = true) String targetAuthorUuid,
@JsonProperty(required = true) long targetSentTimestamp
String targetAuthorNumber,
String targetAuthorUuid,
long targetSentTimestamp
) {
static JsonUnpinMessage from(MessageEnvelope.Data.UnpinMessage unpinMessage) {