Skip to content

Commit

Permalink
Correct improper data types and refine data annotations (#397)
Browse files Browse the repository at this point in the history
Co-authored-by: aliasadidev <[email protected]>
  • Loading branch information
aliasadidev and aliasadidev authored Feb 20, 2024
1 parent f775e91 commit 7d74070
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 59 deletions.
14 changes: 7 additions & 7 deletions src/NATS.Client.JetStream/Models/ConsumerConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ConsumerConfig(string name)

[System.Text.Json.Serialization.JsonPropertyName("opt_start_seq")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong OptStartSeq { get; set; }

[System.Text.Json.Serialization.JsonPropertyName("opt_start_time")]
Expand Down Expand Up @@ -106,7 +106,7 @@ public ConsumerConfig(string name)
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("max_deliver")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(long.MinValue, long.MaxValue)]
public long MaxDeliver { get; set; }

/// <summary>
Expand Down Expand Up @@ -140,15 +140,15 @@ public ConsumerConfig(string name)
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("rate_limit_bps")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
[System.ComponentModel.DataAnnotations.Range(0L, long.MaxValue)]
public long RateLimitBps { get; set; }

/// <summary>
/// The maximum number of messages without acknowledgement that can be outstanding, once this limit is reached message delivery will be suspended
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("max_ack_pending")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(long.MinValue, long.MaxValue)]
public long MaxAckPending { get; set; }

/// <summary>
Expand All @@ -171,7 +171,7 @@ public ConsumerConfig(string name)
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("max_waiting")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(long.MinValue, long.MaxValue)]
public long MaxWaiting { get; set; }

/// <summary>
Expand Down Expand Up @@ -208,7 +208,7 @@ public ConsumerConfig(string name)
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("max_bytes")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(long.MinValue, long.MaxValue)]
public long MaxBytes { get; set; }

/// <summary>
Expand All @@ -231,7 +231,7 @@ public ConsumerConfig(string name)
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("num_replicas")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(long.MinValue, long.MaxValue)]
public long NumReplicas { get; set; }

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/NATS.Client.JetStream/Models/ConsumerGetnextRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public record ConsumerGetnextRequest
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("batch")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(long.MinValue, long.MaxValue)]
public long Batch { get; set; }

/// <summary>
/// Sends at most this many bytes to the requestor, limited by consumer configuration max_bytes
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("max_bytes")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(long.MinValue, long.MaxValue)]
public long MaxBytes { get; set; }

/// <summary>
Expand Down
16 changes: 8 additions & 8 deletions src/NATS.Client.JetStream/Models/ConsumerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,32 +70,32 @@ public record ConsumerInfo
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("num_ack_pending")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
public long NumAckPending { get; set; }
[System.ComponentModel.DataAnnotations.Range(int.MinValue, int.MaxValue)]
public int NumAckPending { get; set; }

/// <summary>
/// The number of redeliveries that have been performed
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("num_redelivered")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
public long NumRedelivered { get; set; }
[System.ComponentModel.DataAnnotations.Range(int.MinValue, int.MaxValue)]
public int NumRedelivered { get; set; }

/// <summary>
/// The number of pull consumers waiting for messages
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("num_waiting")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
public long NumWaiting { get; set; }
[System.ComponentModel.DataAnnotations.Range(int.MinValue, int.MaxValue)]
public int NumWaiting { get; set; }

/// <summary>
/// The number of messages left unconsumed in this Consumer
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("num_pending")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
public long NumPending { get; set; }
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong NumPending { get; set; }

[System.Text.Json.Serialization.JsonPropertyName("cluster")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
Expand Down
2 changes: 1 addition & 1 deletion src/NATS.Client.JetStream/Models/LostStreamData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public record LostStreamData
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("bytes")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
[System.ComponentModel.DataAnnotations.Range(0L, long.MaxValue)]
public long Bytes { get; set; }
}
2 changes: 1 addition & 1 deletion src/NATS.Client.JetStream/Models/PubAckResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public record PubAckResponse
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("seq")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong Seq { get; set; }

/// <summary>
Expand Down
8 changes: 4 additions & 4 deletions src/NATS.Client.JetStream/Models/SequenceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ public record SequenceInfo
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("consumer_seq")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
public long ConsumerSeq { get; set; }
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong ConsumerSeq { get; set; }

/// <summary>
/// The sequence number of the Stream
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("stream_seq")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
public long StreamSeq { get; set; }
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong StreamSeq { get; set; }

/// <summary>
/// The last time a message was delivered or acknowledged (for ack_floor)
Expand Down
8 changes: 4 additions & 4 deletions src/NATS.Client.JetStream/Models/SequencePair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ public record SequencePair
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("consumer_seq")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
public long ConsumerSeq { get; set; }
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong ConsumerSeq { get; set; }

/// <summary>
/// The sequence number of the Stream
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("stream_seq")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
public long StreamSeq { get; set; }
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong StreamSeq { get; set; }
}
2 changes: 1 addition & 1 deletion src/NATS.Client.JetStream/Models/StoredMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public record StoredMessage
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("seq")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong Seq { get; set; }

/// <summary>
Expand Down
14 changes: 7 additions & 7 deletions src/NATS.Client.JetStream/Models/StreamConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,31 @@ public StreamConfig(string name, ICollection<string> subjects)
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("max_consumers")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
public long MaxConsumers { get; set; }
[System.ComponentModel.DataAnnotations.Range(int.MinValue, int.MaxValue)]
public int MaxConsumers { get; set; }

/// <summary>
/// How many messages may be in a Stream, oldest messages will be removed if the Stream exceeds this size. -1 for unlimited.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("max_msgs")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(long.MinValue, long.MaxValue)]
public long MaxMsgs { get; set; }

/// <summary>
/// For wildcard streams ensure that for every unique subject this many messages are kept - a per subject retention limit
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("max_msgs_per_subject")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(int.MinValue, int.MaxValue)]
public long MaxMsgsPerSubject { get; set; }

/// <summary>
/// How big the Stream may be, when the combined stream size exceeds this old messages are removed. -1 for unlimited.
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("max_bytes")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(long.MinValue, long.MinValue)]
public long MaxBytes { get; set; }

/// <summary>
Expand Down Expand Up @@ -130,8 +130,8 @@ public StreamConfig(string name, ICollection<string> subjects)
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("num_replicas")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
public long NumReplicas { get; set; }
[System.ComponentModel.DataAnnotations.Range(int.MinValue, int.MaxValue)]
public int NumReplicas { get; set; }

/// <summary>
/// Disables acknowledging messages that are received by the Stream.
Expand Down
4 changes: 2 additions & 2 deletions src/NATS.Client.JetStream/Models/StreamMsgDeleteRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public record StreamMsgDeleteRequest
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("seq")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
public long Seq { get; set; }
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong Seq { get; set; }

/// <summary>
/// Default will securely remove a message and rewrite the data with random data, set this to true to only remove the message
Expand Down
8 changes: 4 additions & 4 deletions src/NATS.Client.JetStream/Models/StreamPurgeRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public record StreamPurgeRequest
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("seq")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
public long Seq { get; set; }
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong Seq { get; set; }

/// <summary>
/// Ensures this many messages are present after the purge. Can be combined with the subject filter but not the sequence
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("keep")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
public long Keep { get; set; }
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong Keep { get; set; }
}
2 changes: 1 addition & 1 deletion src/NATS.Client.JetStream/Models/StreamPurgeResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public record StreamPurgeResponse
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("purged")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public long Purged { get; set; }
}
2 changes: 1 addition & 1 deletion src/NATS.Client.JetStream/Models/StreamSnapshotRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public record StreamSnapshotRequest
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("chunk_size")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(-9223372036854776000D, 9223372036854776000D)]
[System.ComponentModel.DataAnnotations.Range(long.MinValue, long.MaxValue)]
public long ChunkSize { get; set; }

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/NATS.Client.JetStream/Models/StreamSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public record StreamSource
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("opt_start_seq")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
public long OptStartSeq { get; set; }
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public ulong OptStartSeq { get; set; }

/// <summary>
/// Time stamp to start replicating from
Expand Down
2 changes: 1 addition & 1 deletion src/NATS.Client.JetStream/Models/StreamSourceInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public record StreamSourceInfo
/// </summary>
[System.Text.Json.Serialization.JsonPropertyName("lag")]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.Never)]
[System.ComponentModel.DataAnnotations.Range(0D, 18446744073709552000D)]
[System.ComponentModel.DataAnnotations.Range(ulong.MinValue, ulong.MaxValue)]
public long Lag { get; set; }

/// <summary>
Expand Down
Loading

0 comments on commit 7d74070

Please sign in to comment.