diff --git a/src/LEGO.AsyncAPI.Bindings/AMQP/AMQPOperationBinding.cs b/src/LEGO.AsyncAPI.Bindings/AMQP/AMQPOperationBinding.cs
index 86dc74ef..3a2e6a35 100644
--- a/src/LEGO.AsyncAPI.Bindings/AMQP/AMQPOperationBinding.cs
+++ b/src/LEGO.AsyncAPI.Bindings/AMQP/AMQPOperationBinding.cs
@@ -5,7 +5,6 @@ namespace LEGO.AsyncAPI.Bindings.AMQP
using System;
using System.Collections.Generic;
using LEGO.AsyncAPI.Models;
- using LEGO.AsyncAPI.Readers;
using LEGO.AsyncAPI.Readers.ParseNodes;
using LEGO.AsyncAPI.Writers;
diff --git a/src/LEGO.AsyncAPI.Bindings/MQTT/LastWill.cs b/src/LEGO.AsyncAPI.Bindings/MQTT/LastWill.cs
index 23118bfa..955ad90f 100644
--- a/src/LEGO.AsyncAPI.Bindings/MQTT/LastWill.cs
+++ b/src/LEGO.AsyncAPI.Bindings/MQTT/LastWill.cs
@@ -2,9 +2,9 @@
namespace LEGO.AsyncAPI.Bindings.MQTT
{
+ using System;
using LEGO.AsyncAPI.Models.Interfaces;
using LEGO.AsyncAPI.Writers;
- using System;
public class LastWill : IAsyncApiElement
{
diff --git a/src/LEGO.AsyncAPI.Bindings/MQTT/MQTTOperationBinding.cs b/src/LEGO.AsyncAPI.Bindings/MQTT/MQTTOperationBinding.cs
index d3155ecd..f58eede9 100644
--- a/src/LEGO.AsyncAPI.Bindings/MQTT/MQTTOperationBinding.cs
+++ b/src/LEGO.AsyncAPI.Bindings/MQTT/MQTTOperationBinding.cs
@@ -3,9 +3,6 @@
namespace LEGO.AsyncAPI.Bindings.MQTT
{
using System;
- using System.Collections.Generic;
- using LEGO.AsyncAPI.Models;
- using LEGO.AsyncAPI.Readers;
using LEGO.AsyncAPI.Readers.ParseNodes;
using LEGO.AsyncAPI.Writers;
diff --git a/src/LEGO.AsyncAPI.Bindings/Sqs/RedrivePolicy.cs b/src/LEGO.AsyncAPI.Bindings/Sqs/RedrivePolicy.cs
index 923d668c..538b1edf 100644
--- a/src/LEGO.AsyncAPI.Bindings/Sqs/RedrivePolicy.cs
+++ b/src/LEGO.AsyncAPI.Bindings/Sqs/RedrivePolicy.cs
@@ -3,9 +3,9 @@
namespace LEGO.AsyncAPI.Bindings.Sqs
{
using System;
+ using System.Collections.Generic;
using LEGO.AsyncAPI.Models.Interfaces;
using LEGO.AsyncAPI.Writers;
- using System.Collections.Generic;
public class RedrivePolicy : IAsyncApiExtensible
{
diff --git a/src/LEGO.AsyncAPI.Readers/AsyncApiExternalReferenceResolver.cs b/src/LEGO.AsyncAPI.Readers/AsyncApiExternalReferenceResolver.cs
index 00e7f077..2c111773 100644
--- a/src/LEGO.AsyncAPI.Readers/AsyncApiExternalReferenceResolver.cs
+++ b/src/LEGO.AsyncAPI.Readers/AsyncApiExternalReferenceResolver.cs
@@ -6,7 +6,6 @@ namespace LEGO.AsyncAPI.Readers
using System;
using System.Collections.Generic;
using System.Linq;
- using LEGO.AsyncAPI.Exceptions;
using LEGO.AsyncAPI.Models;
using LEGO.AsyncAPI.Models.Interfaces;
diff --git a/src/LEGO.AsyncAPI.Readers/AsyncApiJsonDocumentReader.cs b/src/LEGO.AsyncAPI.Readers/AsyncApiJsonDocumentReader.cs
index d8cea285..6b340651 100644
--- a/src/LEGO.AsyncAPI.Readers/AsyncApiJsonDocumentReader.cs
+++ b/src/LEGO.AsyncAPI.Readers/AsyncApiJsonDocumentReader.cs
@@ -1,7 +1,5 @@
// Copyright (c) The LEGO Group. All rights reserved.
-using System;
-
namespace LEGO.AsyncAPI.Readers
{
using System.Collections.Generic;
diff --git a/src/LEGO.AsyncAPI.Readers/AsyncApiTextReader.cs b/src/LEGO.AsyncAPI.Readers/AsyncApiTextReader.cs
index eeece6a7..8d1eafc6 100644
--- a/src/LEGO.AsyncAPI.Readers/AsyncApiTextReader.cs
+++ b/src/LEGO.AsyncAPI.Readers/AsyncApiTextReader.cs
@@ -4,7 +4,6 @@ namespace LEGO.AsyncAPI.Readers
{
using System.IO;
using System.Linq;
- using System.Runtime.CompilerServices;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Threading;
diff --git a/src/LEGO.AsyncAPI.Readers/ParseNodes/ValueNode.cs b/src/LEGO.AsyncAPI.Readers/ParseNodes/ValueNode.cs
index 201ab6f7..76add0b2 100644
--- a/src/LEGO.AsyncAPI.Readers/ParseNodes/ValueNode.cs
+++ b/src/LEGO.AsyncAPI.Readers/ParseNodes/ValueNode.cs
@@ -2,11 +2,11 @@
namespace LEGO.AsyncAPI.Readers.ParseNodes
{
+ using System;
+ using System.Text.Json.Nodes;
using LEGO.AsyncAPI.Exceptions;
using LEGO.AsyncAPI.Models;
using LEGO.AsyncAPI.Readers.Exceptions;
- using System;
- using System.Text.Json.Nodes;
public class ValueNode : ParseNode
{
diff --git a/src/LEGO.AsyncAPI.Readers/V2/AsyncApiMessageDeserializer.cs b/src/LEGO.AsyncAPI.Readers/V2/AsyncApiMessageDeserializer.cs
index 46439764..6f0ef76c 100644
--- a/src/LEGO.AsyncAPI.Readers/V2/AsyncApiMessageDeserializer.cs
+++ b/src/LEGO.AsyncAPI.Readers/V2/AsyncApiMessageDeserializer.cs
@@ -2,16 +2,13 @@
namespace LEGO.AsyncAPI.Readers
{
+ using System.Collections.Generic;
+ using System.Linq;
using LEGO.AsyncAPI.Exceptions;
using LEGO.AsyncAPI.Extensions;
using LEGO.AsyncAPI.Models;
using LEGO.AsyncAPI.Models.Interfaces;
using LEGO.AsyncAPI.Readers.ParseNodes;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
-
internal static partial class AsyncApiV2Deserializer
{
@@ -97,7 +94,7 @@ private static IAsyncApiMessagePayload LoadPayload(ParseNode n, string format)
case var _ when SupportedJsonSchemaFormats.Where(s => format.StartsWith(s)).Any():
return new AsyncApiJsonSchemaPayload(AsyncApiSchemaDeserializer.LoadSchema(n));
case var _ when SupportedAvroSchemaFormats.Where(s => format.StartsWith(s)).Any():
- return new AsyncApiAvroSchemaPayload();
+ return new AsyncApiAvroSchemaPayload(AsyncApiAvroSchemaDeserializer.LoadSchema(n));
default:
var supportedFormats = SupportedJsonSchemaFormats.Concat(SupportedAvroSchemaFormats);
throw new AsyncApiException($"'Could not deserialize Payload. Supported formats are {string.Join(", ", supportedFormats)}");
diff --git a/src/LEGO.AsyncAPI.Readers/V2/AsyncApiV2VersionService.cs b/src/LEGO.AsyncAPI.Readers/V2/AsyncApiV2VersionService.cs
index 033eeedd..4acc3395 100644
--- a/src/LEGO.AsyncAPI.Readers/V2/AsyncApiV2VersionService.cs
+++ b/src/LEGO.AsyncAPI.Readers/V2/AsyncApiV2VersionService.cs
@@ -37,7 +37,7 @@ public AsyncApiV2VersionService(AsyncApiDiagnostic diagnostic)
[typeof(AsyncApiParameter)] = AsyncApiV2Deserializer.LoadParameter,
[typeof(AsyncApiSchema)] = AsyncApiSchemaDeserializer.LoadSchema,
[typeof(AvroSchema)] = AsyncApiAvroSchemaDeserializer.LoadSchema,
- [typeof(AsyncApiJsonSchemaPayload)] = AsyncApiV2Deserializer.LoadJsonSchemaPayload, // #ToFix how do we get the schemaFormat?!
+ [typeof(AsyncApiJsonSchemaPayload)] = AsyncApiV2Deserializer.LoadJsonSchemaPayload,
[typeof(AsyncApiAvroSchemaPayload)] = AsyncApiV2Deserializer.LoadAvroPayload,
[typeof(AsyncApiSecurityRequirement)] = AsyncApiV2Deserializer.LoadSecurityRequirement,
[typeof(AsyncApiSecurityScheme)] = AsyncApiV2Deserializer.LoadSecurityScheme,
diff --git a/src/LEGO.AsyncAPI/Models/AsyncApiAvroSchemaPayload.cs b/src/LEGO.AsyncAPI/Models/AsyncApiAvroSchemaPayload.cs
index e2e615b7..b4850d7d 100644
--- a/src/LEGO.AsyncAPI/Models/AsyncApiAvroSchemaPayload.cs
+++ b/src/LEGO.AsyncAPI/Models/AsyncApiAvroSchemaPayload.cs
@@ -2,15 +2,52 @@
namespace LEGO.AsyncAPI.Models
{
- using System;
+ using System.Collections.Generic;
using LEGO.AsyncAPI.Models.Interfaces;
using LEGO.AsyncAPI.Writers;
public class AsyncApiAvroSchemaPayload : IAsyncApiMessagePayload
{
+ private AvroSchema schema;
+
+ public AsyncApiAvroSchemaPayload()
+ {
+ this.schema = new AvroSchema();
+ }
+
+ public AsyncApiAvroSchemaPayload(AvroSchema schema)
+ {
+ this.schema = schema;
+ }
+
+ ///
+ /// The type of the schema. See Avro Schema Types.
+ ///
+ public AvroSchemaType Type { get => this.schema.Type; set => this.schema.Type = value; }
+
+ ///
+ /// The name of the schema. Required for named types (e.g., record, enum, fixed). See Avro Names.
+ ///
+ public string Name { get => this.schema.Name; set => this.schema.Name = value; }
+
+ ///
+ /// The namespace of the schema. Useful for named types to avoid name conflicts.
+ ///
+ public string? Namespace { get => this.schema.Namespace; set => this.schema.Namespace = value; }
+
+ ///
+ /// Documentation for the schema.
+ ///
+ public string? Doc { get => this.schema.Doc; set => this.schema.Doc = value; }
+
+ ///
+ /// The list of fields in the schema.
+ ///
+ public IList Fields { get => this.schema.Fields; set => this.schema.Fields = value; }
+
public void SerializeV2(IAsyncApiWriter writer)
{
- throw new NotImplementedException();
+ this.schema.SerializeV2(writer);
}
}
}
diff --git a/src/LEGO.AsyncAPI/Models/Avro/AvroPrimitive.cs b/src/LEGO.AsyncAPI/Models/Avro/AvroPrimitive.cs
index b7db6d6c..5c0b782a 100644
--- a/src/LEGO.AsyncAPI/Models/Avro/AvroPrimitive.cs
+++ b/src/LEGO.AsyncAPI/Models/Avro/AvroPrimitive.cs
@@ -3,7 +3,6 @@
namespace LEGO.AsyncAPI.Models
{
using LEGO.AsyncAPI.Writers;
- using System.Runtime.CompilerServices;
public class AvroPrimitive : AvroFieldType
{
diff --git a/src/LEGO.AsyncAPI/Models/Avro/AvroSchema.cs b/src/LEGO.AsyncAPI/Models/Avro/AvroSchema.cs
index b837ac19..e314e887 100644
--- a/src/LEGO.AsyncAPI/Models/Avro/AvroSchema.cs
+++ b/src/LEGO.AsyncAPI/Models/Avro/AvroSchema.cs
@@ -3,7 +3,6 @@
namespace LEGO.AsyncAPI.Models
{
using System.Collections.Generic;
- using System.Linq;
using LEGO.AsyncAPI.Models.Interfaces;
using LEGO.AsyncAPI.Writers;
diff --git a/src/LEGO.AsyncAPI/Models/Avro/AvroSchemaType.cs b/src/LEGO.AsyncAPI/Models/Avro/AvroSchemaType.cs
index 1a5b74db..affc205a 100644
--- a/src/LEGO.AsyncAPI/Models/Avro/AvroSchemaType.cs
+++ b/src/LEGO.AsyncAPI/Models/Avro/AvroSchemaType.cs
@@ -2,7 +2,6 @@
namespace LEGO.AsyncAPI.Models
{
- using System;
using LEGO.AsyncAPI.Attributes;
///
diff --git a/src/LEGO.AsyncAPI/Validation/Rules/AsyncApiOAuthFlowRules.cs b/src/LEGO.AsyncAPI/Validation/Rules/AsyncApiOAuthFlowRules.cs
index 457a03ec..66090074 100644
--- a/src/LEGO.AsyncAPI/Validation/Rules/AsyncApiOAuthFlowRules.cs
+++ b/src/LEGO.AsyncAPI/Validation/Rules/AsyncApiOAuthFlowRules.cs
@@ -2,9 +2,9 @@
namespace LEGO.AsyncAPI.Validation.Rules
{
+ using System.Linq;
using LEGO.AsyncAPI.Models;
using LEGO.AsyncAPI.Validations;
- using System.Linq;
[AsyncApiRule]
public static class AsyncApiOAuthFlowRules
diff --git a/src/LEGO.AsyncAPI/Writers/AsyncApiWriterException.cs b/src/LEGO.AsyncAPI/Writers/AsyncApiWriterException.cs
index 9d89bba3..17229818 100644
--- a/src/LEGO.AsyncAPI/Writers/AsyncApiWriterException.cs
+++ b/src/LEGO.AsyncAPI/Writers/AsyncApiWriterException.cs
@@ -2,8 +2,8 @@
namespace LEGO.AsyncAPI.Writers
{
- using LEGO.AsyncAPI.Exceptions;
using System;
+ using LEGO.AsyncAPI.Exceptions;
public class AsyncApiWriterException : AsyncApiException
{
diff --git a/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentBuilder.cs b/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentBuilder.cs
index 3f2ee429..f800a1f7 100644
--- a/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentBuilder.cs
+++ b/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentBuilder.cs
@@ -2,9 +2,9 @@
namespace LEGO.AsyncAPI.Tests
{
+ using System;
using LEGO.AsyncAPI.Models;
using LEGO.AsyncAPI.Models.Interfaces;
- using System;
internal class AsyncApiDocumentBuilder
{
diff --git a/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentV2Tests.cs b/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentV2Tests.cs
index 458e3f14..4cbf1bd4 100644
--- a/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentV2Tests.cs
+++ b/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentV2Tests.cs
@@ -4,7 +4,6 @@ namespace LEGO.AsyncAPI.Tests
{
using System;
using System.Collections.Generic;
- using System.Globalization;
using System.IO;
using System.Linq;
using FluentAssertions;
diff --git a/test/LEGO.AsyncAPI.Tests/AsyncApiReaderTests.cs b/test/LEGO.AsyncAPI.Tests/AsyncApiReaderTests.cs
index bf19a944..0a4cd5e7 100644
--- a/test/LEGO.AsyncAPI.Tests/AsyncApiReaderTests.cs
+++ b/test/LEGO.AsyncAPI.Tests/AsyncApiReaderTests.cs
@@ -5,7 +5,6 @@ namespace LEGO.AsyncAPI.Tests
using System;
using System.Collections.Generic;
using System.Linq;
- using System.Text.Json.Nodes;
using LEGO.AsyncAPI.Exceptions;
using LEGO.AsyncAPI.Models;
using LEGO.AsyncAPI.Models.Interfaces;
diff --git a/test/LEGO.AsyncAPI.Tests/Bindings/StringOrStringList_Should.cs b/test/LEGO.AsyncAPI.Tests/Bindings/StringOrStringList_Should.cs
index c437f15c..1a7c8681 100644
--- a/test/LEGO.AsyncAPI.Tests/Bindings/StringOrStringList_Should.cs
+++ b/test/LEGO.AsyncAPI.Tests/Bindings/StringOrStringList_Should.cs
@@ -4,7 +4,6 @@ namespace LEGO.AsyncAPI.Tests.Bindings
{
using System;
using System.Collections.Generic;
- using System.Linq;
using FluentAssertions;
using LEGO.AsyncAPI.Bindings;
using LEGO.AsyncAPI.Models;
diff --git a/test/LEGO.AsyncAPI.Tests/FluentAssertionExtensions.cs b/test/LEGO.AsyncAPI.Tests/FluentAssertionExtensions.cs
index 31fec68a..a9a771ab 100644
--- a/test/LEGO.AsyncAPI.Tests/FluentAssertionExtensions.cs
+++ b/test/LEGO.AsyncAPI.Tests/FluentAssertionExtensions.cs
@@ -3,7 +3,6 @@
namespace LEGO.AsyncAPI.Tests
{
using System;
- using System.IO;
using FluentAssertions;
using FluentAssertions.Primitives;
using NUnit.Framework;
diff --git a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiAnyTests.cs b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiAnyTests.cs
index 6c93e483..1dfdc59a 100644
--- a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiAnyTests.cs
+++ b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiAnyTests.cs
@@ -1,10 +1,9 @@
// Copyright (c) The LEGO Group. All rights reserved.
-using LEGO.AsyncAPI.Models;
-using NUnit.Framework;
-using System;
using System.Collections.Generic;
using System.Linq;
+using LEGO.AsyncAPI.Models;
+using NUnit.Framework;
namespace LEGO.AsyncAPI.Tests
{
diff --git a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiOperation_Should.cs b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiOperation_Should.cs
index 5597b211..847da7be 100644
--- a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiOperation_Should.cs
+++ b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiOperation_Should.cs
@@ -3,7 +3,6 @@
namespace LEGO.AsyncAPI.Tests.Models
{
using System;
- using System.Globalization;
using System.IO;
using FluentAssertions;
using LEGO.AsyncAPI.Bindings.Http;
diff --git a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiReference_Should.cs b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiReference_Should.cs
index 64e34c57..41972784 100644
--- a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiReference_Should.cs
+++ b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiReference_Should.cs
@@ -2,12 +2,11 @@
namespace LEGO.AsyncAPI.Tests
{
+ using System.Linq;
using FluentAssertions;
- using FluentAssertions.Primitives;
using LEGO.AsyncAPI.Models;
using LEGO.AsyncAPI.Readers;
using NUnit.Framework;
- using System.Linq;
public class AsyncApiReference_Should : TestBase
{
diff --git a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiSchema_Should.cs b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiSchema_Should.cs
index 43d15629..53fc0350 100644
--- a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiSchema_Should.cs
+++ b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiSchema_Should.cs
@@ -4,7 +4,6 @@ namespace LEGO.AsyncAPI.Tests.Models
{
using System;
using System.Collections.Generic;
- using System.Globalization;
using System.IO;
using FluentAssertions;
using LEGO.AsyncAPI.Models;
diff --git a/test/LEGO.AsyncAPI.Tests/Serialization/AsyncApiYamlWriterTests.cs b/test/LEGO.AsyncAPI.Tests/Serialization/AsyncApiYamlWriterTests.cs
index c364d345..69ae67e3 100644
--- a/test/LEGO.AsyncAPI.Tests/Serialization/AsyncApiYamlWriterTests.cs
+++ b/test/LEGO.AsyncAPI.Tests/Serialization/AsyncApiYamlWriterTests.cs
@@ -2,10 +2,9 @@
namespace LEGO.AsyncAPI.Tests.Writers
{
+ using System.IO;
using LEGO.AsyncAPI.Writers;
using NUnit.Framework;
- using System;
- using System.IO;
internal class AsyncApiYamlWriterTests : TestBase
{