Skip to content

Commit

Permalink
chore: fix warnings (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
VisualBean authored Mar 26, 2024
1 parent 18f2cb3 commit 6169554
Show file tree
Hide file tree
Showing 100 changed files with 768 additions and 724 deletions.
4 changes: 2 additions & 2 deletions src/LEGO.AsyncAPI.Bindings/AMQP/AMQPChannelBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public class AMQPChannelBinding : ChannelBinding<AMQPChannelBinding>

public override string BindingKey => "amqp";

protected override FixedFieldMap<AMQPChannelBinding> FixedFieldMap => new ()
protected override FixedFieldMap<AMQPChannelBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "is", (a, n) => { a.Is = n.GetScalarValue().GetEnumFromDisplayName<ChannelType>(); } },
{ "exchange", (a, n) => { a.Exchange = n.ParseMap(ExchangeFixedFields); } },
{ "queue", (a, n) => { a.Queue = n.ParseMap(QueueFixedFields); } },
};

private static FixedFieldMap<Exchange> ExchangeFixedFields = new ()
private static FixedFieldMap<Exchange> ExchangeFixedFields = new()
{
{ "name", (a, n) => { a.Name = n.GetScalarValue(); } },
{ "durable", (a, n) => { a.Durable = n.GetBooleanValue(); } },
Expand Down
2 changes: 1 addition & 1 deletion src/LEGO.AsyncAPI.Bindings/AMQP/AMQPMessageBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public override void SerializeProperties(IAsyncApiWriter writer)

public override string BindingKey => "amqp";

protected override FixedFieldMap<AMQPMessageBinding> FixedFieldMap => new ()
protected override FixedFieldMap<AMQPMessageBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "contentEncoding", (a, n) => { a.ContentEncoding = n.GetScalarValue(); } },
Expand Down
4 changes: 1 addition & 3 deletions src/LEGO.AsyncAPI.Bindings/Http/HttpMessageBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace LEGO.AsyncAPI.Bindings.Http
/// </summary>
public class HttpMessageBinding : MessageBinding<HttpMessageBinding>
{

/// <summary>
/// A Schema object containing the definitions for HTTP-specific headers. This schema MUST be of type object and have a properties key.
/// </summary>
Expand All @@ -40,11 +39,10 @@ public override void SerializeProperties(IAsyncApiWriter writer)

public override string BindingKey => "http";

protected override FixedFieldMap<HttpMessageBinding> FixedFieldMap => new ()
protected override FixedFieldMap<HttpMessageBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "headers", (a, n) => { a.Headers = JsonSchemaDeserializer.LoadSchema(n); } },
};

}
}
2 changes: 1 addition & 1 deletion src/LEGO.AsyncAPI.Bindings/Http/HttpOperationBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public override void SerializeProperties(IAsyncApiWriter writer)
writer.WriteEndObject();
}

protected override FixedFieldMap<HttpOperationBinding> FixedFieldMap => new ()
protected override FixedFieldMap<HttpOperationBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "type", (a, n) => { a.Type = n.GetScalarValue().GetEnumFromDisplayName<HttpOperationType>(); } },
Expand Down
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 @@ -34,7 +34,7 @@ public class KafkaChannelBinding : ChannelBinding<KafkaChannelBinding>

public override string BindingKey => "kafka";

protected override FixedFieldMap<KafkaChannelBinding> FixedFieldMap => new ()
protected override FixedFieldMap<KafkaChannelBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "topic", (a, n) => { a.Topic = n.GetScalarValue(); } },
Expand All @@ -43,7 +43,7 @@ public class KafkaChannelBinding : ChannelBinding<KafkaChannelBinding>
{ "replicas", (a, n) => { a.Replicas = n.GetIntegerValue(); } },
};

private static FixedFieldMap<TopicConfigurationObject> kafkaChannelTopicConfigurationObjectFixedFields = new ()
private static FixedFieldMap<TopicConfigurationObject> kafkaChannelTopicConfigurationObjectFixedFields = new()
{
{ "cleanup.policy", (a, n) => { a.CleanupPolicy = n.CreateSimpleList(s => s.GetScalarValue()); } },
{ "retention.ms", (a, n) => { a.RetentionMilliseconds = n.GetLongValue(); } },
Expand Down
6 changes: 3 additions & 3 deletions src/LEGO.AsyncAPI.Bindings/Kafka/KafkaMessageBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class KafkaMessageBinding : MessageBinding<KafkaMessageBinding>
/// <summary>
/// The version of this binding. If omitted, "latest" MUST be assumed.
/// </summary>

public override void SerializeProperties(IAsyncApiWriter writer)
{
if (writer is null)
Expand All @@ -62,9 +62,9 @@ public override void SerializeProperties(IAsyncApiWriter writer)
/// <param name="writer">The writer.</param>
/// <exception cref="ArgumentNullException">writer.</exception>

public override string BindingKey => "kafka";
public override string BindingKey => "kafka";

protected override FixedFieldMap<KafkaMessageBinding> FixedFieldMap => new ()
protected override FixedFieldMap<KafkaMessageBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "key", (a, n) => { a.Key = JsonSchemaDeserializer.LoadSchema(n); } },
Expand Down
2 changes: 1 addition & 1 deletion src/LEGO.AsyncAPI.Bindings/Kafka/KafkaOperationBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class KafkaOperationBinding : OperationBinding<KafkaOperationBinding>

public override string BindingKey => "kafka";

protected override FixedFieldMap<KafkaOperationBinding> FixedFieldMap => new ()
protected override FixedFieldMap<KafkaOperationBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "groupId", (a, n) => { a.GroupId = JsonSchemaDeserializer.LoadSchema(n); } },
Expand Down
2 changes: 1 addition & 1 deletion src/LEGO.AsyncAPI.Bindings/Kafka/KafkaServerBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class KafkaServerBinding : ServerBinding<KafkaServerBinding>

public override string BindingKey => "kafka";

protected override FixedFieldMap<KafkaServerBinding> FixedFieldMap => new ()
protected override FixedFieldMap<KafkaServerBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "schemaRegistryUrl", (a, n) => { a.SchemaRegistryUrl = n.GetScalarValue(); } },
Expand Down
4 changes: 2 additions & 2 deletions src/LEGO.AsyncAPI.Bindings/LEGO.AsyncAPI.Bindings.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../Common.Build.props"/>
<Import Project="../../Common.Build.props" />
<PropertyGroup>
<Description>AsyncAPI.NET Bindings</Description>
<PackageId>AsyncAPI.NET.Bindings</PackageId>
Expand All @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/LEGO.AsyncAPI.Bindings/MQTT/MQTTMessageBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override void SerializeProperties(IAsyncApiWriter writer)

public override string BindingKey => "mqtt";

protected override FixedFieldMap<MQTTMessageBinding> FixedFieldMap => new ()
protected override FixedFieldMap<MQTTMessageBinding> FixedFieldMap => new()
{
{ "payloadFormatIndicator", (a, n) => { a.PayloadFormatIndicator = n.GetIntegerValueOrDefault(); } },
{ "correlationData", (a, n) => { a.CorrelationData = JsonSchemaDeserializer.LoadSchema(n); } },
Expand Down
4 changes: 2 additions & 2 deletions src/LEGO.AsyncAPI.Bindings/MQTT/MQTTServerBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class MQTTServerBinding : ServerBinding<MQTTServerBinding>

public override string BindingKey => "mqtt";

protected override FixedFieldMap<MQTTServerBinding> FixedFieldMap => new ()
protected override FixedFieldMap<MQTTServerBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "clientId", (a, n) => { a.ClientId = n.GetScalarValue(); } },
Expand All @@ -60,7 +60,7 @@ public class MQTTServerBinding : ServerBinding<MQTTServerBinding>
{ "maximumPacketSize", (a, n) => { a.MaximumPacketSize = n.GetIntegerValueOrDefault(); } },
};

private static FixedFieldMap<LastWill> LastWillFixedFields = new ()
private static FixedFieldMap<LastWill> LastWillFixedFields = new()
{
{ "topic", (a, n) => { a.Topic = n.GetScalarValue(); } },
{ "qos", (a, n) => { a.QoS = (uint?)n.GetIntegerValueOrDefault(); } },
Expand Down
2 changes: 1 addition & 1 deletion src/LEGO.AsyncAPI.Bindings/OperationBinding{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace LEGO.AsyncAPI.Bindings
using LEGO.AsyncAPI.Readers;
using LEGO.AsyncAPI.Readers.ParseNodes;

public abstract class OperationBinding<T> : Binding<T> , IOperationBinding
public abstract class OperationBinding<T> : Binding<T>, IOperationBinding
where T : IOperationBinding, new()
{
protected abstract FixedFieldMap<T> FixedFieldMap { get; }
Expand Down
4 changes: 2 additions & 2 deletions src/LEGO.AsyncAPI.Bindings/Pulsar/PulsarChannelBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public override void SerializeProperties(IAsyncApiWriter writer)
writer.WriteEndObject();
}

protected override FixedFieldMap<PulsarChannelBinding> FixedFieldMap => new ()
protected override FixedFieldMap<PulsarChannelBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "namespace", (a, n) => { a.Namespace = n.GetScalarValue(); } },
Expand All @@ -80,7 +80,7 @@ public override void SerializeProperties(IAsyncApiWriter writer)
{ "deduplication", (a, n) => { a.Deduplication = n.GetBooleanValue(); } },
};

private FixedFieldMap<RetentionDefinition> pulsarServerBindingRetentionFixedFields = new ()
private FixedFieldMap<RetentionDefinition> pulsarServerBindingRetentionFixedFields = new()
{
{ "time", (a, n) => { a.Time = n.GetIntegerValue(); } },
{ "size", (a, n) => { a.Size = n.GetIntegerValue(); } },
Expand Down
2 changes: 1 addition & 1 deletion src/LEGO.AsyncAPI.Bindings/Pulsar/PulsarServerBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class PulsarServerBinding : ServerBinding<PulsarServerBinding>

public override string BindingKey => "pulsar";

protected override FixedFieldMap<PulsarServerBinding> FixedFieldMap => new ()
protected override FixedFieldMap<PulsarServerBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "tenant", (a, n) => { a.Tenant = n.GetScalarValue(); } },
Expand Down
6 changes: 4 additions & 2 deletions src/LEGO.AsyncAPI.Bindings/Sns/Consumer.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sns
{
using System;
Expand All @@ -24,7 +26,7 @@ public class Consumer : IAsyncApiExtensible
/// Depending on the FilterPolicyScope, a map of either a message attribute or message body to an array of possible matches. The match may be a simple string for an exact match, but it may also be an object that represents a constraint and values for that constraint.
/// </summary>
public AsyncApiAny FilterPolicy { get; set; }

/// <summary>
/// Determines whether the FilterPolicy applies to MessageAttributes or MessageBody.
/// </summary>
Expand Down Expand Up @@ -85,7 +87,7 @@ public enum Protocol
[Display("lambda")] Lambda,
[Display("firehose")] Firehose,
}

public enum FilterPolicyScope
{
[Display("MessageAttributes")] MessageAttributes,
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sns/DeliveryPolicy.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sns
{
using System;
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sns/Identifier.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sns
{
using System;
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sns/Ordering.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sns
{
using System;
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sns/Policy.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sns
{
using System;
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sns/RedrivePolicy.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sns
{
using System;
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sns/SnsChannelBinding.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sns
{
using System;
Expand Down
4 changes: 3 additions & 1 deletion src/LEGO.AsyncAPI.Bindings/Sns/SnsOperationBinding.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sns
{
using System;
Expand Down Expand Up @@ -43,7 +45,7 @@ public class SnsOperationBinding : OperationBinding<SnsOperationBinding>
{ "name", (a, n) => { a.Name = n.GetScalarValue(); } },
};

private FixedFieldMap<Consumer> consumerFixedFields => new ()
private FixedFieldMap<Consumer> consumerFixedFields => new()
{
{ "protocol", (a, n) => { a.Protocol = n.GetScalarValue().GetEnumFromDisplayName<Protocol>(); } },
{ "endpoint", (a, n) => { a.Endpoint = n.ParseMapWithExtensions(this.identifierFixFields); } },
Expand Down
3 changes: 2 additions & 1 deletion src/LEGO.AsyncAPI.Bindings/Sns/Statement.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sns
{
using System;
Expand All @@ -8,7 +10,6 @@ namespace LEGO.AsyncAPI.Bindings.Sns

public class Statement : IAsyncApiExtensible
{

public Effect Effect { get; set; }

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sqs/Identifier.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sqs
{
using System;
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sqs/Policy.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sqs
{
using System;
Expand Down
4 changes: 3 additions & 1 deletion src/LEGO.AsyncAPI.Bindings/Sqs/Queue.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sqs
{
using System;
Expand Down Expand Up @@ -26,7 +28,7 @@ public class Queue : IAsyncApiExtensible
/// <summary>
/// Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are perQueue (default) and perMessageGroupId.
/// </summary>
public FifoThroughputLimit? FifoThroughputLimit { get; set; }
public FifoThroughputLimit? FifoThroughputLimit { get; set; }

/// <summary>
/// The number of seconds to delay before a message sent to the queue can be received. used to create a delay queue.
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sqs/RedrivePolicy.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sqs
{
using System;
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sqs/SqsChannelBinding.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sqs
{
using System;
Expand Down
2 changes: 2 additions & 0 deletions src/LEGO.AsyncAPI.Bindings/Sqs/SqsOperationBinding.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sqs
{
using System;
Expand Down
3 changes: 2 additions & 1 deletion src/LEGO.AsyncAPI.Bindings/Sqs/Statement.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.

namespace LEGO.AsyncAPI.Bindings.Sqs
{
using System;
Expand All @@ -8,7 +10,6 @@ namespace LEGO.AsyncAPI.Bindings.Sqs

public class Statement : IAsyncApiExtensible
{

public Effect Effect { get; set; }

/// <summary>
Expand Down
16 changes: 8 additions & 8 deletions src/LEGO.AsyncAPI.Bindings/StringOrStringList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public StringOrStringList(AsyncApiAny value)
{
JsonArray array => IsValidStringList(array) ? new AsyncApiAny(array) : throw new ArgumentException($"{nameof(StringOrStringList)} value should only contain string items."),
JsonValue jValue => IsString(jValue) ? new AsyncApiAny(jValue) : throw new ArgumentException($"{nameof(StringOrStringList)} should be a string value or a string list."),
_ => throw new ArgumentException($"{nameof(StringOrStringList)} should be a string value or a string list.")
_ => throw new ArgumentException($"{nameof(StringOrStringList)} should be a string value or a string list."),
};
}

Expand All @@ -31,15 +31,15 @@ public static StringOrStringList Parse(ParseNode node)
case ValueNode:
return new StringOrStringList(new AsyncApiAny(node.GetScalarValue()));
case ListNode:
{
var jsonArray = new JsonArray();
foreach (var item in node as ListNode)
{
jsonArray.Add(item.GetScalarValue());
}
var jsonArray = new JsonArray();
foreach (var item in node as ListNode)
{
jsonArray.Add(item.GetScalarValue());
}

return new StringOrStringList(new AsyncApiAny(jsonArray));
}
return new StringOrStringList(new AsyncApiAny(jsonArray));
}

default:
throw new ArgumentException($"An error occured while parsing a {nameof(StringOrStringList)} node. " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public class WebSocketsChannelBinding : ChannelBinding<WebSocketsChannelBinding>
/// </summary>
public AsyncApiSchema Headers { get; set; }

public override string BindingKey => "websockets";
public override string BindingKey => "websockets";

protected override FixedFieldMap<WebSocketsChannelBinding> FixedFieldMap => new ()
protected override FixedFieldMap<WebSocketsChannelBinding> FixedFieldMap => new()
{
{ "bindingVersion", (a, n) => { a.BindingVersion = n.GetScalarValue(); } },
{ "method", (a, n) => { a.Method = n.GetScalarValue(); } },
Expand Down
Loading

0 comments on commit 6169554

Please sign in to comment.