Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updated topic configuration data types #143

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading