Skip to content

Commit 7d39747

Browse files
authored
refactor: rename to AsyncApiJsonSchema to remove ambiguity (#205)
1 parent 3663254 commit 7d39747

34 files changed

+205
-205
lines changed

src/LEGO.AsyncAPI.Bindings/Http/HttpMessageBinding.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class HttpMessageBinding : MessageBinding<HttpMessageBinding>
1616
/// <summary>
1717
/// A Schema object containing the definitions for HTTP-specific headers. This schema MUST be of type object and have a properties key.
1818
/// </summary>
19-
public AsyncApiSchema Headers { get; set; }
19+
public AsyncApiJsonSchema Headers { get; set; }
2020

2121
/// <summary>
2222
/// Serialize to AsyncAPI V2 document without using reference.

src/LEGO.AsyncAPI.Bindings/Http/HttpOperationBinding.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public enum HttpOperationType
3636
/// <summary>
3737
/// A Schema object containing the definitions for each query parameter. This schema MUST be of type object and have a properties key.
3838
/// </summary>
39-
public AsyncApiSchema Query { get; set; }
39+
public AsyncApiJsonSchema Query { get; set; }
4040

4141
/// <summary>
4242
/// Serialize to AsyncAPI V2 document without using reference.

src/LEGO.AsyncAPI.Bindings/Kafka/KafkaMessageBinding.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class KafkaMessageBinding : MessageBinding<KafkaMessageBinding>
1616
/// <summary>
1717
/// The message key. NOTE: You can also use the <a href="https://www.asyncapi.com/docs/reference/specification/v2.4.0#referenceObject">reference object</a> way.
1818
/// </summary>
19-
public AsyncApiSchema Key { get; set; }
19+
public AsyncApiJsonSchema Key { get; set; }
2020

2121
/// <summary>
2222
/// If a Schema Registry is used when performing this operation, tells where the id of schema is stored (e.g. header or payload).

src/LEGO.AsyncAPI.Bindings/Kafka/KafkaOperationBinding.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public class KafkaOperationBinding : OperationBinding<KafkaOperationBinding>
1616
/// <summary>
1717
/// Id of the consumer group.
1818
/// </summary>
19-
public AsyncApiSchema GroupId { get; set; }
19+
public AsyncApiJsonSchema GroupId { get; set; }
2020

2121
/// <summary>
2222
/// Id of the consumer inside a consumer group.
2323
/// </summary>
24-
public AsyncApiSchema ClientId { get; set; }
24+
public AsyncApiJsonSchema ClientId { get; set; }
2525

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

src/LEGO.AsyncAPI.Bindings/MQTT/MQTTMessageBinding.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class MQTTMessageBinding : MessageBinding<MQTTMessageBinding>
2222
/// <summary>
2323
/// Correlation Data is used to identify the request the response message is for.
2424
/// </summary>
25-
public AsyncApiSchema CorrelationData { get; set; }
25+
public AsyncApiJsonSchema CorrelationData { get; set; }
2626

2727
/// <summary>
2828
/// String describing the content type of the message payload.

src/LEGO.AsyncAPI.Bindings/WebSockets/WebSocketsChannelBinding.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ public class WebSocketsChannelBinding : ChannelBinding<WebSocketsChannelBinding>
1818
/// <summary>
1919
/// A Schema object containing the definitions for each query parameter. This schema MUST be of type 'object' and have a 'properties' key.
2020
/// </summary>
21-
public AsyncApiSchema Query { get; set; }
21+
public AsyncApiJsonSchema Query { get; set; }
2222

2323
/// <summary>
2424
/// A Schema object containing the definitions of the HTTP headers to use when establishing the connection. This schma MUST be of type 'object' and have a 'properties' key.
2525
/// </summary>
26-
public AsyncApiSchema Headers { get; set; }
26+
public AsyncApiJsonSchema Headers { get; set; }
2727

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

src/LEGO.AsyncAPI.Readers/AsyncApiExternalReferenceResolver.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public override void Visit(AsyncApiMessage message)
9393
switch (message.Payload)
9494
{
9595
case AsyncApiJsonSchemaPayload json:
96-
this.ResolveObject<AsyncApiSchema>(message.Payload as AsyncApiJsonSchemaPayload, r => message.Payload = new AsyncApiJsonSchemaPayload(r));
96+
this.ResolveObject<AsyncApiJsonSchema>(message.Payload as AsyncApiJsonSchemaPayload, r => message.Payload = new AsyncApiJsonSchemaPayload(r));
9797
break;
9898
case AsyncApiAvroSchemaPayload avro:
9999
// ToFix: this might not resolve correctly.
@@ -153,7 +153,7 @@ public override void Visit(AsyncApiParameter parameter)
153153
/// <summary>
154154
/// Resolve all references used in a schema.
155155
/// </summary>
156-
public override void Visit(AsyncApiSchema schema)
156+
public override void Visit(AsyncApiJsonSchema schema)
157157
{
158158
this.ResolveObject(schema.Items, r => schema.Items = r);
159159
this.ResolveList(schema.OneOf);

src/LEGO.AsyncAPI.Readers/ParseNodes/AnyFieldMapParameter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ internal class AnyFieldMapParameter<T>
1010
public AnyFieldMapParameter(
1111
Func<T, AsyncApiAny> propertyGetter,
1212
Action<T, AsyncApiAny> propertySetter,
13-
Func<T, AsyncApiSchema> schemaGetter)
13+
Func<T, AsyncApiJsonSchema> schemaGetter)
1414
{
1515
this.PropertyGetter = propertyGetter;
1616
this.PropertySetter = propertySetter;
@@ -21,6 +21,6 @@ public AnyFieldMapParameter(
2121

2222
public Action<T, AsyncApiAny> PropertySetter { get; }
2323

24-
public Func<T, AsyncApiSchema> SchemaGetter { get; }
24+
public Func<T, AsyncApiJsonSchema> SchemaGetter { get; }
2525
}
2626
}

src/LEGO.AsyncAPI.Readers/ParseNodes/AnyListFieldMapParameter{T}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal class AnyListFieldMapParameter<T>
1111
public AnyListFieldMapParameter(
1212
Func<T, IList<AsyncApiAny>> propertyGetter,
1313
Action<T, IList<AsyncApiAny>> propertySetter,
14-
Func<T, AsyncApiSchema> schemaGetter)
14+
Func<T, AsyncApiJsonSchema> schemaGetter)
1515
{
1616
this.PropertyGetter = propertyGetter;
1717
this.PropertySetter = propertySetter;
@@ -22,6 +22,6 @@ public AnyListFieldMapParameter(
2222

2323
public Action<T, IList<AsyncApiAny>> PropertySetter { get; }
2424

25-
public Func<T, AsyncApiSchema> SchemaGetter { get; }
25+
public Func<T, AsyncApiJsonSchema> SchemaGetter { get; }
2626
}
2727
}

src/LEGO.AsyncAPI.Readers/ParseNodes/AnyMapFieldMapParameter{T,U}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public AnyMapFieldMapParameter(
1212
Func<T, IDictionary<string, U>> propertyMapGetter,
1313
Func<U, AsyncApiAny> propertyGetter,
1414
Action<U, AsyncApiAny> propertySetter,
15-
Func<T, AsyncApiSchema> schemaGetter)
15+
Func<T, AsyncApiJsonSchema> schemaGetter)
1616
{
1717
this.PropertyMapGetter = propertyMapGetter;
1818
this.PropertyGetter = propertyGetter;
@@ -26,6 +26,6 @@ public AnyMapFieldMapParameter(
2626

2727
public Action<U, AsyncApiAny> PropertySetter { get; }
2828

29-
public Func<T, AsyncApiSchema> SchemaGetter { get; }
29+
public Func<T, AsyncApiJsonSchema> SchemaGetter { get; }
3030
}
3131
}

src/LEGO.AsyncAPI.Readers/V2/AsyncApiSchemaDeserializer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace LEGO.AsyncAPI.Readers
1111

1212
public class AsyncApiSchemaDeserializer
1313
{
14-
private static readonly FixedFieldMap<AsyncApiSchema> schemaFixedFields = new()
14+
private static readonly FixedFieldMap<AsyncApiJsonSchema> schemaFixedFields = new()
1515
{
1616
{
1717
"title", (a, n) => { a.Title = n.GetScalarValue(); }
@@ -215,28 +215,28 @@ public class AsyncApiSchemaDeserializer
215215
},
216216
};
217217

218-
private static readonly PatternFieldMap<AsyncApiSchema> schemaPatternFields =
218+
private static readonly PatternFieldMap<AsyncApiJsonSchema> schemaPatternFields =
219219
new()
220220
{
221221
{ s => s.StartsWith("x-"), (o, p, n) => o.AddExtension(p, AsyncApiV2Deserializer.LoadExtension(p, n)) },
222222
};
223223

224-
public static AsyncApiSchema LoadSchema(ParseNode node)
224+
public static AsyncApiJsonSchema LoadSchema(ParseNode node)
225225
{
226226
var mapNode = node.CheckMapNode(AsyncApiConstants.Schema);
227227

228228
var pointer = mapNode.GetReferencePointer();
229229

230230
if (pointer != null)
231231
{
232-
return new AsyncApiSchema
232+
return new AsyncApiJsonSchema
233233
{
234234
UnresolvedReference = true,
235235
Reference = node.Context.VersionService.ConvertToAsyncApiReference(pointer, ReferenceType.Schema),
236236
};
237237
}
238238

239-
var schema = new AsyncApiSchema();
239+
var schema = new AsyncApiJsonSchema();
240240

241241
foreach (var propertyNode in mapNode)
242242
{

src/LEGO.AsyncAPI.Readers/V2/AsyncApiV2VersionService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public AsyncApiV2VersionService(AsyncApiDiagnostic diagnostic)
3535
[typeof(AsyncApiOAuthFlows)] = AsyncApiV2Deserializer.LoadOAuthFlows,
3636
[typeof(AsyncApiOperation)] = AsyncApiV2Deserializer.LoadOperation,
3737
[typeof(AsyncApiParameter)] = AsyncApiV2Deserializer.LoadParameter,
38-
[typeof(AsyncApiSchema)] = AsyncApiSchemaDeserializer.LoadSchema,
38+
[typeof(AsyncApiJsonSchema)] = AsyncApiSchemaDeserializer.LoadSchema,
3939
[typeof(AvroSchema)] = AsyncApiAvroSchemaDeserializer.LoadSchema,
4040
[typeof(AsyncApiJsonSchemaPayload)] = AsyncApiV2Deserializer.LoadJsonSchemaPayload,
4141
[typeof(AsyncApiAvroSchemaPayload)] = AsyncApiV2Deserializer.LoadAvroPayload,

src/LEGO.AsyncAPI/Models/AsyncApiComponents.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class AsyncApiComponents : IAsyncApiExtensible, IAsyncApiSerializable
1919
/// <summary>
2020
/// An object to hold reusable Schema Objects.
2121
/// </summary>
22-
public IDictionary<string, AsyncApiSchema> Schemas { get; set; } = new Dictionary<string, AsyncApiSchema>();
22+
public IDictionary<string, AsyncApiJsonSchema> Schemas { get; set; } = new Dictionary<string, AsyncApiJsonSchema>();
2323

2424
/// <summary>
2525
/// An object to hold reusable Server Objects.
@@ -101,10 +101,10 @@ public void SerializeV2(IAsyncApiWriter writer)
101101
{
102102
var loops = writer.GetSettings().LoopDetector.Loops;
103103
writer.WriteStartObject();
104-
if (loops.TryGetValue(typeof(AsyncApiSchema), out List<object> schemas))
104+
if (loops.TryGetValue(typeof(AsyncApiJsonSchema), out List<object> schemas))
105105
{
106-
var asyncApiSchemas = schemas.Cast<AsyncApiSchema>().Distinct().ToList()
107-
.ToDictionary<AsyncApiSchema, string>(k => k.Reference.Id);
106+
var asyncApiSchemas = schemas.Cast<AsyncApiJsonSchema>().Distinct().ToList()
107+
.ToDictionary<AsyncApiJsonSchema, string>(k => k.Reference.Id);
108108

109109
writer.WriteOptionalMap(
110110
AsyncApiConstants.Schemas,

src/LEGO.AsyncAPI/Models/AsyncApiMessage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class AsyncApiMessage : IAsyncApiExtensible, IAsyncApiReferenceable, IAsy
2020
/// <summary>
2121
/// schema definition of the application headers. Schema MUST be of type "object".
2222
/// </summary>
23-
public AsyncApiSchema Headers { get; set; }
23+
public AsyncApiJsonSchema Headers { get; set; }
2424

2525
/// <summary>
2626
/// definition of the message payload. It can be of any type but defaults to Schema object. It must match the schema format, including encoding type - e.g Avro should be inlined as either a YAML or JSON object NOT a string to be parsed as YAML or JSON.

src/LEGO.AsyncAPI/Models/AsyncApiMessageTrait.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class AsyncApiMessageTrait : IAsyncApiExtensible, IAsyncApiReferenceable,
2020
/// <summary>
2121
/// schema definition of the application headers. Schema MUST be of type "object".
2222
/// </summary>
23-
public AsyncApiSchema Headers { get; set; }
23+
public AsyncApiJsonSchema Headers { get; set; }
2424

2525
/// <summary>
2626
/// definition of the correlation ID used for message tracing or matching.

src/LEGO.AsyncAPI/Models/AsyncApiParameter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class AsyncApiParameter : IAsyncApiReferenceable, IAsyncApiExtensible, IA
2020
/// <summary>
2121
/// Gets or sets definition of the parameter.
2222
/// </summary>
23-
public AsyncApiSchema Schema { get; set; }
23+
public AsyncApiJsonSchema Schema { get; set; }
2424

2525
/// <summary>
2626
/// Gets or sets a runtime expression that specifies the location of the parameter value.

src/LEGO.AsyncAPI/Models/AsyncApiSchemaPayload.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ namespace LEGO.AsyncAPI.Models
88

99
public class AsyncApiJsonSchemaPayload : IAsyncApiMessagePayload
1010
{
11-
private readonly AsyncApiSchema schema;
11+
private readonly AsyncApiJsonSchema schema;
1212

1313
public AsyncApiJsonSchemaPayload()
1414
{
15-
this.schema = new AsyncApiSchema();
15+
this.schema = new AsyncApiJsonSchema();
1616
}
1717

18-
public AsyncApiJsonSchemaPayload(AsyncApiSchema schema)
18+
public AsyncApiJsonSchemaPayload(AsyncApiJsonSchema schema)
1919
{
2020
this.schema = schema;
2121
}
@@ -50,43 +50,43 @@ public AsyncApiJsonSchemaPayload(AsyncApiSchema schema)
5050

5151
public bool WriteOnly { get => this.schema.WriteOnly; set => this.schema.WriteOnly = value; }
5252

53-
public IList<AsyncApiSchema> AllOf { get => this.schema.AllOf; set => this.schema.AllOf = value; }
53+
public IList<AsyncApiJsonSchema> AllOf { get => this.schema.AllOf; set => this.schema.AllOf = value; }
5454

55-
public IList<AsyncApiSchema> OneOf { get => this.schema.OneOf; set => this.schema.OneOf = value; }
55+
public IList<AsyncApiJsonSchema> OneOf { get => this.schema.OneOf; set => this.schema.OneOf = value; }
5656

57-
public IList<AsyncApiSchema> AnyOf { get => this.schema.AnyOf; set => this.schema.AnyOf = value; }
57+
public IList<AsyncApiJsonSchema> AnyOf { get => this.schema.AnyOf; set => this.schema.AnyOf = value; }
5858

59-
public AsyncApiSchema Not { get => this.schema.Not; set => this.schema.Not = value; }
59+
public AsyncApiJsonSchema Not { get => this.schema.Not; set => this.schema.Not = value; }
6060

61-
public AsyncApiSchema Contains { get => this.schema.Contains; set => this.schema.Contains = value; }
61+
public AsyncApiJsonSchema Contains { get => this.schema.Contains; set => this.schema.Contains = value; }
6262

63-
public AsyncApiSchema If { get => this.schema.If; set => this.schema.If = value; }
63+
public AsyncApiJsonSchema If { get => this.schema.If; set => this.schema.If = value; }
6464

65-
public AsyncApiSchema Then { get => this.schema.Then; set => this.schema.Then = value; }
65+
public AsyncApiJsonSchema Then { get => this.schema.Then; set => this.schema.Then = value; }
6666

67-
public AsyncApiSchema Else { get => this.schema.Else; set => this.schema.Else = value; }
67+
public AsyncApiJsonSchema Else { get => this.schema.Else; set => this.schema.Else = value; }
6868

6969
public ISet<string> Required { get => this.schema.Required; set => this.schema.Required = value; }
7070

71-
public AsyncApiSchema Items { get => this.schema.Items; set => this.schema.Items = value; }
71+
public AsyncApiJsonSchema Items { get => this.schema.Items; set => this.schema.Items = value; }
7272

73-
public AsyncApiSchema AdditionalItems { get => this.schema.AdditionalItems; set => this.schema.AdditionalItems = value; }
73+
public AsyncApiJsonSchema AdditionalItems { get => this.schema.AdditionalItems; set => this.schema.AdditionalItems = value; }
7474

7575
public int? MaxItems { get => this.schema.MaxItems; set => this.schema.MaxItems = value; }
7676

7777
public int? MinItems { get => this.schema.MinItems; set => this.schema.MinItems = value; }
7878

7979
public bool? UniqueItems { get => this.schema.UniqueItems; set => this.schema.UniqueItems = value; }
8080

81-
public IDictionary<string, AsyncApiSchema> Properties { get => this.schema.Properties; set => this.schema.Properties = value; }
81+
public IDictionary<string, AsyncApiJsonSchema> Properties { get => this.schema.Properties; set => this.schema.Properties = value; }
8282

8383
public int? MaxProperties { get => this.schema.MaxProperties; set => this.schema.MaxProperties = value; }
8484

8585
public int? MinProperties { get => this.schema.MinProperties; set => this.schema.MinProperties = value; }
8686

87-
public IDictionary<string, AsyncApiSchema> PatternProperties { get => this.schema.PatternProperties; set => this.schema.PatternProperties = value; }
87+
public IDictionary<string, AsyncApiJsonSchema> PatternProperties { get => this.schema.PatternProperties; set => this.schema.PatternProperties = value; }
8888

89-
public AsyncApiSchema PropertyNames { get => this.schema.PropertyNames; set => this.schema.PropertyNames = value; }
89+
public AsyncApiJsonSchema PropertyNames { get => this.schema.PropertyNames; set => this.schema.PropertyNames = value; }
9090

9191
public string Discriminator { get => this.schema.Discriminator; set => this.schema.Discriminator = value; }
9292

@@ -108,11 +108,11 @@ public AsyncApiJsonSchemaPayload(AsyncApiSchema schema)
108108

109109
public IDictionary<string, IAsyncApiExtension> Extensions { get => this.schema.Extensions; set => this.schema.Extensions = value; }
110110

111-
public AsyncApiSchema AdditionalProperties { get => this.schema.AdditionalProperties; set => this.schema.AdditionalProperties = value; }
111+
public AsyncApiJsonSchema AdditionalProperties { get => this.schema.AdditionalProperties; set => this.schema.AdditionalProperties = value; }
112112

113-
public static implicit operator AsyncApiSchema(AsyncApiJsonSchemaPayload payload) => payload.schema;
113+
public static implicit operator AsyncApiJsonSchema(AsyncApiJsonSchemaPayload payload) => payload.schema;
114114

115-
public static implicit operator AsyncApiJsonSchemaPayload(AsyncApiSchema schema) => new AsyncApiJsonSchemaPayload(schema);
115+
public static implicit operator AsyncApiJsonSchemaPayload(AsyncApiJsonSchema schema) => new AsyncApiJsonSchemaPayload(schema);
116116

117117
public void SerializeV2(IAsyncApiWriter writer)
118118
{

0 commit comments

Comments
 (0)