diff --git a/src/LEGO.AsyncAPI.Bindings/Http/HttpMessageBinding.cs b/src/LEGO.AsyncAPI.Bindings/Http/HttpMessageBinding.cs index cbf65bc4..b6c7bf78 100644 --- a/src/LEGO.AsyncAPI.Bindings/Http/HttpMessageBinding.cs +++ b/src/LEGO.AsyncAPI.Bindings/Http/HttpMessageBinding.cs @@ -16,7 +16,7 @@ public class HttpMessageBinding : MessageBinding /// /// A Schema object containing the definitions for HTTP-specific headers. This schema MUST be of type object and have a properties key. /// - public AsyncApiSchema Headers { get; set; } + public AsyncApiJsonSchema Headers { get; set; } /// /// Serialize to AsyncAPI V2 document without using reference. diff --git a/src/LEGO.AsyncAPI.Bindings/Http/HttpOperationBinding.cs b/src/LEGO.AsyncAPI.Bindings/Http/HttpOperationBinding.cs index 7b88d31b..b7f1215e 100644 --- a/src/LEGO.AsyncAPI.Bindings/Http/HttpOperationBinding.cs +++ b/src/LEGO.AsyncAPI.Bindings/Http/HttpOperationBinding.cs @@ -36,7 +36,7 @@ public enum HttpOperationType /// /// A Schema object containing the definitions for each query parameter. This schema MUST be of type object and have a properties key. /// - public AsyncApiSchema Query { get; set; } + public AsyncApiJsonSchema Query { get; set; } /// /// Serialize to AsyncAPI V2 document without using reference. diff --git a/src/LEGO.AsyncAPI.Bindings/Kafka/KafkaMessageBinding.cs b/src/LEGO.AsyncAPI.Bindings/Kafka/KafkaMessageBinding.cs index 2e57b50a..e63c95e1 100644 --- a/src/LEGO.AsyncAPI.Bindings/Kafka/KafkaMessageBinding.cs +++ b/src/LEGO.AsyncAPI.Bindings/Kafka/KafkaMessageBinding.cs @@ -16,7 +16,7 @@ public class KafkaMessageBinding : MessageBinding /// /// The message key. NOTE: You can also use the reference object way. /// - public AsyncApiSchema Key { get; set; } + public AsyncApiJsonSchema Key { get; set; } /// /// If a Schema Registry is used when performing this operation, tells where the id of schema is stored (e.g. header or payload). diff --git a/src/LEGO.AsyncAPI.Bindings/Kafka/KafkaOperationBinding.cs b/src/LEGO.AsyncAPI.Bindings/Kafka/KafkaOperationBinding.cs index b6c6e046..358a929b 100644 --- a/src/LEGO.AsyncAPI.Bindings/Kafka/KafkaOperationBinding.cs +++ b/src/LEGO.AsyncAPI.Bindings/Kafka/KafkaOperationBinding.cs @@ -16,12 +16,12 @@ public class KafkaOperationBinding : OperationBinding /// /// Id of the consumer group. /// - public AsyncApiSchema GroupId { get; set; } + public AsyncApiJsonSchema GroupId { get; set; } /// /// Id of the consumer inside a consumer group. /// - public AsyncApiSchema ClientId { get; set; } + public AsyncApiJsonSchema ClientId { get; set; } public override string BindingKey => "kafka"; diff --git a/src/LEGO.AsyncAPI.Bindings/MQTT/MQTTMessageBinding.cs b/src/LEGO.AsyncAPI.Bindings/MQTT/MQTTMessageBinding.cs index 597cc4c7..338230ac 100644 --- a/src/LEGO.AsyncAPI.Bindings/MQTT/MQTTMessageBinding.cs +++ b/src/LEGO.AsyncAPI.Bindings/MQTT/MQTTMessageBinding.cs @@ -22,7 +22,7 @@ public class MQTTMessageBinding : MessageBinding /// /// Correlation Data is used to identify the request the response message is for. /// - public AsyncApiSchema CorrelationData { get; set; } + public AsyncApiJsonSchema CorrelationData { get; set; } /// /// String describing the content type of the message payload. diff --git a/src/LEGO.AsyncAPI.Bindings/WebSockets/WebSocketsChannelBinding.cs b/src/LEGO.AsyncAPI.Bindings/WebSockets/WebSocketsChannelBinding.cs index 8827bea4..4321c879 100644 --- a/src/LEGO.AsyncAPI.Bindings/WebSockets/WebSocketsChannelBinding.cs +++ b/src/LEGO.AsyncAPI.Bindings/WebSockets/WebSocketsChannelBinding.cs @@ -18,12 +18,12 @@ public class WebSocketsChannelBinding : ChannelBinding /// /// A Schema object containing the definitions for each query parameter. This schema MUST be of type 'object' and have a 'properties' key. /// - public AsyncApiSchema Query { get; set; } + public AsyncApiJsonSchema Query { get; set; } /// /// 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. /// - public AsyncApiSchema Headers { get; set; } + public AsyncApiJsonSchema Headers { get; set; } public override string BindingKey => "websockets"; diff --git a/src/LEGO.AsyncAPI.Readers/AsyncApiExternalReferenceResolver.cs b/src/LEGO.AsyncAPI.Readers/AsyncApiExternalReferenceResolver.cs index 0f2044a1..a207344a 100644 --- a/src/LEGO.AsyncAPI.Readers/AsyncApiExternalReferenceResolver.cs +++ b/src/LEGO.AsyncAPI.Readers/AsyncApiExternalReferenceResolver.cs @@ -93,7 +93,7 @@ public override void Visit(AsyncApiMessage message) switch (message.Payload) { case AsyncApiJsonSchemaPayload json: - this.ResolveObject(message.Payload as AsyncApiJsonSchemaPayload, r => message.Payload = new AsyncApiJsonSchemaPayload(r)); + this.ResolveObject(message.Payload as AsyncApiJsonSchemaPayload, r => message.Payload = new AsyncApiJsonSchemaPayload(r)); break; case AsyncApiAvroSchemaPayload avro: // ToFix: this might not resolve correctly. @@ -153,7 +153,7 @@ public override void Visit(AsyncApiParameter parameter) /// /// Resolve all references used in a schema. /// - public override void Visit(AsyncApiSchema schema) + public override void Visit(AsyncApiJsonSchema schema) { this.ResolveObject(schema.Items, r => schema.Items = r); this.ResolveList(schema.OneOf); diff --git a/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyFieldMapParameter.cs b/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyFieldMapParameter.cs index 76e9008a..98ded2f6 100644 --- a/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyFieldMapParameter.cs +++ b/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyFieldMapParameter.cs @@ -10,7 +10,7 @@ internal class AnyFieldMapParameter public AnyFieldMapParameter( Func propertyGetter, Action propertySetter, - Func schemaGetter) + Func schemaGetter) { this.PropertyGetter = propertyGetter; this.PropertySetter = propertySetter; @@ -21,6 +21,6 @@ public AnyFieldMapParameter( public Action PropertySetter { get; } - public Func SchemaGetter { get; } + public Func SchemaGetter { get; } } } \ No newline at end of file diff --git a/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyListFieldMapParameter{T}.cs b/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyListFieldMapParameter{T}.cs index ee1af993..15aafb4f 100644 --- a/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyListFieldMapParameter{T}.cs +++ b/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyListFieldMapParameter{T}.cs @@ -11,7 +11,7 @@ internal class AnyListFieldMapParameter public AnyListFieldMapParameter( Func> propertyGetter, Action> propertySetter, - Func schemaGetter) + Func schemaGetter) { this.PropertyGetter = propertyGetter; this.PropertySetter = propertySetter; @@ -22,6 +22,6 @@ public AnyListFieldMapParameter( public Action> PropertySetter { get; } - public Func SchemaGetter { get; } + public Func SchemaGetter { get; } } } \ No newline at end of file diff --git a/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyMapFieldMapParameter{T,U}.cs b/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyMapFieldMapParameter{T,U}.cs index 2399fe31..9b36f6fa 100644 --- a/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyMapFieldMapParameter{T,U}.cs +++ b/src/LEGO.AsyncAPI.Readers/ParseNodes/AnyMapFieldMapParameter{T,U}.cs @@ -12,7 +12,7 @@ public AnyMapFieldMapParameter( Func> propertyMapGetter, Func propertyGetter, Action propertySetter, - Func schemaGetter) + Func schemaGetter) { this.PropertyMapGetter = propertyMapGetter; this.PropertyGetter = propertyGetter; @@ -26,6 +26,6 @@ public AnyMapFieldMapParameter( public Action PropertySetter { get; } - public Func SchemaGetter { get; } + public Func SchemaGetter { get; } } } \ No newline at end of file diff --git a/src/LEGO.AsyncAPI.Readers/V2/AsyncApiSchemaDeserializer.cs b/src/LEGO.AsyncAPI.Readers/V2/AsyncApiSchemaDeserializer.cs index b8e790f2..ba3130a0 100644 --- a/src/LEGO.AsyncAPI.Readers/V2/AsyncApiSchemaDeserializer.cs +++ b/src/LEGO.AsyncAPI.Readers/V2/AsyncApiSchemaDeserializer.cs @@ -11,7 +11,7 @@ namespace LEGO.AsyncAPI.Readers public class AsyncApiSchemaDeserializer { - private static readonly FixedFieldMap schemaFixedFields = new() + private static readonly FixedFieldMap schemaFixedFields = new() { { "title", (a, n) => { a.Title = n.GetScalarValue(); } @@ -215,13 +215,13 @@ public class AsyncApiSchemaDeserializer }, }; - private static readonly PatternFieldMap schemaPatternFields = + private static readonly PatternFieldMap schemaPatternFields = new() { { s => s.StartsWith("x-"), (o, p, n) => o.AddExtension(p, AsyncApiV2Deserializer.LoadExtension(p, n)) }, }; - public static AsyncApiSchema LoadSchema(ParseNode node) + public static AsyncApiJsonSchema LoadSchema(ParseNode node) { var mapNode = node.CheckMapNode(AsyncApiConstants.Schema); @@ -229,14 +229,14 @@ public static AsyncApiSchema LoadSchema(ParseNode node) if (pointer != null) { - return new AsyncApiSchema + return new AsyncApiJsonSchema { UnresolvedReference = true, Reference = node.Context.VersionService.ConvertToAsyncApiReference(pointer, ReferenceType.Schema), }; } - var schema = new AsyncApiSchema(); + var schema = new AsyncApiJsonSchema(); foreach (var propertyNode in mapNode) { diff --git a/src/LEGO.AsyncAPI.Readers/V2/AsyncApiV2VersionService.cs b/src/LEGO.AsyncAPI.Readers/V2/AsyncApiV2VersionService.cs index 4acc3395..d70f5bde 100644 --- a/src/LEGO.AsyncAPI.Readers/V2/AsyncApiV2VersionService.cs +++ b/src/LEGO.AsyncAPI.Readers/V2/AsyncApiV2VersionService.cs @@ -35,7 +35,7 @@ public AsyncApiV2VersionService(AsyncApiDiagnostic diagnostic) [typeof(AsyncApiOAuthFlows)] = AsyncApiV2Deserializer.LoadOAuthFlows, [typeof(AsyncApiOperation)] = AsyncApiV2Deserializer.LoadOperation, [typeof(AsyncApiParameter)] = AsyncApiV2Deserializer.LoadParameter, - [typeof(AsyncApiSchema)] = AsyncApiSchemaDeserializer.LoadSchema, + [typeof(AsyncApiJsonSchema)] = AsyncApiSchemaDeserializer.LoadSchema, [typeof(AvroSchema)] = AsyncApiAvroSchemaDeserializer.LoadSchema, [typeof(AsyncApiJsonSchemaPayload)] = AsyncApiV2Deserializer.LoadJsonSchemaPayload, [typeof(AsyncApiAvroSchemaPayload)] = AsyncApiV2Deserializer.LoadAvroPayload, diff --git a/src/LEGO.AsyncAPI/Models/AsyncApiComponents.cs b/src/LEGO.AsyncAPI/Models/AsyncApiComponents.cs index 6c8a2a4c..b64f5a66 100644 --- a/src/LEGO.AsyncAPI/Models/AsyncApiComponents.cs +++ b/src/LEGO.AsyncAPI/Models/AsyncApiComponents.cs @@ -19,7 +19,7 @@ public class AsyncApiComponents : IAsyncApiExtensible, IAsyncApiSerializable /// /// An object to hold reusable Schema Objects. /// - public IDictionary Schemas { get; set; } = new Dictionary(); + public IDictionary Schemas { get; set; } = new Dictionary(); /// /// An object to hold reusable Server Objects. @@ -101,10 +101,10 @@ public void SerializeV2(IAsyncApiWriter writer) { var loops = writer.GetSettings().LoopDetector.Loops; writer.WriteStartObject(); - if (loops.TryGetValue(typeof(AsyncApiSchema), out List schemas)) + if (loops.TryGetValue(typeof(AsyncApiJsonSchema), out List schemas)) { - var asyncApiSchemas = schemas.Cast().Distinct().ToList() - .ToDictionary(k => k.Reference.Id); + var asyncApiSchemas = schemas.Cast().Distinct().ToList() + .ToDictionary(k => k.Reference.Id); writer.WriteOptionalMap( AsyncApiConstants.Schemas, diff --git a/src/LEGO.AsyncAPI/Models/AsyncApiMessage.cs b/src/LEGO.AsyncAPI/Models/AsyncApiMessage.cs index b4848bf6..e0cc6776 100644 --- a/src/LEGO.AsyncAPI/Models/AsyncApiMessage.cs +++ b/src/LEGO.AsyncAPI/Models/AsyncApiMessage.cs @@ -20,7 +20,7 @@ public class AsyncApiMessage : IAsyncApiExtensible, IAsyncApiReferenceable, IAsy /// /// schema definition of the application headers. Schema MUST be of type "object". /// - public AsyncApiSchema Headers { get; set; } + public AsyncApiJsonSchema Headers { get; set; } /// /// 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. diff --git a/src/LEGO.AsyncAPI/Models/AsyncApiMessageTrait.cs b/src/LEGO.AsyncAPI/Models/AsyncApiMessageTrait.cs index 856fb7cd..c14a9a24 100644 --- a/src/LEGO.AsyncAPI/Models/AsyncApiMessageTrait.cs +++ b/src/LEGO.AsyncAPI/Models/AsyncApiMessageTrait.cs @@ -20,7 +20,7 @@ public class AsyncApiMessageTrait : IAsyncApiExtensible, IAsyncApiReferenceable, /// /// schema definition of the application headers. Schema MUST be of type "object". /// - public AsyncApiSchema Headers { get; set; } + public AsyncApiJsonSchema Headers { get; set; } /// /// definition of the correlation ID used for message tracing or matching. diff --git a/src/LEGO.AsyncAPI/Models/AsyncApiParameter.cs b/src/LEGO.AsyncAPI/Models/AsyncApiParameter.cs index fd925c7b..4c3ef683 100644 --- a/src/LEGO.AsyncAPI/Models/AsyncApiParameter.cs +++ b/src/LEGO.AsyncAPI/Models/AsyncApiParameter.cs @@ -20,7 +20,7 @@ public class AsyncApiParameter : IAsyncApiReferenceable, IAsyncApiExtensible, IA /// /// Gets or sets definition of the parameter. /// - public AsyncApiSchema Schema { get; set; } + public AsyncApiJsonSchema Schema { get; set; } /// /// Gets or sets a runtime expression that specifies the location of the parameter value. diff --git a/src/LEGO.AsyncAPI/Models/AsyncApiSchemaPayload.cs b/src/LEGO.AsyncAPI/Models/AsyncApiSchemaPayload.cs index 9e182265..91c6f68f 100644 --- a/src/LEGO.AsyncAPI/Models/AsyncApiSchemaPayload.cs +++ b/src/LEGO.AsyncAPI/Models/AsyncApiSchemaPayload.cs @@ -8,14 +8,14 @@ namespace LEGO.AsyncAPI.Models public class AsyncApiJsonSchemaPayload : IAsyncApiMessagePayload { - private readonly AsyncApiSchema schema; + private readonly AsyncApiJsonSchema schema; public AsyncApiJsonSchemaPayload() { - this.schema = new AsyncApiSchema(); + this.schema = new AsyncApiJsonSchema(); } - public AsyncApiJsonSchemaPayload(AsyncApiSchema schema) + public AsyncApiJsonSchemaPayload(AsyncApiJsonSchema schema) { this.schema = schema; } @@ -50,27 +50,27 @@ public AsyncApiJsonSchemaPayload(AsyncApiSchema schema) public bool WriteOnly { get => this.schema.WriteOnly; set => this.schema.WriteOnly = value; } - public IList AllOf { get => this.schema.AllOf; set => this.schema.AllOf = value; } + public IList AllOf { get => this.schema.AllOf; set => this.schema.AllOf = value; } - public IList OneOf { get => this.schema.OneOf; set => this.schema.OneOf = value; } + public IList OneOf { get => this.schema.OneOf; set => this.schema.OneOf = value; } - public IList AnyOf { get => this.schema.AnyOf; set => this.schema.AnyOf = value; } + public IList AnyOf { get => this.schema.AnyOf; set => this.schema.AnyOf = value; } - public AsyncApiSchema Not { get => this.schema.Not; set => this.schema.Not = value; } + public AsyncApiJsonSchema Not { get => this.schema.Not; set => this.schema.Not = value; } - public AsyncApiSchema Contains { get => this.schema.Contains; set => this.schema.Contains = value; } + public AsyncApiJsonSchema Contains { get => this.schema.Contains; set => this.schema.Contains = value; } - public AsyncApiSchema If { get => this.schema.If; set => this.schema.If = value; } + public AsyncApiJsonSchema If { get => this.schema.If; set => this.schema.If = value; } - public AsyncApiSchema Then { get => this.schema.Then; set => this.schema.Then = value; } + public AsyncApiJsonSchema Then { get => this.schema.Then; set => this.schema.Then = value; } - public AsyncApiSchema Else { get => this.schema.Else; set => this.schema.Else = value; } + public AsyncApiJsonSchema Else { get => this.schema.Else; set => this.schema.Else = value; } public ISet Required { get => this.schema.Required; set => this.schema.Required = value; } - public AsyncApiSchema Items { get => this.schema.Items; set => this.schema.Items = value; } + public AsyncApiJsonSchema Items { get => this.schema.Items; set => this.schema.Items = value; } - public AsyncApiSchema AdditionalItems { get => this.schema.AdditionalItems; set => this.schema.AdditionalItems = value; } + public AsyncApiJsonSchema AdditionalItems { get => this.schema.AdditionalItems; set => this.schema.AdditionalItems = value; } public int? MaxItems { get => this.schema.MaxItems; set => this.schema.MaxItems = value; } @@ -78,15 +78,15 @@ public AsyncApiJsonSchemaPayload(AsyncApiSchema schema) public bool? UniqueItems { get => this.schema.UniqueItems; set => this.schema.UniqueItems = value; } - public IDictionary Properties { get => this.schema.Properties; set => this.schema.Properties = value; } + public IDictionary Properties { get => this.schema.Properties; set => this.schema.Properties = value; } public int? MaxProperties { get => this.schema.MaxProperties; set => this.schema.MaxProperties = value; } public int? MinProperties { get => this.schema.MinProperties; set => this.schema.MinProperties = value; } - public IDictionary PatternProperties { get => this.schema.PatternProperties; set => this.schema.PatternProperties = value; } + public IDictionary PatternProperties { get => this.schema.PatternProperties; set => this.schema.PatternProperties = value; } - public AsyncApiSchema PropertyNames { get => this.schema.PropertyNames; set => this.schema.PropertyNames = value; } + public AsyncApiJsonSchema PropertyNames { get => this.schema.PropertyNames; set => this.schema.PropertyNames = value; } public string Discriminator { get => this.schema.Discriminator; set => this.schema.Discriminator = value; } @@ -108,11 +108,11 @@ public AsyncApiJsonSchemaPayload(AsyncApiSchema schema) public IDictionary Extensions { get => this.schema.Extensions; set => this.schema.Extensions = value; } - public AsyncApiSchema AdditionalProperties { get => this.schema.AdditionalProperties; set => this.schema.AdditionalProperties = value; } + public AsyncApiJsonSchema AdditionalProperties { get => this.schema.AdditionalProperties; set => this.schema.AdditionalProperties = value; } - public static implicit operator AsyncApiSchema(AsyncApiJsonSchemaPayload payload) => payload.schema; + public static implicit operator AsyncApiJsonSchema(AsyncApiJsonSchemaPayload payload) => payload.schema; - public static implicit operator AsyncApiJsonSchemaPayload(AsyncApiSchema schema) => new AsyncApiJsonSchemaPayload(schema); + public static implicit operator AsyncApiJsonSchemaPayload(AsyncApiJsonSchema schema) => new AsyncApiJsonSchemaPayload(schema); public void SerializeV2(IAsyncApiWriter writer) { diff --git a/src/LEGO.AsyncAPI/Models/JsonSchema/AsyncApiSchema.cs b/src/LEGO.AsyncAPI/Models/JsonSchema/AsyncApiSchema.cs index 0931c953..40dbf4cc 100644 --- a/src/LEGO.AsyncAPI/Models/JsonSchema/AsyncApiSchema.cs +++ b/src/LEGO.AsyncAPI/Models/JsonSchema/AsyncApiSchema.cs @@ -11,7 +11,7 @@ namespace LEGO.AsyncAPI.Models /// /// The Schema Object allows the definition of input and output data types. /// - public class AsyncApiSchema : IAsyncApiReferenceable, IAsyncApiExtensible, IAsyncApiSerializable + public class AsyncApiJsonSchema : IAsyncApiReferenceable, IAsyncApiExtensible, IAsyncApiSerializable { /// /// follow JSON Schema definition. Short text providing information about the data. @@ -107,45 +107,45 @@ public class AsyncApiSchema : IAsyncApiReferenceable, IAsyncApiExtensible, IAsyn /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html /// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. /// - public IList AllOf { get; set; } = new List(); + public IList AllOf { get; set; } = new List(); /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html /// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. /// - public IList OneOf { get; set; } = new List(); + public IList OneOf { get; set; } = new List(); /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html /// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. /// - public IList AnyOf { get; set; } = new List(); + public IList AnyOf { get; set; } = new List(); /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html /// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. /// - public AsyncApiSchema Not { get; set; } + public AsyncApiJsonSchema Not { get; set; } /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html. /// - public AsyncApiSchema Contains { get; set; } + public AsyncApiJsonSchema Contains { get; set; } /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html. /// - public AsyncApiSchema If { get; set; } + public AsyncApiJsonSchema If { get; set; } /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html. /// - public AsyncApiSchema Then { get; set; } + public AsyncApiJsonSchema Then { get; set; } /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html. /// - public AsyncApiSchema Else { get; set; } + public AsyncApiJsonSchema Else { get; set; } /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html. @@ -157,14 +157,14 @@ public class AsyncApiSchema : IAsyncApiReferenceable, IAsyncApiExtensible, IAsyn /// Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object /// and not a standard JSON Schema. items MUST be present if the type is array. /// - public AsyncApiSchema Items { get; set; } + public AsyncApiJsonSchema Items { get; set; } /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html /// Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object /// and not a standard JSON Schema. items MUST be present if the type is array. /// - public AsyncApiSchema AdditionalItems { get; set; } + public AsyncApiJsonSchema AdditionalItems { get; set; } /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html. @@ -185,7 +185,7 @@ public class AsyncApiSchema : IAsyncApiReferenceable, IAsyncApiExtensible, IAsyn /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html /// Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced). /// - public IDictionary Properties { get; set; } = new Dictionary(); + public IDictionary Properties { get; set; } = new Dictionary(); /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html. @@ -202,14 +202,14 @@ public class AsyncApiSchema : IAsyncApiReferenceable, IAsyncApiExtensible, IAsyn /// Value can be boolean or object. Inline or referenced schema /// MUST be of a Schema Object and not a standard JSON Schema. /// - public AsyncApiSchema AdditionalProperties { get; set; } + public AsyncApiJsonSchema AdditionalProperties { get; set; } - public IDictionary PatternProperties { get; set; } = new Dictionary(); + public IDictionary PatternProperties { get; set; } = new Dictionary(); /// /// follow JSON Schema definition: https://json-schema.org/draft-07/json-schema-release-notes.html. /// - public AsyncApiSchema PropertyNames { get; set; } + public AsyncApiJsonSchema PropertyNames { get; set; } /// /// adds support for polymorphism. @@ -455,15 +455,15 @@ public void SerializeV2(IAsyncApiWriter writer) if (this.Reference != null) { - settings.LoopDetector.PopLoop(); + settings.LoopDetector.PopLoop(); } } - public AsyncApiSchema GetReferenced(AsyncApiDocument document) + public AsyncApiJsonSchema GetReferenced(AsyncApiDocument document) { if (this.Reference != null && document != null) { - return document.ResolveReference(this.Reference); + return document.ResolveReference(this.Reference); } else { diff --git a/src/LEGO.AsyncAPI/Models/JsonSchema/FalseApiSchema.cs b/src/LEGO.AsyncAPI/Models/JsonSchema/FalseApiSchema.cs index 01f313e5..669d8499 100644 --- a/src/LEGO.AsyncAPI/Models/JsonSchema/FalseApiSchema.cs +++ b/src/LEGO.AsyncAPI/Models/JsonSchema/FalseApiSchema.cs @@ -5,8 +5,8 @@ namespace LEGO.AsyncAPI.Models /// /// An object representing 'false' for properties of AsyncApiSchema that can be false OR a schema. /// - /// - public class FalseApiSchema : AsyncApiSchema + /// + public class FalseApiSchema : AsyncApiJsonSchema { } } diff --git a/src/LEGO.AsyncAPI/Services/AsyncApiReferenceResolver.cs b/src/LEGO.AsyncAPI/Services/AsyncApiReferenceResolver.cs index 3d54dae8..e541bd1d 100644 --- a/src/LEGO.AsyncAPI/Services/AsyncApiReferenceResolver.cs +++ b/src/LEGO.AsyncAPI/Services/AsyncApiReferenceResolver.cs @@ -90,7 +90,7 @@ public override void Visit(AsyncApiMessage message) // #ToFix Resolve references correctly if (message.Payload is AsyncApiJsonSchemaPayload) { - this.ResolveObject(message.Payload as AsyncApiJsonSchemaPayload, r => message.Payload = new AsyncApiJsonSchemaPayload(r)); + this.ResolveObject(message.Payload as AsyncApiJsonSchemaPayload, r => message.Payload = new AsyncApiJsonSchemaPayload(r)); } this.ResolveList(message.Traits); @@ -143,7 +143,7 @@ public override void Visit(AsyncApiParameter parameter) /// /// Resolve all references used in a schema. /// - public override void Visit(AsyncApiSchema schema) + public override void Visit(AsyncApiJsonSchema schema) { this.ResolveObject(schema.Items, r => schema.Items = r); this.ResolveList(schema.OneOf); diff --git a/src/LEGO.AsyncAPI/Services/AsyncApiVisitorBase.cs b/src/LEGO.AsyncAPI/Services/AsyncApiVisitorBase.cs index c048e0f5..a4f7b0b1 100644 --- a/src/LEGO.AsyncAPI/Services/AsyncApiVisitorBase.cs +++ b/src/LEGO.AsyncAPI/Services/AsyncApiVisitorBase.cs @@ -153,9 +153,9 @@ public virtual void Visit(AsyncApiExternalDocumentation externalDocs) } /// - /// Visits . + /// Visits . /// - public virtual void Visit(AsyncApiSchema schema) + public virtual void Visit(AsyncApiJsonSchema schema) { } diff --git a/src/LEGO.AsyncAPI/Services/AsyncApiWalker.cs b/src/LEGO.AsyncAPI/Services/AsyncApiWalker.cs index 9f9c40ee..be230589 100644 --- a/src/LEGO.AsyncAPI/Services/AsyncApiWalker.cs +++ b/src/LEGO.AsyncAPI/Services/AsyncApiWalker.cs @@ -10,7 +10,7 @@ namespace LEGO.AsyncAPI.Services public class AsyncApiWalker { private readonly AsyncApiVisitorBase visitor; - private readonly Stack schemaLoop = new(); + private readonly Stack schemaLoop = new(); public AsyncApiWalker(AsyncApiVisitorBase visitor) { @@ -331,7 +331,7 @@ internal void Walk(AsyncApiAvroSchemaPayload payload) this.visitor.Visit(payload); } - internal void Walk(AsyncApiSchema schema, bool isComponent = false) + internal void Walk(AsyncApiJsonSchema schema, bool isComponent = false) { if (schema == null || this.ProcessAsReference(schema, isComponent)) { @@ -541,7 +541,7 @@ internal void Walk(AsyncApiMessage message, bool isComponent = false) this.Walk(AsyncApiConstants.Headers, () => this.Walk(message.Headers)); if (message.Payload is AsyncApiJsonSchemaPayload payload) { - this.Walk(AsyncApiConstants.Payload, () => this.Walk((AsyncApiSchema)payload)); + this.Walk(AsyncApiConstants.Payload, () => this.Walk((AsyncApiJsonSchema)payload)); } if (message.Payload is AsyncApiAvroSchemaPayload avroPayload) @@ -1056,7 +1056,7 @@ public void Walk(IAsyncApiElement element) case AsyncApiOAuthFlow e: this.Walk(e); break; case AsyncApiOperation e: this.Walk(e); break; case AsyncApiParameter e: this.Walk(e); break; - case AsyncApiSchema e: this.Walk(e); break; + case AsyncApiJsonSchema e: this.Walk(e); break; case AsyncApiSecurityRequirement e: this.Walk(e); break; case AsyncApiSecurityScheme e: this.Walk(e); break; case AsyncApiServer e: this.Walk(e); break; diff --git a/src/LEGO.AsyncAPI/Validation/AsyncApiValidator.cs b/src/LEGO.AsyncAPI/Validation/AsyncApiValidator.cs index 32b36ca6..e501e265 100644 --- a/src/LEGO.AsyncAPI/Validation/AsyncApiValidator.cs +++ b/src/LEGO.AsyncAPI/Validation/AsyncApiValidator.cs @@ -125,10 +125,10 @@ public void AddWarning(AsyncApiValidatorWarning warning) public override void Visit(AsyncApiParameter item) => this.Validate(item); /// - /// Execute validation rules against an . + /// Execute validation rules against an . /// /// The object to be validated. - public override void Visit(AsyncApiSchema item) => this.Validate(item); + public override void Visit(AsyncApiJsonSchema item) => this.Validate(item); /// /// Execute validation rules against an . diff --git a/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentBuilder.cs b/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentBuilder.cs index f800a1f7..2967fd8c 100644 --- a/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentBuilder.cs +++ b/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentBuilder.cs @@ -46,7 +46,7 @@ public AsyncApiDocumentBuilder WithChannel(string key, AsyncApiChannel channel) return this; } - public AsyncApiDocumentBuilder WithComponent(string key, AsyncApiSchema schema) + public AsyncApiDocumentBuilder WithComponent(string key, AsyncApiJsonSchema schema) { if (this.document.Components == null) { diff --git a/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentV2Tests.cs b/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentV2Tests.cs index 8b98727c..355d4f87 100644 --- a/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentV2Tests.cs +++ b/test/LEGO.AsyncAPI.Tests/AsyncApiDocumentV2Tests.cs @@ -551,13 +551,13 @@ public void AsyncApiDocument_WithStreetLightsExample_SerializesAndDeserializes() }, }, }) - .WithComponent("lightMeasuredPayload", new AsyncApiSchema() + .WithComponent("lightMeasuredPayload", new AsyncApiJsonSchema() { Type = SchemaType.Object, - Properties = new Dictionary() + Properties = new Dictionary() { { - "lumens", new AsyncApiSchema() + "lumens", new AsyncApiJsonSchema() { Type = SchemaType.Integer, Minimum = 0, @@ -565,7 +565,7 @@ public void AsyncApiDocument_WithStreetLightsExample_SerializesAndDeserializes() } }, { - "sentAt", new AsyncApiSchema() + "sentAt", new AsyncApiJsonSchema() { Reference = new AsyncApiReference() { @@ -576,13 +576,13 @@ public void AsyncApiDocument_WithStreetLightsExample_SerializesAndDeserializes() }, }, }) - .WithComponent("turnOnOffPayload", new AsyncApiSchema() + .WithComponent("turnOnOffPayload", new AsyncApiJsonSchema() { Type = SchemaType.Object, - Properties = new Dictionary() + Properties = new Dictionary() { { - "command", new AsyncApiSchema() + "command", new AsyncApiJsonSchema() { Type = SchemaType.String, Enum = new List @@ -594,7 +594,7 @@ public void AsyncApiDocument_WithStreetLightsExample_SerializesAndDeserializes() } }, { - "sentAt", new AsyncApiSchema() + "sentAt", new AsyncApiJsonSchema() { Reference = new AsyncApiReference() { @@ -605,13 +605,13 @@ public void AsyncApiDocument_WithStreetLightsExample_SerializesAndDeserializes() }, }, }) - .WithComponent("dimLightPayload", new AsyncApiSchema() + .WithComponent("dimLightPayload", new AsyncApiJsonSchema() { Type = SchemaType.Object, - Properties = new Dictionary() + Properties = new Dictionary() { { - "percentage", new AsyncApiSchema() + "percentage", new AsyncApiJsonSchema() { Type = SchemaType.Integer, Description = "Percentage to which the light should be dimmed to.", @@ -620,7 +620,7 @@ public void AsyncApiDocument_WithStreetLightsExample_SerializesAndDeserializes() } }, { - "sentAt", new AsyncApiSchema() + "sentAt", new AsyncApiJsonSchema() { Reference = new AsyncApiReference() { @@ -631,7 +631,7 @@ public void AsyncApiDocument_WithStreetLightsExample_SerializesAndDeserializes() }, }, }) - .WithComponent("sentAt", new AsyncApiSchema() + .WithComponent("sentAt", new AsyncApiJsonSchema() { Type = SchemaType.String, Format = "date-time", @@ -650,20 +650,20 @@ public void AsyncApiDocument_WithStreetLightsExample_SerializesAndDeserializes() .WithComponent("streetlightId", new AsyncApiParameter() { Description = "The ID of the streetlight.", - Schema = new AsyncApiSchema() + Schema = new AsyncApiJsonSchema() { Type = SchemaType.String, }, }) .WithComponent("commonHeaders", new AsyncApiMessageTrait() { - Headers = new AsyncApiSchema() + Headers = new AsyncApiJsonSchema() { Type = SchemaType.Object, - Properties = new Dictionary() + Properties = new Dictionary() { { - "my-app-header", new AsyncApiSchema() + "my-app-header", new AsyncApiJsonSchema() { Type = SchemaType.Integer, Minimum = 0, @@ -680,7 +680,7 @@ public void AsyncApiDocument_WithStreetLightsExample_SerializesAndDeserializes() { "kafka", new KafkaOperationBinding() { - ClientId = new AsyncApiSchema() + ClientId = new AsyncApiJsonSchema() { Type = SchemaType.String, Enum = new List @@ -1016,7 +1016,7 @@ public void SerializeV2_WithFullSpec_Serializes() { Name = traitName, Title = traitTitle, - Headers = new AsyncApiSchema + Headers = new AsyncApiJsonSchema { Title = schemaTitle, WriteOnly = true, @@ -1387,7 +1387,7 @@ public void Serializev2_WithBindings_Serializes() { new HttpMessageBinding { - Headers = new AsyncApiSchema + Headers = new AsyncApiJsonSchema { Description = "this mah binding", }, @@ -1396,7 +1396,7 @@ public void Serializev2_WithBindings_Serializes() { new KafkaMessageBinding { - Key = new AsyncApiSchema + Key = new AsyncApiJsonSchema { Description = "this mah other binding", }, diff --git a/test/LEGO.AsyncAPI.Tests/Bindings/BindingExtensions_Should.cs b/test/LEGO.AsyncAPI.Tests/Bindings/BindingExtensions_Should.cs index 3806fc03..a0c8cb88 100644 --- a/test/LEGO.AsyncAPI.Tests/Bindings/BindingExtensions_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Bindings/BindingExtensions_Should.cs @@ -19,11 +19,11 @@ public void TryGetValue_WithChannelBinding_ReturnsBinding() channel.Bindings.Add(new WebSocketsChannelBinding { Method = "POST", - Query = new AsyncApiSchema + Query = new AsyncApiJsonSchema { Description = "this mah query", }, - Headers = new AsyncApiSchema + Headers = new AsyncApiJsonSchema { Description = "this mah binding", }, @@ -74,7 +74,7 @@ public void TryGetValue_WithMessageBinding_ReturnsBinding() message.Bindings.Add(new MQTTMessageBinding { PayloadFormatIndicator = 2, - CorrelationData = new AsyncApiSchema + CorrelationData = new AsyncApiJsonSchema { Description = "Test", }, diff --git a/test/LEGO.AsyncAPI.Tests/Bindings/Http/HttpBindings_Should.cs b/test/LEGO.AsyncAPI.Tests/Bindings/Http/HttpBindings_Should.cs index f2c17c6c..08cd1bee 100644 --- a/test/LEGO.AsyncAPI.Tests/Bindings/Http/HttpBindings_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Bindings/Http/HttpBindings_Should.cs @@ -27,7 +27,7 @@ public void HttpMessageBinding_FilledObject_SerializesAndDeserializes() message.Bindings.Add(new HttpMessageBinding { - Headers = new AsyncApiSchema + Headers = new AsyncApiJsonSchema { Description = "this mah binding", }, @@ -65,7 +65,7 @@ public void HttpOperationBinding_FilledObject_SerializesAndDeserializes() { Type = HttpOperationBinding.HttpOperationType.Request, Method = "POST", - Query = new AsyncApiSchema + Query = new AsyncApiJsonSchema { Description = "this mah query", }, diff --git a/test/LEGO.AsyncAPI.Tests/Bindings/Kafka/KafkaBindings_Should.cs b/test/LEGO.AsyncAPI.Tests/Bindings/Kafka/KafkaBindings_Should.cs index 2c5c6f3f..828acedc 100644 --- a/test/LEGO.AsyncAPI.Tests/Bindings/Kafka/KafkaBindings_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Bindings/Kafka/KafkaBindings_Should.cs @@ -128,7 +128,7 @@ public void KafkaMessageBinding_WithFilledObject_SerializesAndDeserializes() message.Bindings.Add(new KafkaMessageBinding { - Key = new AsyncApiSchema + Key = new AsyncApiJsonSchema { Description = "this mah other binding", }, @@ -167,11 +167,11 @@ public void KafkaOperationBinding_WithFilledObject_SerializesAndDeserializes() operation.Bindings.Add(new KafkaOperationBinding { - GroupId = new AsyncApiSchema + GroupId = new AsyncApiJsonSchema { Description = "this mah groupId", }, - ClientId = new AsyncApiSchema + ClientId = new AsyncApiJsonSchema { Description = "this mah clientId", }, diff --git a/test/LEGO.AsyncAPI.Tests/Bindings/WebSockets/WebSocketBindings_Should.cs b/test/LEGO.AsyncAPI.Tests/Bindings/WebSockets/WebSocketBindings_Should.cs index c37ada58..51815a25 100644 --- a/test/LEGO.AsyncAPI.Tests/Bindings/WebSockets/WebSocketBindings_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Bindings/WebSockets/WebSocketBindings_Should.cs @@ -30,11 +30,11 @@ public void WebSocketChannelBinding_WithFilledObject_SerializesAndDeserializes() channel.Bindings.Add(new WebSocketsChannelBinding { Method = "POST", - Query = new AsyncApiSchema + Query = new AsyncApiJsonSchema { Description = "this mah query", }, - Headers = new AsyncApiSchema + Headers = new AsyncApiJsonSchema { Description = "this mah binding", }, diff --git a/test/LEGO.AsyncAPI.Tests/MQTT/MQTTBindings_Should.cs b/test/LEGO.AsyncAPI.Tests/MQTT/MQTTBindings_Should.cs index bbccf86e..2424c21c 100644 --- a/test/LEGO.AsyncAPI.Tests/MQTT/MQTTBindings_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/MQTT/MQTTBindings_Should.cs @@ -119,7 +119,7 @@ public void MQTTMessageBinding_WithFilledObject_SerializesAndDeserializes() message.Bindings.Add(new MQTTMessageBinding { ContentType = "application/json", - CorrelationData = new AsyncApiSchema + CorrelationData = new AsyncApiJsonSchema { Type = SchemaType.String, Format = "uuid", diff --git a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiChannel_Should.cs b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiChannel_Should.cs index b19cd383..4fbc2512 100644 --- a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiChannel_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiChannel_Should.cs @@ -59,24 +59,24 @@ public void AsyncApiChannel_WithWebSocketsBinding_Serializes() new WebSocketsChannelBinding() { Method = "POST", - Query = new AsyncApiSchema() + Query = new AsyncApiJsonSchema() { - Properties = new Dictionary() + Properties = new Dictionary() { { - "index", new AsyncApiSchema() + "index", new AsyncApiJsonSchema() { Description = "the index", } }, }, }, - Headers = new AsyncApiSchema() + Headers = new AsyncApiJsonSchema() { - Properties = new Dictionary() + Properties = new Dictionary() { { - "x-correlation-id", new AsyncApiSchema() + "x-correlation-id", new AsyncApiJsonSchema() { Description = "the correlationid", } diff --git a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiMessage_Should.cs b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiMessage_Should.cs index e37aa0d0..b3705e45 100644 --- a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiMessage_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiMessage_Should.cs @@ -106,10 +106,10 @@ public void AsyncApiMessage_WithNoSchemaFormat_DoesNotSerializeSchemaFormat() var message = new AsyncApiMessage(); message.Payload = new AsyncApiJsonSchemaPayload() { - Properties = new Dictionary() + Properties = new Dictionary() { { - "propertyA", new AsyncApiSchema() + "propertyA", new AsyncApiJsonSchema() { Type = SchemaType.String | SchemaType.Null, } @@ -147,10 +147,10 @@ public void AsyncApiMessage_WithJsonSchemaFormat_Serializes() message.SchemaFormat = "application/vnd.aai.asyncapi+json;version=2.6.0"; message.Payload = new AsyncApiJsonSchemaPayload() { - Properties = new Dictionary() + Properties = new Dictionary() { { - "propertyA", new AsyncApiSchema() + "propertyA", new AsyncApiJsonSchema() { Type = SchemaType.String | SchemaType.Null, } @@ -313,7 +313,7 @@ public void AsyncApiMessage_WithFilledObject_Serializes() var message = new AsyncApiMessage { - Headers = new AsyncApiSchema + Headers = new AsyncApiJsonSchema { Title = "HeaderTitle", WriteOnly = true, @@ -328,16 +328,16 @@ public void AsyncApiMessage_WithFilledObject_Serializes() }, Payload = new AsyncApiJsonSchemaPayload() { - Properties = new Dictionary + Properties = new Dictionary { { - "propA", new AsyncApiSchema() + "propA", new AsyncApiJsonSchema() { Type = SchemaType.String, } }, { - "propB", new AsyncApiSchema() + "propB", new AsyncApiJsonSchema() { Type = SchemaType.String, } @@ -376,7 +376,7 @@ public void AsyncApiMessage_WithFilledObject_Serializes() { "http", new HttpMessageBinding { - Headers = new AsyncApiSchema + Headers = new AsyncApiJsonSchema { Title = "SchemaTitle", WriteOnly = true, @@ -410,7 +410,7 @@ public void AsyncApiMessage_WithFilledObject_Serializes() { Name = "MessageTraitName", Title = "MessageTraitTitle", - Headers = new AsyncApiSchema + Headers = new AsyncApiJsonSchema { Title = "SchemaTitle", WriteOnly = true, diff --git a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiOperation_Should.cs b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiOperation_Should.cs index 847da7be..6c53ad3d 100644 --- a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiOperation_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiOperation_Should.cs @@ -105,7 +105,7 @@ public void AsyncApiOperation_WithBindings_Serializes() { Type = HttpOperationBinding.HttpOperationType.Request, Method = "PUT", - Query = new AsyncApiSchema + Query = new AsyncApiJsonSchema { Description = "some query", }, @@ -114,11 +114,11 @@ public void AsyncApiOperation_WithBindings_Serializes() { new KafkaOperationBinding { - GroupId = new AsyncApiSchema + GroupId = new AsyncApiJsonSchema { Description = "some Id", }, - ClientId = new AsyncApiSchema + ClientId = new AsyncApiJsonSchema { Description = "some Id", }, diff --git a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiSchema_Should.cs b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiSchema_Should.cs index 61cc49ae..7e00efab 100644 --- a/test/LEGO.AsyncAPI.Tests/Models/AsyncApiSchema_Should.cs +++ b/test/LEGO.AsyncAPI.Tests/Models/AsyncApiSchema_Should.cs @@ -13,9 +13,9 @@ namespace LEGO.AsyncAPI.Tests.Models public class AsyncApiSchema_Should : TestBase { - public static AsyncApiSchema BasicSchema = new AsyncApiSchema(); + public static AsyncApiJsonSchema BasicSchema = new AsyncApiJsonSchema(); - public static AsyncApiSchema AdvancedSchemaNumber = new AsyncApiSchema + public static AsyncApiJsonSchema AdvancedSchemaNumber = new AsyncApiJsonSchema { Title = "title1", MultipleOf = 3, @@ -31,7 +31,7 @@ public class AsyncApiSchema_Should : TestBase }, }; - public static AsyncApiSchema AdvancedSchemaBigNumbers = new AsyncApiSchema + public static AsyncApiJsonSchema AdvancedSchemaBigNumbers = new AsyncApiJsonSchema { Title = "title1", MultipleOf = 3, @@ -47,20 +47,20 @@ public class AsyncApiSchema_Should : TestBase }, }; - public static AsyncApiSchema AdvancedSchemaObject = new AsyncApiSchema + public static AsyncApiJsonSchema AdvancedSchemaObject = new AsyncApiJsonSchema { Title = "title1", - Properties = new Dictionary + Properties = new Dictionary { - ["property1"] = new AsyncApiSchema + ["property1"] = new AsyncApiJsonSchema { - Properties = new Dictionary + Properties = new Dictionary { - ["property2"] = new AsyncApiSchema + ["property2"] = new AsyncApiJsonSchema { Type = SchemaType.Integer, }, - ["property3"] = new AsyncApiSchema + ["property3"] = new AsyncApiJsonSchema { Type = SchemaType.String, MaxLength = 15, @@ -70,78 +70,78 @@ public class AsyncApiSchema_Should : TestBase Items = new FalseApiSchema(), AdditionalItems = new FalseApiSchema(), }, - ["property4"] = new AsyncApiSchema + ["property4"] = new AsyncApiJsonSchema { - Properties = new Dictionary + Properties = new Dictionary { - ["property5"] = new AsyncApiSchema + ["property5"] = new AsyncApiJsonSchema { - Properties = new Dictionary + Properties = new Dictionary { - ["property6"] = new AsyncApiSchema + ["property6"] = new AsyncApiJsonSchema { Type = SchemaType.Boolean, }, }, }, - ["property7"] = new AsyncApiSchema + ["property7"] = new AsyncApiJsonSchema { Type = SchemaType.String, MinLength = 2, }, }, - PatternProperties = new Dictionary() + PatternProperties = new Dictionary() { { "^S_", - new AsyncApiSchema() + new AsyncApiJsonSchema() { Type = SchemaType.String, } }, { - "^I_", new AsyncApiSchema() + "^I_", new AsyncApiJsonSchema() { Type = SchemaType.Integer, } }, }, - PropertyNames = new AsyncApiSchema() + PropertyNames = new AsyncApiJsonSchema() { Pattern = "^[A-Za-z_][A-Za-z0-9_]*$", }, - AdditionalProperties = new AsyncApiSchema + AdditionalProperties = new AsyncApiJsonSchema { - Properties = new Dictionary + Properties = new Dictionary { - ["Property8"] = new AsyncApiSchema + ["Property8"] = new AsyncApiJsonSchema { Type = SchemaType.String | SchemaType.Null, }, }, }, - Items = new AsyncApiSchema + Items = new AsyncApiJsonSchema { - Properties = new Dictionary + Properties = new Dictionary { - ["Property9"] = new AsyncApiSchema + ["Property9"] = new AsyncApiJsonSchema { Type = SchemaType.String | SchemaType.Null, }, }, }, - AdditionalItems = new AsyncApiSchema + AdditionalItems = new AsyncApiJsonSchema { - Properties = new Dictionary + Properties = new Dictionary { - ["Property10"] = new AsyncApiSchema + ["Property10"] = new AsyncApiJsonSchema { Type = SchemaType.String | SchemaType.Null, }, }, }, }, - ["property11"] = new AsyncApiSchema + ["property11"] = new AsyncApiJsonSchema { Const = new AsyncApiAny("aSpecialConstant"), }, @@ -153,43 +153,43 @@ public class AsyncApiSchema_Should : TestBase }, }; - public static AsyncApiSchema AdvancedSchemaWithAllOf = new AsyncApiSchema + public static AsyncApiJsonSchema AdvancedSchemaWithAllOf = new AsyncApiJsonSchema { Title = "title1", - AllOf = new List + AllOf = new List { - new AsyncApiSchema + new AsyncApiJsonSchema { Title = "title2", - Properties = new Dictionary + Properties = new Dictionary { - ["property1"] = new AsyncApiSchema + ["property1"] = new AsyncApiJsonSchema { Type = SchemaType.Integer, }, - ["property2"] = new AsyncApiSchema + ["property2"] = new AsyncApiJsonSchema { Type = SchemaType.String, MaxLength = 15, }, }, }, - new AsyncApiSchema + new AsyncApiJsonSchema { Title = "title3", - Properties = new Dictionary + Properties = new Dictionary { - ["property3"] = new AsyncApiSchema + ["property3"] = new AsyncApiJsonSchema { - Properties = new Dictionary + Properties = new Dictionary { - ["property4"] = new AsyncApiSchema + ["property4"] = new AsyncApiJsonSchema { Type = SchemaType.Boolean , }, }, }, - ["property5"] = new AsyncApiSchema + ["property5"] = new AsyncApiJsonSchema { Type = SchemaType.String, MinLength = 2, @@ -205,7 +205,7 @@ public class AsyncApiSchema_Should : TestBase }, }; - public static AsyncApiSchema ReferencedSchema = new AsyncApiSchema + public static AsyncApiJsonSchema ReferencedSchema = new AsyncApiJsonSchema { Title = "title1", MultipleOf = 3, @@ -228,22 +228,22 @@ public class AsyncApiSchema_Should : TestBase }, }; - public static AsyncApiSchema AdvancedSchemaWithRequiredPropertiesObject = new AsyncApiSchema + public static AsyncApiJsonSchema AdvancedSchemaWithRequiredPropertiesObject = new AsyncApiJsonSchema { Title = "title1", Required = new HashSet() { "property1" }, - Properties = new Dictionary + Properties = new Dictionary { - ["property1"] = new AsyncApiSchema + ["property1"] = new AsyncApiJsonSchema { Required = new HashSet() { "property3" }, - Properties = new Dictionary + Properties = new Dictionary { - ["property2"] = new AsyncApiSchema + ["property2"] = new AsyncApiJsonSchema { Type = SchemaType.Integer, }, - ["property3"] = new AsyncApiSchema + ["property3"] = new AsyncApiJsonSchema { Type = SchemaType.String, MaxLength = 15, @@ -252,21 +252,21 @@ public class AsyncApiSchema_Should : TestBase }, ReadOnly = true, }, - ["property4"] = new AsyncApiSchema + ["property4"] = new AsyncApiJsonSchema { - Properties = new Dictionary + Properties = new Dictionary { - ["property5"] = new AsyncApiSchema + ["property5"] = new AsyncApiJsonSchema { - Properties = new Dictionary + Properties = new Dictionary { - ["property6"] = new AsyncApiSchema + ["property6"] = new AsyncApiJsonSchema { Type = SchemaType.Boolean, }, }, }, - ["property7"] = new AsyncApiSchema + ["property7"] = new AsyncApiJsonSchema { Type = SchemaType.String, MinLength = 2, @@ -374,7 +374,7 @@ public void Deserialize_WithAdvancedSchema_Works() var expected = AdvancedSchemaObject; // Act - var actual = new AsyncApiStringReader().ReadFragment(json, AsyncApiVersion.AsyncApi2_0, out var _diagnostics); + var actual = new AsyncApiStringReader().ReadFragment(json, AsyncApiVersion.AsyncApi2_0, out var _diagnostics); // Assert actual.Should().BeEquivalentTo(expected); @@ -424,26 +424,26 @@ public void Serialize_WithInliningOptions_ShouldInlineAccordingly(bool shouldInl { Type = SchemaType.Object, Required = new HashSet { "testB" }, - Properties = new Dictionary + Properties = new Dictionary { - { "testC", new AsyncApiSchema { Reference = new AsyncApiReference { Type = ReferenceType.Schema, Id = "testC" } } }, - { "testB", new AsyncApiSchema { Reference = new AsyncApiReference { Type = ReferenceType.Schema, Id = "testB" } } }, + { "testC", new AsyncApiJsonSchema { Reference = new AsyncApiReference { Type = ReferenceType.Schema, Id = "testC" } } }, + { "testB", new AsyncApiJsonSchema { Reference = new AsyncApiReference { Type = ReferenceType.Schema, Id = "testB" } } }, }, }, }, }, }, }) - .WithComponent("testD", new AsyncApiSchema() { Type = SchemaType.String, Format = "uuid" }) - .WithComponent("testC", new AsyncApiSchema() + .WithComponent("testD", new AsyncApiJsonSchema() { Type = SchemaType.String, Format = "uuid" }) + .WithComponent("testC", new AsyncApiJsonSchema() { Type = SchemaType.Object, - Properties = new Dictionary + Properties = new Dictionary { - { "testD", new AsyncApiSchema { Reference = new AsyncApiReference { Type = ReferenceType.Schema, Id = "testD" } } }, + { "testD", new AsyncApiJsonSchema { Reference = new AsyncApiReference { Type = ReferenceType.Schema, Id = "testD" } } }, }, }) - .WithComponent("testB", new AsyncApiSchema() { Description = "test", Type = SchemaType.Boolean }) + .WithComponent("testB", new AsyncApiJsonSchema() { Description = "test", Type = SchemaType.Boolean }) .Build(); var outputString = new StringWriter(); @@ -481,10 +481,10 @@ public void SerializeV2_WithNullWriter_Throws() [Test] public void Serialize_WithOneOf_DoesNotWriteThen() { - var mainSchema = new AsyncApiSchema(); - var subSchema = new AsyncApiSchema(); - subSchema.Properties.Add("title", new AsyncApiSchema() { Type = SchemaType.String }); - mainSchema.OneOf = new List() { subSchema }; + var mainSchema = new AsyncApiJsonSchema(); + var subSchema = new AsyncApiJsonSchema(); + subSchema.Properties.Add("title", new AsyncApiJsonSchema() { Type = SchemaType.String }); + mainSchema.OneOf = new List() { subSchema }; var yaml = mainSchema.Serialize(AsyncApiVersion.AsyncApi2_0, AsyncApiFormat.Yaml); @@ -499,10 +499,10 @@ public void Serialize_WithOneOf_DoesNotWriteThen() [Test] public void Serialize_WithAnyOf_DoesNotWriteIf() { - var mainSchema = new AsyncApiSchema(); - var subSchema = new AsyncApiSchema(); - subSchema.Properties.Add("title", new AsyncApiSchema() { Type = SchemaType.String }); - mainSchema.AnyOf = new List() { subSchema }; + var mainSchema = new AsyncApiJsonSchema(); + var subSchema = new AsyncApiJsonSchema(); + subSchema.Properties.Add("title", new AsyncApiJsonSchema() { Type = SchemaType.String }); + mainSchema.AnyOf = new List() { subSchema }; var yaml = mainSchema.Serialize(AsyncApiVersion.AsyncApi2_0, AsyncApiFormat.Yaml); @@ -526,7 +526,7 @@ public void Deserialize_BasicExample() url: http://example.com/externalDocs """; - var schema = new AsyncApiStringReader().ReadFragment(input, AsyncApiVersion.AsyncApi2_0, out var diag); + var schema = new AsyncApiStringReader().ReadFragment(input, AsyncApiVersion.AsyncApi2_0, out var diag); diag.Errors.Should().BeEmpty(); schema.Should().BeEquivalentTo(AdvancedSchemaNumber); @@ -538,9 +538,9 @@ public void Deserialize_BasicExample() [Test] public void Serialize_WithNot_DoesNotWriteElse() { - var mainSchema = new AsyncApiSchema(); - var subSchema = new AsyncApiSchema(); - subSchema.Properties.Add("title", new AsyncApiSchema() { Type = SchemaType.String }); + var mainSchema = new AsyncApiJsonSchema(); + var subSchema = new AsyncApiJsonSchema(); + subSchema.Properties.Add("title", new AsyncApiJsonSchema() { Type = SchemaType.String }); mainSchema.Not = subSchema; var yaml = mainSchema.Serialize(AsyncApiVersion.AsyncApi2_0, AsyncApiFormat.Yaml);