Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -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); } },
};

Expand Down
21 changes: 21 additions & 0 deletions test/LEGO.AsyncAPI.Tests/Models/AsyncApiChannel_Should.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<AsyncApiChannel>(input, AsyncApiVersion.AsyncApi2_0, out var _ );
channel.Parameters.First().Value.Reference.Should().BeNull();
}

[Test]
public void AsyncApiChannel_WithWebSocketsBinding_Serializes()
{
Expand Down