Skip to content

Commit a54f086

Browse files
author
Eamonn Moloney
committed
Refactored test cases to make testing easier. Now, the layout places the sample files next to the class files making it much easier to fidn the files you want.
1 parent 907dba8 commit a54f086

46 files changed

Lines changed: 444 additions & 215 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/LEGO.AsyncAPI/AsyncAPIReaderNewtonJson.cs renamed to src/LEGO.AsyncAPI/AsyncApiAsyncApiReaderNewtonJson.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using LEGO.AsyncAPI.Any;
2-
using LEGO.AsyncAPI.Models;
3-
using Newtonsoft.Json;
4-
51
namespace LEGO.AsyncAPI
62
{
7-
public class AsyncApiReaderNewtonJson<T>: IReader<T>
3+
using LEGO.AsyncAPI.Any;
4+
using LEGO.AsyncAPI.Models;
5+
using Newtonsoft.Json;
6+
7+
public class AsyncApiAsyncApiReaderNewtonJson<T>: IAsyncApiReader<T>
88
{
99
public T Consume(Stream stream)
1010
{

src/LEGO.AsyncAPI/AsyncAPIWriter.cs renamed to src/LEGO.AsyncAPI/AsyncApiWriterNewtonJson.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using Newtonsoft.Json;
2-
31
namespace LEGO.AsyncAPI
42
{
5-
public class AsyncApiWriter<T>
3+
using Newtonsoft.Json;
4+
5+
public class AsyncApiWriterNewtonJson<T> : IAsyncApiWriter<T>
66
{
77
public string Produce(T asyncApiDocument)
88
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace LEGO.AsyncAPI
22
{
3-
public interface IReader<T>
3+
public interface IAsyncApiReader<T>
44
{
55
public T Consume(Stream jsonDocument);
66
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace LEGO.AsyncAPI;
2+
3+
public interface IAsyncApiWriter<T>
4+
{
5+
string Produce(T asyncApiDocument);
6+
}

‎src/LEGO.AsyncAPI/Models/AsyncApiDocument.cs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright (c) The LEGO Group. All rights reserved.
22

3+
using LEGO.AsyncAPI.Any;
4+
using LEGO.AsyncAPI.Models.Interfaces;
5+
using Newtonsoft.Json.Linq;
6+
37
namespace LEGO.AsyncAPI.Models
48
{
59
using System.Collections.Generic;
@@ -65,6 +69,6 @@ public class AsyncApiDocument : IExtensible
6569

6670
/// <inheritdoc/>
6771
[JsonIgnore]
68-
public IDictionary<string, string> Extensions { get; set; } = new Dictionary<string, string>();
72+
public IDictionary<string, JToken> Extensions { get; set; }
6973
}
7074
}

‎src/LEGO.AsyncAPI/Models/Channel.cs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright (c) The LEGO Group. All rights reserved.
22

3+
using LEGO.AsyncAPI.Any;
4+
using LEGO.AsyncAPI.Models.Interfaces;
5+
using Newtonsoft.Json.Linq;
6+
37
namespace LEGO.AsyncAPI.Models
48
{
59
/// <summary>
@@ -31,7 +35,7 @@ public class Channel : IReferenceable, IExtensible
3135
public Operation Publish { get; set; }
3236

3337
/// <inheritdoc/>
34-
public IDictionary<string, string> Extensions { get; set; } = new Dictionary<string, string>();
38+
public IDictionary<string, JToken> Extensions { get; set; }
3539

3640
/// <inheritdoc/>
3741
public bool UnresolvedReference { get; set; }

‎src/LEGO.AsyncAPI/Models/Components.cs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright (c) The LEGO Group. All rights reserved.
22

3+
using LEGO.AsyncAPI.Any;
4+
using LEGO.AsyncAPI.Models.Interfaces;
5+
using Newtonsoft.Json.Linq;
6+
37
namespace LEGO.AsyncAPI.Models
48
{
59
/// <summary>
@@ -66,6 +70,6 @@ public class Components : IExtensible
6670
public IDictionary<string, IMessageBinding> MessageBindings { get; set; } = new Dictionary<string, IMessageBinding>();
6771

6872
/// <inheritdoc/>
69-
public IDictionary<string, string> Extensions { get; set; } = new Dictionary<string, string>();
73+
public IDictionary<string, JToken> Extensions { get; set; }
7074
}
7175
}

‎src/LEGO.AsyncAPI/Models/Contact.cs‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
namespace LEGO.AsyncAPI.Models
44
{
5+
using LEGO.AsyncAPI.Models.Interfaces;
6+
using Newtonsoft.Json;
7+
using Newtonsoft.Json.Linq;
8+
59
/// <summary>
610
/// Contact information for the exposed API.
711
/// </summary>
@@ -10,19 +14,23 @@ public class Contact : IExtensible
1014
/// <summary>
1115
/// The identifying name of the contact person/organization.
1216
/// </summary>
17+
[JsonProperty("name")]
1318
public string Name { get; set; }
1419

1520
/// <summary>
1621
/// The URL pointing to the contact information. MUST be in the format of a URL.
1722
/// </summary>
23+
[JsonProperty("uri")]
1824
public Uri Url { get; set; }
1925

2026
/// <summary>
2127
/// The email address of the contact person/organization. MUST be in the format of an email address.
2228
/// </summary>
29+
[JsonProperty("email")]
2330
public string Email { get; set; }
2431

2532
/// <inheritdoc/>
26-
public IDictionary<string, string> Extensions { get; set; } = new Dictionary<string, string>();
33+
[JsonExtensionData]
34+
public IDictionary<string, JToken> Extensions { get; set; }
2735
}
2836
}

‎src/LEGO.AsyncAPI/Models/CorrelationId.cs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright (c) The LEGO Group. All rights reserved.
22

3+
using LEGO.AsyncAPI.Any;
4+
using LEGO.AsyncAPI.Models.Interfaces;
35
using Newtonsoft.Json;
6+
using Newtonsoft.Json.Linq;
47

58
namespace LEGO.AsyncAPI.Models
69
{
@@ -28,6 +31,6 @@ public class CorrelationId : IReferenceable, IExtensible
2831

2932
/// <inheritdoc/>
3033
[JsonIgnore]
31-
public IDictionary<string, string> Extensions { get; set; } = new Dictionary<string, string>();
34+
public IDictionary<string, JToken> Extensions { get; set; }
3235
}
3336
}

‎src/LEGO.AsyncAPI/Models/ExternalDocumentation.cs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright (c) The LEGO Group. All rights reserved.
22

3+
using LEGO.AsyncAPI.Any;
4+
using LEGO.AsyncAPI.Models.Interfaces;
35
using Newtonsoft.Json;
6+
using Newtonsoft.Json.Linq;
47

58
namespace LEGO.AsyncAPI.Models
69
{
@@ -21,6 +24,6 @@ public class ExternalDocumentation : IExtensible
2124

2225
/// <inheritdoc/>
2326
[JsonIgnore]
24-
public IDictionary<string, string> Extensions { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
27+
public IDictionary<string, JToken> Extensions { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
2528
}
2629
}

0 commit comments

Comments
 (0)