From 7fd3af0e6669d18e805e0bab9cafac819ea64c1d Mon Sep 17 00:00:00 2001 From: Alex Wichmann Date: Tue, 21 May 2024 13:34:27 +0200 Subject: [PATCH 1/8] fix: inline channel parameters should not deserialize as references (#172) --- .../V2/AsyncApiChannelDeserializer.cs | 2 +- .../Models/AsyncApiChannel_Should.cs | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/LEGO.AsyncAPI.Readers/V2/AsyncApiChannelDeserializer.cs b/src/LEGO.AsyncAPI.Readers/V2/AsyncApiChannelDeserializer.cs index cc74e0c0..1d6acae6 100644 --- a/src/LEGO.AsyncAPI.Readers/V2/AsyncApiChannelDeserializer.cs +++ b/src/LEGO.AsyncAPI.Readers/V2/AsyncApiChannelDeserializer.cs @@ -14,7 +14,7 @@ internal static partial class AsyncApiV2Deserializer { "servers", (a, n) => { a.Servers = n.CreateSimpleList(s => s.GetScalarValue()); } }, { "subscribe", (a, n) => { a.Subscribe = LoadOperation(n); } }, { "publish", (a, n) => { a.Publish = LoadOperation(n); } }, - { "parameters", (a, n) => { a.Parameters = n.CreateMapWithReference(ReferenceType.Parameter, LoadParameter); } }, + { "parameters", (a, n) => { a.Parameters = n.CreateMap(LoadParameter); } }, { "bindings", (a, n) => { a.Bindings = LoadChannelBindings(n); } }, }; diff --git a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiChannel_Should.cs b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiChannel_Should.cs index ef24e07b..50c6768b 100644 --- a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiChannel_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiChannel_Should.cs @@ -3,15 +3,36 @@ namespace LEGO.AsyncAPI.Tests.Models { using System.Collections.Generic; + using System.Linq; using FluentAssertions; using LEGO.AsyncAPI.Bindings.Kafka; using LEGO.AsyncAPI.Bindings.WebSockets; using LEGO.AsyncAPI.Models; using LEGO.AsyncAPI.Models.Interfaces; + using LEGO.AsyncAPI.Readers; using NUnit.Framework; internal class AsyncApiChannel_Should : TestBase { + [Test] + public void AsyncApiChannel_WithInlineParameter_DoesNotCreateReference() + { + var input = + """ + parameters: + id: + description: ids + schema: + type: string + enum: + - 08735ae0-6a1a-4578-8b4a-35aa26d15993 + - 97845c62-329c-4d87-ad24-4f611b909a10 + """; + + var channel = new AsyncApiStringReader().ReadFragment(input, AsyncApiVersion.AsyncApi2_0, out var _ ); + channel.Parameters.First().Value.Reference.Should().BeNull(); + } + [Test] public void AsyncApiChannel_WithWebSocketsBinding_Serializes() { From c27cdd5453b69d44112a3373a6bd7f36d20e7255 Mon Sep 17 00:00:00 2001 From: Alex Wichmann Date: Tue, 28 May 2024 09:19:47 +0200 Subject: [PATCH 2/8] ci: add logo to NuGet package (#173) --- Common.Build.props | 5 +++++ media/logo.png | Bin 0 -> 7975 bytes .../LEGO.AsyncAPI.Bindings.csproj | 7 +------ .../LEGO.AsyncAPI.Readers.csproj | 6 ------ src/LEGO.AsyncAPI/LEGO.AsyncAPI.csproj | 4 ---- 5 files changed, 6 insertions(+), 16 deletions(-) create mode 100644 media/logo.png diff --git a/Common.Build.props b/Common.Build.props index 78aa4707..277a2772 100644 --- a/Common.Build.props +++ b/Common.Build.props @@ -9,5 +9,10 @@ README.md https://github.com/LEGO/AsyncAPI.NET asyncapi .net openapi documentation + logo.png + + + + \ No newline at end of file diff --git a/media/logo.png b/media/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..1a25d72c6ad62640da96f1686e414483e4cce8ea GIT binary patch literal 7975 zcmbW6bx<5nxA%iff(Lg`kRXe@F7AuFI|K=C0TLuEu(&PmvVp~dCn3RIf=h6BSe(o6 z-luLo^}P45x29(L)T!!k_ssP4IdeWSn(7KT*c8|=UcA6jQk2tvZX5nNG0~r|;=|~? z&keejih|sWr+<$8juX4B}g-zuYvaFDBYd*Z?v>4;g?g-M{m4rR;A`$BaZ^ zUL!)dcL5>RwemFcYc}w(@#)TRG{8+|k`GK4*G1q*NES+&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PJTXt3M`0_ndr9n}^{jls|76A?hk<}LJ z&BW1bXHtcEr5|!gZ*%5@pdxZERxa0ZQ6<^;Wrg~6r*S2FD#`tGAngI2%vvk z8Ed2|#o4krCdsxZX3;;bm)<4BRqJq%88s>*l^c1Ib(aCf2~jg*E;fBACKrakJ3P34 zs0vC6brhvK_P)ca$E4kLm_K(mPcYfSl` z@pA$E?SvbvydE+uyOuX$kXiS&#NuL6{iW^lE@=za^A(A9!K_0Sj$ZV$7Bq; zXl@@L)G3i8WwMkygd3yjPkm*El**|@iU<-MtnC<*~h7WUvM3TA~#ku{dc2HiBUe3u>emV#;NqQ9o z$?=z&!lMwTmQ%+rz>^_+94i#XK)n=D2PIzrN*Nv+)6ugGWL{hQVb{3xs2VK%PQUTT zCnYTb(TG@c%spD=LQ3+3wU;817bVNHIjjUyJSn&&!N^}P2c z;ohYdR^M%3RvxQF|ewM^x%6N6hJ)^ZhsYq8C*JO2q6WcG>i2_N6 z%umm);(TrQjoMLtRrex8f09`8|lCf_fVR literal 0 HcmV?d00001 diff --git a/src/LEGO.AsyncAPI.Bindings/LEGO.AsyncAPI.Bindings.csproj b/src/LEGO.AsyncAPI.Bindings/LEGO.AsyncAPI.Bindings.csproj index dc76c2ba..9c0b025e 100644 --- a/src/LEGO.AsyncAPI.Bindings/LEGO.AsyncAPI.Bindings.csproj +++ b/src/LEGO.AsyncAPI.Bindings/LEGO.AsyncAPI.Bindings.csproj @@ -20,12 +20,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - - True - \ - - + diff --git a/src/LEGO.AsyncAPI.Readers/LEGO.AsyncAPI.Readers.csproj b/src/LEGO.AsyncAPI.Readers/LEGO.AsyncAPI.Readers.csproj index c47530c0..53071ca0 100644 --- a/src/LEGO.AsyncAPI.Readers/LEGO.AsyncAPI.Readers.csproj +++ b/src/LEGO.AsyncAPI.Readers/LEGO.AsyncAPI.Readers.csproj @@ -27,12 +27,6 @@ - - - True - \ - - diff --git a/src/LEGO.AsyncAPI/LEGO.AsyncAPI.csproj b/src/LEGO.AsyncAPI/LEGO.AsyncAPI.csproj index 3bfe1c9c..560c0f98 100644 --- a/src/LEGO.AsyncAPI/LEGO.AsyncAPI.csproj +++ b/src/LEGO.AsyncAPI/LEGO.AsyncAPI.csproj @@ -26,10 +26,6 @@ - - - - From bfec063158e4b5d8d35a20d8caafbe255f95d96e Mon Sep 17 00:00:00 2001 From: Alex Wichmann Date: Tue, 28 May 2024 09:32:52 +0200 Subject: [PATCH 3/8] ci: include license in package (#174) --- Common.Build.props | 2 ++ LICENSE => LICENSE.txt | 0 2 files changed, 2 insertions(+) rename LICENSE => LICENSE.txt (100%) diff --git a/Common.Build.props b/Common.Build.props index 277a2772..ba84a0f8 100644 --- a/Common.Build.props +++ b/Common.Build.props @@ -10,9 +10,11 @@ https://github.com/LEGO/AsyncAPI.NET asyncapi .net openapi documentation logo.png + LICENSE.txt + \ No newline at end of file diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt From fc386d9e5c4bb7c62f6f7cc9b4a63a8a03d95690 Mon Sep 17 00:00:00 2001 From: "lego-10-01-06[bot]" <119427331+lego-10-01-06[bot]@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:40:50 +0000 Subject: [PATCH 4/8] chore: update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90780c52..505c9b09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.2.1](https://github.com/LEGO/AsyncAPI.NET/compare/v5.2.0...v5.2.1) (2024-06-12) + + +### Bug Fixes + +* inline channel parameters should not deserialize as references ([#172](https://github.com/LEGO/AsyncAPI.NET/issues/172)) ([7fd3af0](https://github.com/LEGO/AsyncAPI.NET/commit/7fd3af0e6669d18e805e0bab9cafac819ea64c1d)) + # [5.2.0](https://github.com/LEGO/AsyncAPI.NET/compare/v5.1.1...v5.2.0) (2024-03-30) From b1638bd43c82b1c9ac4a01013e337a17ae9a1e9f Mon Sep 17 00:00:00 2001 From: Alex Wichmann Date: Thu, 13 Jun 2024 09:01:35 +0200 Subject: [PATCH 5/8] chore: update readme (#179) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe9189f5..593dbd88 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,11 @@ The AsyncAPI.NET SDK contains a useful object model for the AsyncAPI specificati Install the NuGet packages: ### AsyncAPI.NET [![Nuget](https://img.shields.io/nuget/v/AsyncAPI.NET?label=AsyncAPI.NET&style=for-the-badge)](https://www.nuget.org/packages/AsyncAPI.NET/) -[![Nuget](https://img.shields.io/nuget/vpre/AsyncAPI.NET?label=AsyncAPI.NET&style=for-the-badge)](https://www.nuget.org/packages/AsyncAPI.NET/) +[![Nuget](https://img.shields.io/nuget/vpre/AsyncAPI.NET?label=AsyncAPI.NET-Preview&style=for-the-badge)](https://www.nuget.org/packages/AsyncAPI.NET/) ### AsyncAPI.Readers [![Nuget](https://img.shields.io/nuget/v/AsyncAPI.NET.Readers?label=AsyncAPI.Readers&style=for-the-badge)](https://www.nuget.org/packages/AsyncAPI.NET.Readers/) -[![Nuget](https://img.shields.io/nuget/vpre/AsyncAPI.NET.Readers?label=AsyncAPI.Readers&style=for-the-badge)](https://www.nuget.org/packages/AsyncAPI.NET.Readers/) +[![Nuget](https://img.shields.io/nuget/vpre/AsyncAPI.NET.Readers?label=AsyncAPI.Readers-Preview&style=for-the-badge)](https://www.nuget.org/packages/AsyncAPI.NET.Readers/) ### AsyncAPI.Bindings [![Nuget](https://img.shields.io/nuget/v/AsyncAPI.NET.Bindings?label=AsyncAPI.Bindings&style=for-the-badge)](https://www.nuget.org/packages/AsyncAPI.NET.Bindings/) From 47685cd19c7e58391625be043b1e5d82c49eedc8 Mon Sep 17 00:00:00 2001 From: Alex Wichmann Date: Fri, 14 Jun 2024 12:35:18 +0200 Subject: [PATCH 6/8] fix: resolving wrong reference (#180) --- .../Services/AsyncApiReferenceResolver.cs | 8 +++++- .../AsyncApiReaderTests.cs | 27 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/LEGO.AsyncAPI/Services/AsyncApiReferenceResolver.cs b/src/LEGO.AsyncAPI/Services/AsyncApiReferenceResolver.cs index da6195c6..b3c693e0 100644 --- a/src/LEGO.AsyncAPI/Services/AsyncApiReferenceResolver.cs +++ b/src/LEGO.AsyncAPI/Services/AsyncApiReferenceResolver.cs @@ -218,7 +218,13 @@ private T ResolveReference(AsyncApiReference reference) try { - return this.currentDocument.ResolveReference(reference) as T; + var resolvedReference = this.currentDocument.ResolveReference(reference) as T; + if (resolvedReference == null) + { + throw new AsyncApiException($"Cannot resolve reference '{reference.Reference}' to '{typeof(T).Name}'."); + } + + return resolvedReference; } catch (AsyncApiException ex) { diff --git a/test/LEGO.AsyncAPI.Tests/AsyncApiReaderTests.cs b/test/LEGO.AsyncAPI.Tests/AsyncApiReaderTests.cs index bf19a944..8953f2cd 100644 --- a/test/LEGO.AsyncAPI.Tests/AsyncApiReaderTests.cs +++ b/test/LEGO.AsyncAPI.Tests/AsyncApiReaderTests.cs @@ -6,6 +6,7 @@ namespace LEGO.AsyncAPI.Tests using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; + using FluentAssertions; using LEGO.AsyncAPI.Exceptions; using LEGO.AsyncAPI.Models; using LEGO.AsyncAPI.Models.Interfaces; @@ -336,6 +337,32 @@ public void Read_WithBasicPlusSecuritySchemeDeserializes() Assert.AreEqual("Provide your username and password for SASL/SCRAM authentication", scheme.Value.Description); } + [Test] + public void Read_WithWrongReference_AddsError() + { + var yaml = + """ + asyncapi: 2.3.0 + info: + title: test + version: 1.0.0 + channels: + workspace: + publish: + message: + $ref: '#/components/securitySchemes/saslScram' + components: + securitySchemes: + saslScram: + type: scramSha256 + description: Provide your username and password for SASL/SCRAM authentication + """; + var reader = new AsyncApiStringReader(); + var doc = reader.Read(yaml, out var diagnostic); + diagnostic.Errors.Should().NotBeEmpty(); + doc.Channels.Values.First().Publish.Message.First().Should().BeNull(); + } + [Test] public void Read_WithBasicPlusOAuthFlowDeserializes() { From 883515cec7e4b73005c547b2c18670080d29cd72 Mon Sep 17 00:00:00 2001 From: Alex Wichmann Date: Fri, 14 Jun 2024 18:18:49 +0200 Subject: [PATCH 7/8] ci: remove auto preview release --- .github/workflows/release-internal.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml index 971be8e7..1231b9e6 100644 --- a/.github/workflows/release-internal.yml +++ b/.github/workflows/release-internal.yml @@ -1,13 +1,5 @@ name: Publish beta NuGet package on: - push: - branches: [ main ] - paths: - - 'src/LEGO.AsyncAPI/**' - - 'src/LEGO.AsyncAPI.Readers/**' - - 'src/LEGO.AsyncAPI.Bindings/**' - - ".github/workflows/release-internal.yml" - - '!**/*.md' workflow_dispatch: jobs: From b586dd0a492742e203513487be78f8e9b32567eb Mon Sep 17 00:00:00 2001 From: Alex Wichmann Date: Fri, 14 Jun 2024 18:30:50 +0200 Subject: [PATCH 8/8] ci: update release to release from vnext as well --- release.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.config.js b/release.config.js index 7c6ba358..7cf37e87 100644 --- a/release.config.js +++ b/release.config.js @@ -1,5 +1,5 @@ module.exports = { - branches: "main", + branches: ["main", "vnext"], plugins: [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator",