Skip to content

Commit

Permalink
fix: updated topic configuration data types
Browse files Browse the repository at this point in the history
  • Loading branch information
gokerakc authored and VisualBean committed Feb 14, 2024
1 parent 4a6c6a8 commit eace86d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/LEGO.AsyncAPI.Bindings/Kafka/KafkaChannelBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public class KafkaChannelBinding : ChannelBinding<KafkaChannelBinding>
private static FixedFieldMap<TopicConfigurationObject> kafkaChannelTopicConfigurationObjectFixedFields = new ()
{
{ "cleanup.policy", (a, n) => { a.CleanupPolicy = n.CreateSimpleList(s => s.GetScalarValue()); } },
{ "retention.ms", (a, n) => { a.RetentionMiliseconds = n.GetIntegerValue(); } },
{ "retention.ms", (a, n) => { a.RetentionMilliseconds = n.GetIntegerValue(); } },
{ "retention.bytes", (a, n) => { a.RetentionBytes = n.GetIntegerValue(); } },
{ "delete.retention.ms", (a, n) => { a.DeleteRetentionMiliseconds = n.GetIntegerValue(); } },
{ "delete.retention.ms", (a, n) => { a.DeleteRetentionMilliseconds = n.GetIntegerValue(); } },
{ "max.message.bytes", (a, n) => { a.MaxMessageBytes = n.GetIntegerValue(); } },
{ "confluent.key.schema.validation", (a, n) => { a.ConfluentKeySchemaValidation = n.GetBooleanValue(); } },
{ "confluent.key.subject.name.strategy", (a, n) => { a.ConfluentKeySubjectName = n.GetScalarValue(); } },
Expand Down
14 changes: 7 additions & 7 deletions src/LEGO.AsyncAPI.Bindings/Kafka/TopicConfigurationObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ public class TopicConfigurationObject : IAsyncApiElement
/// <summary>
/// The retention.ms configuration option.
/// </summary>
public int? RetentionMiliseconds { get; set; }
public long? RetentionMilliseconds { get; set; }

/// <summary>
/// The retention.bytes configuration option.
/// </summary>
public int? RetentionBytes { get; set; }
public long? RetentionBytes { get; set; }

/// <summary>
/// The delete.retention.ms configuration option.
/// </summary>
public int? DeleteRetentionMiliseconds { get; set; }
public long? DeleteRetentionMilliseconds { get; set; }

/// <summary>
/// The max.message.bytes configuration option.
Expand Down Expand Up @@ -63,10 +63,10 @@ public void Serialize(IAsyncApiWriter writer)

writer.WriteStartObject();
writer.WriteOptionalCollection(AsyncApiConstants.CleanupPolicy, this.CleanupPolicy, (w, s) => w.WriteValue(s));
writer.WriteOptionalProperty<int>(AsyncApiConstants.RetentionMiliseconds, this.RetentionMiliseconds);
writer.WriteOptionalProperty<int>(AsyncApiConstants.RetentionBytes, this.RetentionBytes);
writer.WriteOptionalProperty<int>(AsyncApiConstants.DeleteRetentionMiliseconds, this.DeleteRetentionMiliseconds);
writer.WriteOptionalProperty<int>(AsyncApiConstants.MaxMessageBytes, this.MaxMessageBytes);
writer.WriteOptionalProperty(AsyncApiConstants.RetentionMilliseconds, this.RetentionMilliseconds);
writer.WriteOptionalProperty(AsyncApiConstants.RetentionBytes, this.RetentionBytes);
writer.WriteOptionalProperty(AsyncApiConstants.DeleteRetentionMilliseconds, this.DeleteRetentionMilliseconds);
writer.WriteOptionalProperty(AsyncApiConstants.MaxMessageBytes, this.MaxMessageBytes);
writer.WriteOptionalProperty<bool>(AsyncApiConstants.ConfluentKeySchemaValidation, this.ConfluentKeySchemaValidation);
writer.WriteOptionalProperty(AsyncApiConstants.ConfluentKeySubjectName, this.ConfluentKeySubjectName);
writer.WriteOptionalProperty<bool>(AsyncApiConstants.ConfluentValueSchemaValidation, this.ConfluentValueSchemaValidation);
Expand Down
4 changes: 2 additions & 2 deletions src/LEGO.AsyncAPI/Models/AsyncApiConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ public static class AsyncApiConstants
public const string ServerVariables = "serverVariables";
public const string MessageId = "messageId";
public const string CleanupPolicy = "cleanup.policy";
public const string RetentionMiliseconds = "retention.ms";
public const string RetentionMilliseconds = "retention.ms";
public const string RetentionBytes = "retention.bytes";
public const string DeleteRetentionMiliseconds = "delete.retention.ms";
public const string DeleteRetentionMilliseconds = "delete.retention.ms";
public const string MaxMessageBytes = "max.message.bytes";
public const string ConfluentKeySchemaValidation = "confluent.key.schema.validation";
public const string ConfluentKeySubjectName = "confluent.key.subject.name.strategy";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void KafkaChannelBinding_WithFilledObject_SerializesAndDeserializes()
cleanup.policy:
- delete
- compact
retention.ms: 1
retention.ms: 2592000000
retention.bytes: 2
delete.retention.ms: 3
max.message.bytes: 4
Expand All @@ -45,9 +45,9 @@ public void KafkaChannelBinding_WithFilledObject_SerializesAndDeserializes()
TopicConfiguration = new TopicConfigurationObject()
{
CleanupPolicy = new List<string> { "delete", "compact" },
RetentionMiliseconds = 1,
RetentionMilliseconds = 2592000000,
RetentionBytes = 2,
DeleteRetentionMiliseconds = 3,
DeleteRetentionMilliseconds = 3,
MaxMessageBytes = 4,
ConfluentKeySchemaValidation = true,
ConfluentKeySubjectName = "TopicNameStrategy",
Expand Down

0 comments on commit eace86d

Please sign in to comment.