diff --git a/WoT/TDHelpers.cs b/WoT/TDHelpers.cs index 1bb3fa4..6cc28c8 100644 --- a/WoT/TDHelpers.cs +++ b/WoT/TDHelpers.cs @@ -24,7 +24,6 @@ public override void WriteJson(JsonWriter writer, DataSchema value, JsonSerializ if (value.Default != null) jo.Add("default", JToken.FromObject(value.Default)); if (value.Unit != null) jo.Add("unit", JToken.FromObject(value.Unit)); if (value.OneOf != null) jo.Add("oneOf", JToken.FromObject(value.OneOf)); - if (value.AllOf != null) jo.Add("allOf", JToken.FromObject(value.AllOf)); if (value.Enum != null) jo.Add("enum", JToken.FromObject(value.Enum)); if (value.Format != null) jo.Add("format", JToken.FromObject(value.Format)); if (value.Type != null) jo.Add("type", JToken.FromObject(value.Type)); @@ -145,9 +144,9 @@ protected static ArraySchema FillArraySchemaObject(JToken schemaObj, JsonSeriali } - if (schemaObj["const"] != null) schema.Const = schemaObj["const"]; - if (schemaObj["default"] != null) schema.Default = schemaObj["default"]; - if (schemaObj["enum"] != null) schema.Enum = schemaObj["enum"].ToObject(); + if (schemaObj["const"] != null) schema.Const = schemaObj["const"].ToObject>(); + if (schemaObj["default"] != null) schema.Default = schemaObj["default"].ToObject>(); + if (schemaObj["enum"] != null) schema.Enum = schemaObj["enum"].ToObject[]>(); return schema; } @@ -194,9 +193,9 @@ protected static ObjectSchema FillObjectSchemaObject(JToken schemaObj, JsonSeria if (schemaObj["required"] != null) schema.Required = schemaObj["required"].ToObject(); if (schemaObj["properties"] != null) schema.Properties = serializer.Deserialize(new JTokenReader(schemaObj["properties"]), objectType: typeof(Dictionary)) as Dictionary; - if (schemaObj["const"] != null) schema.Const = schemaObj["const"]; - if (schemaObj["default"] != null) schema.Default = schemaObj["default"]; - if (schemaObj["enum"] != null) schema.Enum = schemaObj["enum"].ToObject(); + if (schemaObj["const"] != null) schema.Const = schemaObj["const"].ToObject>(); + if (schemaObj["default"] != null) schema.Default = schemaObj["default"].ToObject>(); + if (schemaObj["enum"] != null) schema.Enum = schemaObj["enum"].ToObject[]>(); return schema; } @@ -245,7 +244,6 @@ protected static void CommonFiller(T schema, JToken schemaObj, JsonSerializer if (schemaObj["writeOnly"] != null) schema.WriteOnly = (bool)schemaObj["writeOnly"]; if (schemaObj["titles"] != null) schema.Titles = schemaObj["titles"].ToObject(); if (schemaObj["descriptions"] != null) schema.Descriptions = schemaObj["descriptions"].ToObject(); - if (schemaObj["allOf"] != null) schema.AllOf = serializer.Deserialize(new JTokenReader(schemaObj["allOf"]), objectType: typeof(DataSchema[])) as DataSchema[]; if (schemaObj["oneOf"] != null) schema.OneOf = serializer.Deserialize(new JTokenReader(schemaObj["oneOf"]), objectType: typeof(DataSchema[])) as DataSchema[]; if (schemaObj["@type"] != null) @@ -378,16 +376,21 @@ public override Form ReadJson(JsonReader reader, Type objectType, Form existingV schema.OriginalJson = schemaObj.ToString(); if (schemaObj["contentCoding"] != null) schema.ContentCoding = schemaObj["contentCoding"].ToObject(); if (schemaObj["subprotocol"] != null) schema.Subprotocol = schemaObj["subprotocol"].ToObject(); - if (schemaObj["additionalExpectedResponse"] != null) + + if (schemaObj["response"] != null) { - schema.AdditionalExpectedResponse = schemaObj["additionalExpectedResponse"].ToObject(); - } - else - { //Default value handling - string contentType = schema.ContentType; - schema.AdditionalExpectedResponse = new AdditionalExpectedResponse(contentType); + schema.Response = schemaObj["response"].ToObject(); } + if (schemaObj["additionalExpectedResponse"] != null) + { + schema.AdditionalExpectedResponse = schemaObj["additionalExpectedResponse"].ToObject(); + //Default value handling + for (int i = 0; i < schema.AdditionalExpectedResponse.Length; i++) + { + if (schema.AdditionalExpectedResponse[i].ContentType == null) schema.AdditionalExpectedResponse[i].ContentType = schema.ContentType; + } + } if (schemaObj["security"] != null) schema.Security = newSerializer.Deserialize(new JTokenReader(schemaObj["security"])); @@ -444,14 +447,19 @@ public override PropertyForm ReadJson(JsonReader reader, Type objectType, Proper if (schemaObj["contentCoding"] != null) schema.ContentCoding = schemaObj["contentCoding"].ToObject(); if (schemaObj["subprotocol"] != null) schema.Subprotocol = schemaObj["subprotocol"].ToObject(); - if (schemaObj["additionalExpectedResponse"] != null) + if (schemaObj["response"] != null) { - schema.AdditionalExpectedResponse = schemaObj["additionalExpectedResponse"].ToObject(); + schema.Response = schemaObj["response"].ToObject(); } - else - {//Default value handling - string contentType = schema.ContentType; - schema.AdditionalExpectedResponse = new AdditionalExpectedResponse(contentType); + + if (schemaObj["additionalExpectedResponse"] != null) + { + schema.AdditionalExpectedResponse = schemaObj["additionalExpectedResponse"].ToObject(); + //Default value handling + for (int i = 0; i < schema.AdditionalExpectedResponse.Length; i++) + { + if (schema.AdditionalExpectedResponse[i].ContentType == null) schema.AdditionalExpectedResponse[i].ContentType = schema.ContentType; + } } schema.OriginalJson = schemaObj.ToString(); @@ -514,14 +522,19 @@ public override ActionForm ReadJson(JsonReader reader, Type objectType, ActionFo if (schemaObj["contentCoding"] != null) schema.ContentCoding = schemaObj["contentCoding"].ToObject(); if (schemaObj["subprotocol"] != null) schema.Subprotocol = schemaObj["subprotocol"].ToObject(); - if (schemaObj["additionalExpectedResponse"] != null) + if (schemaObj["response"] != null) { - schema.AdditionalExpectedResponse = schemaObj["additionalExpectedResponse"].ToObject(); + schema.Response = schemaObj["response"].ToObject(); } - else - {//Default value handling - string contentType = schema.ContentType; - schema.AdditionalExpectedResponse = new AdditionalExpectedResponse(contentType); + + if (schemaObj["additionalExpectedResponse"] != null) + { + schema.AdditionalExpectedResponse = schemaObj["additionalExpectedResponse"].ToObject(); + //Default value handling + for (int i = 0; i < schema.AdditionalExpectedResponse.Length; i++) + { + if (schema.AdditionalExpectedResponse[i].ContentType == null) schema.AdditionalExpectedResponse[i].ContentType = schema.ContentType; + } } schema.OriginalJson = schemaObj.ToString(); @@ -588,14 +601,19 @@ public override EventForm ReadJson(JsonReader reader, Type objectType, EventForm if (schemaObj["contentCoding"] != null) schema.ContentCoding = schemaObj["contentCoding"].ToObject(); if (schemaObj["subprotocol"] != null) schema.Subprotocol = schemaObj["subprotocol"].ToObject(); - if (schemaObj["additionalExpectedResponse"] != null) + if (schemaObj["response"] != null) { - schema.AdditionalExpectedResponse = schemaObj["additionalExpectedResponse"].ToObject(); + schema.Response = schemaObj["response"].ToObject(); } - else - {//Default value handling - string contentType = schema.ContentType; - schema.AdditionalExpectedResponse = new AdditionalExpectedResponse(contentType); + + if (schemaObj["additionalExpectedResponse"] != null) + { + schema.AdditionalExpectedResponse = schemaObj["additionalExpectedResponse"].ToObject(); + //Default value handling + for (int i = 0; i < schema.AdditionalExpectedResponse.Length; i++) + { + if (schema.AdditionalExpectedResponse[i].ContentType == null) schema.AdditionalExpectedResponse[i].ContentType = schema.ContentType; + } } schema.OriginalJson = schemaObj.ToString(); @@ -852,9 +870,9 @@ protected static ArrayPropertyAffordance FillArrayPropertyAffordanceObject(JToke } - if (propObj["const"] != null) schema.Const = propObj["const"]; - if (propObj["default"] != null) schema.Default = propObj["default"]; - if (propObj["enum"] != null) schema.Enum = propObj["enum"].ToObject(); + if (propObj["const"] != null) schema.Const = propObj["const"].ToObject>(); + if (propObj["default"] != null) schema.Default = propObj["default"].ToObject>(); + if (propObj["enum"] != null) schema.Enum = propObj["enum"].ToObject[]>(); return schema; } @@ -901,9 +919,9 @@ protected static ObjectPropertyAffordance FillObjectPropertyAffordanceObject(JTo if (propObj["required"] != null) schema.Required = propObj["required"].ToObject(); if (propObj["properties"] != null) schema.Properties = serializer.Deserialize(new JTokenReader(propObj["properties"]), objectType: typeof(Dictionary)) as Dictionary; - if (propObj["const"] != null) schema.Const = propObj["const"]; - if (propObj["default"] != null) schema.Default = propObj["default"]; - if (propObj["enum"] != null) schema.Enum = propObj["enum"].ToObject(); + if (propObj["const"] != null) schema.Const = propObj["const"].ToObject>(); + if (propObj["default"] != null) schema.Default = propObj["default"].ToObject>(); + if (propObj["enum"] != null) schema.Enum = propObj["enum"].ToObject[]>(); return schema; } @@ -947,7 +965,6 @@ protected static void CommonFiller(T propertyAffordance, JToken propObj, Json if (propObj["writeOnly"] != null) propertyAffordance.WriteOnly = (bool)propObj["writeOnly"]; if (propObj["titles"] != null) propertyAffordance.Titles = propObj["titles"].ToObject(); if (propObj["descriptions"] != null) propertyAffordance.Descriptions = propObj["descriptions"].ToObject(); - if (propObj["allOf"] != null) propertyAffordance.AllOf = serializer.Deserialize(new JTokenReader(propObj["allOf"]), objectType: typeof(DataSchema[])) as DataSchema[]; if (propObj["oneOf"] != null) propertyAffordance.OneOf = serializer.Deserialize(new JTokenReader(propObj["oneOf"]), objectType: typeof(DataSchema[])) as DataSchema[]; if (propObj["forms"] != null) propertyAffordance.Forms = serializer.Deserialize(new JTokenReader(propObj["forms"]), objectType: typeof(PropertyForm[])) as PropertyForm[]; if (propObj["@type"] != null) diff --git a/WoT/WoT-Definitions.cs b/WoT/WoT-Definitions.cs index 641f4ae..706715d 100644 --- a/WoT/WoT-Definitions.cs +++ b/WoT/WoT-Definitions.cs @@ -20,307 +20,432 @@ public class MultiLanguage : Dictionary } /// - /// + /// An interface for DataSchema as described in the Thing Description (TD) Spec. + /// Is needed mainly to ensure that PropertyAffordances also implement interface. /// public interface IDataSchema { + /// + /// JSON-LD keyword to label the object with semantic tags (or types) + /// [JsonProperty("@type")] string[] AtType { get; set; } + + /// + /// Provides a human-readable title (e.g., display a text for UI representation) based on a default language. + /// string Title { get; set; } + + /// + /// Provides multi-language human-readable titles (e.g., display a text for UI representation in different languages). + /// + /// MultiLanguage Titles { get; set; } + + /// + /// Provides additional (human-readable) information based on a default language. + /// string Description { get; set; } + + /// + /// Can be used to support (human-readable) information in different languages. + /// + /// MultiLanguage Descriptions { get; set; } /// - /// Provides a constant value. + /// Provides a constant value. /// object Const { get; set; } /// - /// Supply a default value. + /// Supply a default value. /// /// - /// The value SHOULD validate against the data schema in which it resides. + /// The value SHOULD validate against the data schema in which it resides. /// object Default { get; set; } + + /// + /// Provides unit information that is used, e.g., in international science, engineering, and business. + /// + /// + /// To preserve uniqueness, it is recommended that the value of the unit points to a semantic definition (also see Section Semantic Annotations). + /// string Unit { get; set; } + + /// + /// Used to ensure that the data is valid against one of the specified schemas in the array. + /// + /// + /// This can be used to describe multiple input or output schemas. + /// IDataSchema[] OneOf { get; set; } /// - /// Restricted set of values provided as an array. + /// Restricted set of values provided as an array. /// object[] Enum { get; set; } + + /// + /// Boolean value that is a hint to indicate whether a property interaction / value is read only (=true) or not (=false). + /// bool ReadOnly { get; set; } + + /// + /// Boolean value that is a hint to indicate whether a property interaction / value is write only (=true) or not (=false). + /// bool WriteOnly { get; set; } + + /// + /// Allows validation based on a format pattern such as "date-time", "email", "uri", etc. + /// string Format { get; set; } + + /// + /// Assignment of JSON-based data types compatible with JSON Schema (one of "boolean", "integer", "number", "string", "object", "array", or "null"). + /// string Type { get; } } + + /// + /// An interface for ArraySchema as described in the Thing Description (TD) Spec. + /// Is needed mainly to ensure that ArrayPropertyAffordances also implement interface. + /// public interface IArraySchema : IDataSchema { + /// + /// Assignment of JSON-based data types compatible with JSON Schema. + /// + /// + /// Schema type: "array" + /// + new string Type { get; } + /// + /// Used to define the characteristics of an array. + /// DataSchema[] Items { get; set; } - uint? MinItems { get; set; } - uint? MaxItems { get; set; } /// - /// Provides a constant value. + /// Defines the minimum number of items that have to be in the array. /// - new List Const { get; set; } + uint? MinItems { get; set; } /// - /// Supply a default value. + /// Defines the maximum number of items that have to be in the array. /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// + uint? MaxItems { get; set; } + + /// + new List Const { get; set; } + + /// new List Default { get; set; } - /// - /// Restricted set of values provided as an array. - /// + /// new List[] Enum { get; set; } } + + /// + /// An interface for ArraySchema as described in the Thing Description (TD) Spec. + /// Is needed mainly to ensure that BooleanPropertyAffordances also implement interface. + /// public interface IBooleanSchema : IDataSchema { - /// - /// Provides a constant value. + /// Assignment of JSON-based data types compatible with JSON Schema. /// + /// + /// Schema type: "boolean" + /// + new string Type { get; } + + /// new bool Const { get; set; } - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// + /// new bool Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// + /// new bool[] Enum { get; set; } } + + /// + /// An interface for NumberSchema as described in the Thing Description (TD) Spec. + /// Is needed mainly to ensure that NumberPropertyAffordances also implement interface. + /// public interface INumberSchema : IDataSchema { + /// + /// Assignment of JSON-based data types compatible with JSON Schema. + /// + /// + /// Schema type: "number" + /// + new string Type { get; } + + /// + /// Specifies a minimum numeric value, representing an inclusive lower limit. + /// double? Minimum { get; set; } + + /// + /// Specifies a minimum numeric value, representing an exclusive lower limit. + /// double? ExclusiveMinimum { get; set; } - double? Maximum { get; set; } - double? ExclusiveMaximum { get; set; } - double? MultipleOf { get; set; } /// - /// Provides a constant value. + /// Specifies a maximum numeric value, representing an inclusive upper limit. /// - new double? Const { get; set; } + double? Maximum { get; set; } /// - /// Supply a default value. + /// Specifies a maximum numeric value, representing an exclusive upper limit. /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// - new double? Default { get; set; } + double? ExclusiveMaximum { get; set; } + /// - /// Restricted set of values provided as an array. + /// Specifies the multipleOf value number. The value must strictly greater than 0. /// + double? MultipleOf { get; set; } + + /// + new double? Const { get; set; } + + /// + new double? Default { get; set; } + + /// new double[] Enum { get; set; } } + + /// + /// An interface for NumberSchema as described in the Thing Description (TD) Spec. + /// Is needed mainly to ensure that IntegerPropertyAffordances also implement interface. + /// public interface IIntegerSchema : IDataSchema { + /// + /// Assignment of JSON-based data types compatible with JSON Schema. + /// + /// + /// Schema type: "integer" + /// + new string Type { get; } + + /// + /// Specifies a minimum numeric value, representing an inclusive lower limit. + /// int? Minimum { get; set; } + + /// + /// Specifies a minimum numeric value, representing an exclusive lower limit. + /// int? ExclusiveMinimum { get; set; } - int? Maximum { get; set; } - int? ExclusiveMaximum { get; set; } - int? MultipleOf { get; set; } /// - /// Provides a constant value. + /// Specifies a maximum numeric value, representing an inclusive upper limit. /// - new int? Const { get; set; } + int? Maximum { get; set; } /// - /// Supply a default value. + /// Specifies a maximum numeric value, representing an exclusive upper limit. /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// - new int? Default { get; set; } + int? ExclusiveMaximum { get; set; } /// - /// Restricted set of values provided as an array. + /// Specifies the multipleOf value number. The value must strictly greater than 0. /// + int? MultipleOf { get; set; } + + /// + new int? Const { get; set; } + + /// + new int? Default { get; set; } + + /// new int[] Enum { get; set; } } + + /// + /// An interface for ObjectSchema as described in the Thing Description (TD) Spec. + /// Is needed mainly to ensure that ObjectPropertyAffordances also implement interface. + /// + /// + /// JSON object type is NOT the same as object type in C#. JSON object maps to C# Dictionary<string, object> . + /// public interface IObjectSchema : IDataSchema { - Dictionary Properties { get; set; } - string[] Required { get; set; } - /// - /// Provides a constant value. + /// Assignment of JSON-based data types compatible with JSON Schema. /// - new Dictionary Const { get; set; } + /// + /// Schema type: "object" + /// + new string Type { get; } /// - /// Supply a default value. + /// Data schema nested definitions. /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// - new Dictionary Default { get; set; } + Dictionary Properties { get; set; } + /// - /// Restricted set of values provided as an array. + /// Defines which members of the object type are mandatory, i.e. which members are mandatory in the payload that is to be sent (e.g. input of invokeaction, writeproperty) and what members will be definitely delivered in the payload that is being received (e.g. output of invokeaction, readproperty) /// - new Dictionary[] Enum { get; set; } + string[] Required { get; set; } + + /// + new Dictionary Const { get; set; } + + /// + new Dictionary Default { get; set; } + + /// + new Dictionary[] Enum { get; set; } } + + /// + /// An interface for StringSchema as described in the Thing Description (TD) Spec. + /// Is needed mainly to ensure that StringPropertyAffordances also implement interface. + /// public interface IStringSchema : IDataSchema { + /// + /// Assignment of JSON-based data types compatible with JSON Schema. + /// + /// + /// Schema type: "string" + /// + new string Type { get; } + + /// + /// Specifies the minimum length of a string. + /// uint? MinLength { get; set; } + + /// + /// Specifies the maximum length of a string. + /// uint? MaxLength { get; set; } - string Pattern { get; set; } - string ContentEncoding { get; set; } - string ContentMediaType { get; set; } /// - /// Provides a constant value. + /// Provides a regular expression to express constraints of the string value. The regular expression must follow the [ECMA-262] dialect. /// - new string Const { get; set; } + string Pattern { get; set; } /// - /// Supply a default value. + /// Specifies the encoding used to store the contents, as specified in [RFC2045] (Section 6.1) and [RFC4648]. /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// - new string Default { get; set; } + string ContentEncoding { get; set; } /// - /// Restricted set of values provided as an array. + /// Specifies the MIME type of the contents of a string value, as described in [RFC2046]. /// - new string[] Enum { get; set; } + string ContentMediaType { get; set; } - } - public interface IInteractionAffordance - { - [JsonProperty("@type")] - string[] AtType { get; set; } - string Title { get; set; } - MultiLanguage Titles { get; set; } - string Description { get; set; } - MultiLanguage Descriptions { get; set; } - Form[] Forms { get; set; } - Dictionary UriVariables { get; set; } - string OriginalJson { get; set; } + /// + new string Const { get; set; } + /// + new string Default { get; set; } - } + /// + new string[] Enum { get; set; } + } /// - /// Metadata that describes the data format used. It can be used for validation. + /// An interface for InteractionAffordances as described in the Thing Description (TD) Spec. /// - [JsonConverter(typeof(DataSchemaConverter))] - public class DataSchema : IDataSchema + public interface IInteractionAffordance { - /// - /// Base Constructor - /// - public DataSchema() { } /// - /// JSON-LD keyword to label the object with semantic tags (or types) + /// JSON-LD keyword to label the object with semantic tags (or types). /// [JsonProperty("@type")] - public string[] AtType { get; set; } + string[] AtType { get; set; } /// - /// Provides a human-readable title (e.g., display a text for UI representation) based on a default language. + /// Provides a human-readable title (e.g., display a text for UI representation) based on a default language. /// - public string Title { get; set; } + string Title { get; set; } /// - /// Provides multi-language human-readable titles (e.g., display a text for UI representation in different languages). + /// Provides multi-language human-readable titles (e.g., display a text for UI representation in different languages). /// /// - public MultiLanguage Titles { get; set; } + MultiLanguage Titles { get; set; } /// - /// Provides additional (human-readable) information based on a default language. + /// Provides additional (human-readable) information based on a default language. /// - public string Description { get; set; } + string Description { get; set; } /// - /// Can be used to support (human-readable) information in different languages. + /// Provides multi-language human-readable titles (e.g., display a text for UI representation in different languages). /// /// - public MultiLanguage Descriptions { get; set; } - - /// - /// Provides a constant value. - /// - public object Const { get; set; } + MultiLanguage Descriptions { get; set; } /// - /// Supply a default value. + /// Set of form hypermedia controls that describe how an operation can be performed. Forms are serializations of Protocol Bindings. /// /// - /// The value SHOULD validate against the data schema in which it resides. + /// The array cannot be empty. /// - public object Default { get; set; } + Form[] Forms { get; set; } /// - /// Provides unit information that is used, e.g., in international science, engineering, and business. + /// Define URI template variables according to [RFC6570] as collection based on declarations. /// /// - /// To preserve uniqueness, it is recommended that the value of the unit points to a semantic definition (also see Section Semantic Annotations). + /// The Thing level uriVariables can be used in Thing level forms or in Interaction Affordances. + /// The individual variables DataSchema cannot be an ObjectSchema or an ArraySchema since each variable needs to be serialized to a string inside the href upon the execution of the operation. + /// If the same variable is both declared in Thing level uriVariables and in Interaction Affordance level, the Interaction Affordance level variable takes precedence. /// - public string Unit { get; set; } + /// + Dictionary UriVariables { get; set; } /// - /// Used to ensure that the data is valid against one of the specified schemas in the array. + /// A property to hold the original string of the InteractionAffordance JSON /// - /// - /// This can be used to describe multiple input or output schemas. - /// - public IDataSchema[] OneOf { get; set; } + /// + /// Original JSON String + /// + string OriginalJson { get; set; } + } - /// - /// Used to ensure that the data is valid against all of the specified schemas in the array. - /// - public IDataSchema[] AllOf { get; set; } - /// - /// Restricted set of values provided as an array. - /// + /// + /// Metadata that describes the data format used. It can be used for validation. + /// + [JsonConverter(typeof(DataSchemaConverter))] + public class DataSchema : IDataSchema + { + /// + public DataSchema() { } + + [JsonProperty("@type")] + public string[] AtType { get; set; } + public string Title { get; set; } + public MultiLanguage Titles { get; set; } + public string Description { get; set; } + public MultiLanguage Descriptions { get; set; } + public object Const { get; set; } + public object Default { get; set; } + public string Unit { get; set; } + public IDataSchema[] OneOf { get; set; } public object[] Enum { get; set; } - - /// - /// Boolean value that is a hint to indicate whether a property interaction / value is read only (=true) or not (=false). - /// - public bool ReadOnly { get; set; } - - /// - /// Boolean value that is a hint to indicate whether a property interaction / value is write only (=true) or not (=false). - /// + public bool ReadOnly { get; set; } public bool WriteOnly { get; set; } - - /// - /// Allows validation based on a format pattern such as "date-time", "email", "uri", etc. - /// public string Format { get; set; } - - /// - /// Assignment of JSON-based data types compatible with JSON Schema (one of boolean, integer, number, string, object, array, or null). - /// public string Type { get; } - - - } /// @@ -331,50 +456,14 @@ public DataSchema() { } /// public class ArraySchema : DataSchema, IArraySchema { - /// - /// Base Constructor - /// + /// public ArraySchema() { } - - /// - /// Assignment of JSON-based data types compatible with JSON Schema. - /// - /// - /// "array" - /// - public new readonly string Type = "array"; - - /// - /// Used to define the characteristics of an array. - /// + public new string Type { get => "array"; } public DataSchema[] Items { get; set; } - - /// - /// Defines the minimum number of items that have to be in the array. - /// public uint? MinItems { get; set; } - - /// - /// Defines the maximum number of items that have to be in the array. - /// public uint? MaxItems { get; set; } - - /// - /// Provides a constant value. - /// public new List Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public new List Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public new List[] Enum { get; set; } } @@ -386,35 +475,10 @@ public ArraySchema() { } /// public class BooleanSchema : DataSchema, IBooleanSchema { - /// - /// Base Constructor - /// public BooleanSchema() { } - - /// - /// Assignment of JSON-based data types compatible with JSON Schema. - /// - /// - /// "boolean" - /// - public new readonly string Type = "boolean"; - - /// - /// Provides a constant value. - /// + public new string Type { get => "boolean"; } public new bool Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public new bool Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public new bool[] Enum { get; set; } } @@ -426,60 +490,16 @@ public BooleanSchema() { } /// public class NumberSchema : DataSchema, INumberSchema { - /// - /// Base Constructor - /// + /// public NumberSchema() { } - - /// - /// Assignment of JSON-based data types compatible with JSON Schema. - /// - /// - /// "number" - /// - public new readonly string Type = "number"; - - /// - /// Specifies a minimum numeric value, representing an inclusive lower limit. - /// + public new string Type { get => "number"; } public double? Minimum { get; set; } - - /// - /// Specifies a minimum numeric value, representing an exclusive lower limit. - /// public double? ExclusiveMinimum { get; set; } - - /// - /// Specifies a maximum numeric value, representing an inclusive upper limit. - /// public double? Maximum { get; set; } - - /// - /// Specifies a maximum numeric value, representing an exclusive upper limit. - /// public double? ExclusiveMaximum { get; set; } - - /// - /// Specifies the multipleOf value number. The value must strictly greater than 0. - /// public double? MultipleOf { get; set; } - - /// - /// Provides a constant value. - /// public new double? Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public new double? Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public new double[] Enum { get; set; } } @@ -491,60 +511,16 @@ public NumberSchema() { } /// public class IntegerSchema : DataSchema, IIntegerSchema { - /// - /// Base Constructor - /// + /// public IntegerSchema() { } - - /// - /// Assignment of JSON-based data types compatible with JSON Schema. - /// - /// - /// "integer" - /// - public new readonly string Type = "integer"; - - /// - /// Specifies a minimum numeric value, representing an inclusive lower limit. - /// + public new string Type { get => "integer"; } public int? Minimum { get; set; } - - /// - /// Specifies a minimum numeric value, representing an exclusive lower limit. - /// public int? ExclusiveMinimum { get; set; } - - /// - /// Specifies a maximum numeric value, representing an inclusive upper limit. - /// public int? Maximum { get; set; } - - /// - /// Specifies a maximum numeric value, representing an exclusive upper limit. - /// public int? ExclusiveMaximum { get; set; } - - /// - /// Specifies the multipleOf value number. The value must strictly greater than 0. - /// public int? MultipleOf { get; set; } - - /// - /// Provides a constant value. - /// public new int? Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public new int? Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public new int[] Enum { get; set; } } @@ -553,50 +529,20 @@ public IntegerSchema() { } /// /// /// This Subclass is indicated by the value "object" assigned to Type in instances. - /// JSON object type is NOT the same as object type in C#. JSON object map to Dictionary. + /// + /// JSON object type is NOT the same as object type in C#. JSON object maps to C# Dictionary<string, object> . + /// /// public class ObjectSchema : DataSchema, IObjectSchema { - /// - /// Base Constructor - /// + /// public ObjectSchema() { } - - /// - /// Assignment of JSON-based data types compatible with JSON Schema. - /// - /// - /// "integer" - /// - public new readonly string Type = "object"; - - /// - /// Data schema nested definitions. - /// + public new string Type { get => "object"; } public Dictionary Properties { get; set; } - - /// - /// Defines which members of the object type are mandatory, i.e. which members are mandatory in the payload that is to be sent (e.g. input of invokeaction, writeproperty) and what members will be definitely delivered in the payload that is being received (e.g. output of invokeaction, readproperty) - /// public string[] Required { get; set; } - - /// - /// Provides a constant value. - /// - public new Dictionary Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// - public new Dictionary Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// - public new Dictionary[] Enum { get; set; } + public new Dictionary Const { get; set; } + public new Dictionary Default { get; set; } + public new Dictionary[] Enum { get; set; } } /// @@ -607,60 +553,16 @@ public ObjectSchema() { } /// public class StringSchema : DataSchema, IStringSchema { - /// - /// Base Constructor - /// + /// public StringSchema() { } - - /// - /// Assignment of JSON-based data types compatible with JSON Schema. - /// - /// - /// "string" - /// - public new readonly string Type = "string"; - - /// - /// Specifies the minimum length of a string. - /// + public new string Type { get => "string"; } public uint? MinLength { get; set; } - - /// - /// Specifies the maximum length of a string. - /// public uint? MaxLength { get; set; } - - /// - /// Provides a regular expression to express constraints of the string value. The regular expression must follow the [ECMA-262] dialect. - /// public string Pattern { get; set; } - - /// - /// Specifies the encoding used to store the contents, as specified in [RFC2045] (Section 6.1) and [RFC4648]. - /// public string ContentEncoding { get; set; } - - /// - /// Specifies the MIME type of the contents of a string value, as described in [RFC2046]. - /// public string ContentMediaType { get; set; } - - /// - /// Provides a constant value. - /// public new string Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public new string Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public new string[] Enum { get; set; } } @@ -676,19 +578,24 @@ public StringSchema() { } /// public class NullSchema : DataSchema { - /// - /// Base Constructor - /// + /// public NullSchema() { } - /// - /// + /// Assignment of JSON-based data types compatible with JSON Schema. /// - public new readonly string Type = "null"; + /// + /// Schema type: "null" + /// + public new string Type { get => "null"; } } + + /// + /// Metadata of a Thing that shows the possible choices to Consumers, thereby suggesting how Consumers may interact with the Thing. There are many types of potential affordances, but W3C WoT defines three types of Interaction Affordances: Properties, Actions, and Events. + /// public class InteractionAffordance : IInteractionAffordance { + /// public InteractionAffordance() { } [JsonProperty("@type")] public string[] AtType { get; set; } @@ -700,312 +607,541 @@ public InteractionAffordance() { } public Form[] Forms { get; set; } public Dictionary UriVariables { get; set; } } + + /// + /// A Subclass of that exposes state of the Thing. This state can then be retrieved (read) and/or updated (write). Things can also choose to make Properties observable by pushing the new state after a change. + /// + /// + /// Property instances are also instances of the class . + /// Therefore, it can contain the type, unit, readOnly and writeOnly members, among others. + /// [JsonConverter(typeof(PropertyAffordanceConverter))] public class PropertyAffordance : InteractionAffordance, IDataSchema { + /// public PropertyAffordance() { } - - /// - /// Provides a constant value. - /// public object Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public object Default { get; set; } public string Unit { get; set; } public IDataSchema[] OneOf { get; set; } - public IDataSchema[] AllOf { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public object[] Enum { get; set; } public bool ReadOnly { get; set; } public bool WriteOnly { get; set; } public string Format { get; set; } public string Type { get; set; } + + /// + /// A hint that indicates whether Servients hosting the Thing and Intermediaries should provide a Protocol Binding that supports the observeproperty and unobserveproperty operations for this Property. + /// + /// + /// If Property is observable or not. + /// public bool Observable { get; set; } + + /// public new PropertyForm[] Forms { get; set; } } + + /// + /// A Subclass of that also implements the DataSchema interface + /// public class ArrayPropertyAffordance : PropertyAffordance, IArraySchema { + /// public ArrayPropertyAffordance() { } - public new readonly string Type = "array"; + public new string Type { get => "array"; } public DataSchema[] Items { get; set; } public uint? MinItems { get; set; } public uint? MaxItems { get; set; } - - /// - /// Provides a constant value. - /// public new List Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public new List Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public new List[] Enum { get; set; } } + + /// + /// A Subclass of that also implements the DataSchema interface + /// public class BooleanPropertyAffordance : PropertyAffordance, IBooleanSchema { + /// public BooleanPropertyAffordance() { } - public new readonly string Type = "boolean"; - - /// - /// Provides a constant value. - /// + public new string Type { get => "boolean"; } public new bool Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public new bool Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public new bool[] Enum { get; set; } } + + /// + /// A Subclass of that also implements the DataSchema interface + /// public class NumberPropertyAffordance : PropertyAffordance, INumberSchema { + /// public NumberPropertyAffordance() { } - public new readonly string Type = "number"; + public new string Type { get => "number"; } public double? Minimum { get; set; } public double? ExclusiveMinimum { get; set; } public double? Maximum { get; set; } public double? ExclusiveMaximum { get; set; } public double? MultipleOf { get; set; } - - /// - /// Provides a constant value. - /// public new double? Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public new double? Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public new double[] Enum { get; set; } } + + /// + /// A Subclass of that also implements the DataSchema interface + /// public class IntegerPropertyAffordance : PropertyAffordance, IIntegerSchema { + /// public IntegerPropertyAffordance() { } - public new readonly string Type = "integer"; + public new string Type { get => "integer"; } public int? Minimum { get; set; } public int? ExclusiveMinimum { get; set; } public int? Maximum { get; set; } public int? ExclusiveMaximum { get; set; } public int? MultipleOf { get; set; } - - /// - /// Provides a constant value. - /// public new int? Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public new int? Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public new int[] Enum { get; set; } } + + /// + /// A Subclass of that also implements the DataSchema interface + /// public class ObjectPropertyAffordance : PropertyAffordance, IObjectSchema { + /// public ObjectPropertyAffordance() { } - public new readonly string Type = "object"; + public new string Type { get => "object"; } public Dictionary Properties { get; set; } public string[] Required { get; set; } - public new Dictionary Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// - public new Dictionary Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// - public new Dictionary[] Enum { get; set; } + public new Dictionary Const { get; set; } + public new Dictionary Default { get; set; } + public new Dictionary[] Enum { get; set; } } + + /// + /// A Subclass of that also implements the DataSchema interface + /// public class StringPropertyAffordance : PropertyAffordance, IStringSchema { + /// public StringPropertyAffordance() { } - public new readonly string Type = "string"; + public new string Type { get => "string"; } public uint? MinLength { get; set; } public uint? MaxLength { get; set; } public string Pattern { get; set; } public string ContentEncoding { get; set; } public string ContentMediaType { get; set; } - - /// - /// Provides a constant value. - /// public new string Const { get; set; } - - /// - /// Supply a default value. - /// - /// - /// The value SHOULD validate against the data schema in which it resides. - /// public new string Default { get; set; } - - /// - /// Restricted set of values provided as an array. - /// public new string[] Enum { get; set; } } + + /// + /// A Subclass of that represents a null Property + /// public class NullPropertyAffordance : PropertyAffordance { - public new readonly string Type = "null"; + public new string Type { get => "null"; } + /// public NullPropertyAffordance() { } - } + + + /// + /// A Subclass of representing an Interaction Affordance that allows to invoke a function of the Thing, which manipulates state (e.g., toggling a lamp on or off) or triggers a process on the Thing (e.g., dim a lamp over time). + /// [JsonConverter(typeof(ActionAffordanceConverter))] public class ActionAffordance : InteractionAffordance { + /// public ActionAffordance() { } + + /// + /// Used to define the input data schema of the Action. + /// + /// + /// metadata describing input payload + /// public DataSchema Input { get; set; } + + /// + /// Used to define the output data schema of the Action. + /// + /// + /// metadata describing output payload + /// public DataSchema Output { get; set; } + + /// + /// Signals if the Action is safe (=true) or not. Used to signal if there is no internal state (cf. resource state) is changed when invoking an Action. In that case responses can be cached as example. + /// + /// + /// indication of safety + /// public bool Safe { get; set; } + + /// + /// Indicates whether the Action is idempotent (=true) or not. Informs whether the Action can be called repeatedly with the same result, if present, based on the same input. + /// + /// + /// indication of idempotency + /// public bool Idempotent { get; set; } + + /// + /// Indicates whether the action is synchronous (=true) or not. A synchronous action means that the response of action contains all the information about the result of the action and no further querying about the status of the action is needed. Lack of this keyword means that no claim on the synchronicity of the action can be made. + /// + /// + /// indication of synchrony + /// public bool? Synchronous { get; set; } + + /// public new ActionForm[] Forms { get; set; } } + /// + /// A Subclass of that describes an event source, which asynchronously pushes event data to Consumers (e.g., overheating alerts). + /// [JsonConverter(typeof(EventAffordanceConverter))] public class EventAffordance : InteractionAffordance { + /// public EventAffordance() { } + + /// + /// Defines data that needs to be passed upon subscription, e.g., filters or message format for setting up Webhooks. + /// + /// + /// metadata describing subscription payload + /// public DataSchema Subscription { get; set; } + + /// + /// Defines the data schema of the Event instance messages pushed by the Thing. + /// + /// + /// metadata describing notification payload (data received) + /// public DataSchema Data { get; set; } + + /// + /// Defines the data schema of the Event response messages sent by the consumer in a response to a data message. + /// + /// + /// metadata describing notification response payload (data sent after each notification) + /// public DataSchema DataResponse { get; set; } + + /// + /// Defines any data that needs to be passed to cancel a subscription, e.g., a specific message to remove a Webhook. + /// + /// + /// metadata describing cancellation payload + /// public DataSchema Cancellation { get; set; } + + /// public new EventForm[] Forms { get; set; } } + /// + /// A form can be viewed as a statement of "To perform an operation type operation on form context, make a request method request to submission target" where the optional form fields may further describe the required request. + /// In Thing Descriptions, the form context is the surrounding Object, such as Properties, Actions, and Events or the Thing itself for meta-interactions. + /// [JsonConverter(typeof(FormConverter))] public class Form { + /// public Form() { } + + /// + /// Target IRI of a link or submission target of a form. + /// + /// + /// target IRI + /// public Uri Href { get; set; } + + /// + /// Assign a content type based on a media type (e.g., text/plain) and potential parameters (e.g., charset=utf-8) for the media type [RFC2046]. + /// + /// + /// content media type + /// public string ContentType { get; set; } + + /// + /// Content coding values indicate an encoding transformation that has been or can be applied to a representation. Content codings are primarily used to allow a representation to be compressed or otherwise usefully transformed without losing the identity of its underlying media type and without loss of information. Examples of content coding include "gzip", "deflate", etc. + /// + /// + /// encoding type + /// public string ContentCoding { get; set; } + + /// + /// Set of security definition names, chosen from those defined in securityDefinitions. These must all be satisfied for access to resources. + /// + /// + /// security definition names + /// public string[] Security { get; set; } + + /// + /// Set of authorization scope identifiers provided as an array. These are provided in tokens returned by an authorization server and associated with forms in order to identify what resources a client may access and how. The values associated with a form SHOULD be chosen from those defined in an OAuth2SecurityScheme active on that form. + /// + /// + /// scope identifiers + /// public string[] Scopes { get; set; } - public AdditionalExpectedResponse? AdditionalExpectedResponse { get; set; } + + /// + /// This optional term can be used if, e.g., the output communication metadata differ from input metadata (e.g., output contentType differ from the input contentType). The response name contains metadata that is only valid for the primary response messages. + /// + /// + /// metadata describing primary response payload + /// + public ExpectedResponse? Response { get; set; } + + /// + /// This optional term can be used if additional expected responses are possible, e.g. for error reporting. Each additional response needs to be distinguished from others in some way (for example, by specifying a protocol-specific error code), and may also have its own data schema. + /// + /// + /// metadata describing additional expected responses + /// + public AdditionalExpectedResponse[] AdditionalExpectedResponse { get; set; } + + /// + /// Indicates the exact mechanism by which an interaction will be accomplished for a given protocol when there are multiple options. For example, for HTTP and Events, it indicates which of several available mechanisms should be used for asynchronous notifications such as long polling (longpoll), WebSub [websub] (websub), Server-Sent Events (sse) [html] (also known as EventSource). Please note that there is no restriction on the subprotocol selection and other mechanisms can also be announced by this subprotocol term. + /// + /// + /// the subprotocol + /// public string Subprotocol { get; set; } + + /// + /// A property to hold the original string of the Form JSON + /// + /// + /// original JSON string + /// public string OriginalJson { get; set; } + + /// + /// Indicates the semantic intention of performing the operation(s) described by the form. For example, the Property interaction allows get and set operations. The protocol binding may contain a form for the get operation and a different form for the set operation. The op attribute indicates which form is for which and allows the client to select the correct form for the operation required. op can be assigned one or more interaction verb(s) each representing a semantic intention of an operation. + /// + /// + /// the operation + /// public string[] Op { get; set; } } + /// + /// A Helper Subclass of for properties used for serialization + /// [JsonConverter(typeof(PropertyFormConverter))] public class PropertyForm : Form { + /// public PropertyForm() { } } + /// + /// A Helper Subclass of for actions used for serialization + /// [JsonConverter(typeof(ActionFormConverter))] public class ActionForm : Form { + /// public ActionForm() { } } + /// + /// A Helper Subclass of for events used for serialization + /// [JsonConverter(typeof(EventFormConverter))] public class EventForm : Form { + /// public EventForm() { } } - + /// + /// A link can be viewed as a statement of the form "link context has a relation type resource at link target", where the optional target attributes may further describe the resource. + /// + /// TD Specification public struct Link { + /// + /// Target IRI of a link or submission target of a form. + /// + /// + /// target IRI + /// public Uri Href { get; set; } + + /// + /// Target attribute providing a hint indicating what the media type [RFC2046] of the result of dereferencing the link should be. + /// + /// + /// target media type + /// public string Type { get; set; } + + /// + /// A link relation type identifies the semantics of a link. + /// + /// + /// link relation type + /// public string Rel { get; set; } + + /// + /// Overrides the link context (by default the Thing itself identified by its id) with the given URI or IRI. + /// + /// + /// anchor URI + /// public Uri Anchor { get; set; } - public string Uri { get; set; } + + /// + /// Target attribute that specifies one or more sizes for the referenced icon. Only applicable for relation type "icon". The value pattern follows {Height}x{Width} (e.g., "16x16", "16x16 32x32"). + /// + /// + /// icon size following pattern {Height}x{Width} + /// + public string Sizes { get; set; } + + /// + /// The hreflang attribute specifies the language of a linked document. The value of this must be a valid language tag [BCP47]. + /// + /// + /// language tag + /// [JsonConverter(typeof(StringTypeConverter))] public string[] Hreflang { get; set; } } + + /// + /// Metadata of a Thing that provides version information about the TD document. + /// If required, additional version information such as firmware and hardware version (term definitions outside of the TD namespace) can be extended via the TD Context Extension mechanism. + /// public struct VersionInfo { + /// + /// Provides a version indicator of this TD. + /// + /// + /// version of this TD instance + /// public string Instance { get; set; } + + /// + /// Provides a version indicator of the underlying TM. + /// + /// + /// version of underlying model + /// public string Model { get; set; } + /// + /// Creates a new instance of with the given instance version. + /// Sets to null + /// + /// version of TD instance public VersionInfo(string instance) { this.Instance = instance; this.Model = null; } + + /// + /// Creates a new instance of with the given instance and model version. + /// + /// version of TD instance + /// version of underlying TM public VersionInfo(string instance, string model) { this.Instance = instance; this.Model = model; } + /// + /// Creates a new instance of with the given VersionInfo + /// + /// info struct public VersionInfo(VersionInfo versionInfo) { this = versionInfo; } } - public struct ExpectedRespone + + /// + /// Communication metadata describing the expected response message for the primary response. + /// + public struct ExpectedResponse { + /// + /// Assign a content type based on a media type (e.g., text/plain) and potential parameters (e.g., charset=utf-8) for the media type [RFC2046]. + /// + /// + /// content media type + /// public string ContentType { get; set; } - public ExpectedRespone(string contentType) + + /// + /// Creates a new . Takes contentType as input. + /// + /// content type of response + public ExpectedResponse(string contentType) { this.ContentType = contentType; } } + /// + /// Communication metadata describing the expected response message for additional responses. + /// public struct AdditionalExpectedResponse { + /// + /// Assign a content type based on a media type (e.g., text/plain) and potential parameters (e.g., charset=utf-8) for the media type [RFC2046]. + /// + /// + /// content media type + /// public string ContentType { get; set; } + + /// + /// Signals if an additional response should not be considered an error. + /// public bool Success { get; set; } + + /// + /// Used to define the output data schema for an additional response if it differs from the default output data schema. Rather than a DataSchema object, the name of a previous definition given in a schemaDefinitions map must be used. + /// public string Schema { get; set; } + + /// + /// Creates a new . Takes contentType as input. + /// + /// content type of response public AdditionalExpectedResponse(string contentType) { this.ContentType = contentType; @@ -1015,28 +1151,112 @@ public AdditionalExpectedResponse(string contentType) } + /// + /// Metadata describing the configuration of a security mechanism. + /// + /// [JsonConverter(typeof(SecuritySchemeConverter))] public abstract class SecurityScheme { + /// + /// JSON-LD keyword to label the object with semantic tags (or types). + /// + /// + /// semantic tags + /// [JsonProperty("@type")] public string[] AtType { get; set; } + + /// + /// Provides additional (human-readable) information based on a default language. + /// + /// + /// scheme description + /// public string Description { get; set; } + + /// + /// Can be used to support (human-readable) information in different languages. Also see + /// + /// + /// a mapping of language tags and corresponding scheme descriptions + /// public MultiLanguage Descriptions { get; set; } + + /// + /// URI of the proxy server this security configuration provides access to. If not given, the corresponding security configuration is for the endpoint. + /// + /// + /// URI of proxy server + /// public Uri Proxy { get; set; } + + /// + /// Identification of the security mechanism being configured. + /// + /// + /// type of security mechanism + /// public string Scheme { get; set; } } + /// + /// A security configuration corresponding to identified by the Vocabulary Term nosec (i.e., "scheme": "nosec"), indicating there is no authentication or other mechanism required to access the resource. + /// public class NoSecurityScheme : SecurityScheme { + /// public NoSecurityScheme() { } - public new readonly string Scheme = "nosec"; + + /// + /// Identification of the security mechanism being configured. + /// + /// + /// type of security mechanism: "nosec" + /// + public new string Scheme { get => "nosec"; } } + /// + /// Basic Authentication [RFC7617] security configuration identified by the Vocabulary Term basic (i.e., "scheme": "basic"), using an unencrypted username and password. + /// public class BasicSecurityScheme : SecurityScheme { + /// public BasicSecurityScheme() { } - public new readonly string Scheme = "basic"; + + /// + /// Identification of the security mechanism being configured. + /// + /// + /// type of security mechanism: "basic" + /// + public new string Scheme { get => "basic"; } + + /// + /// Name for query, header, cookie, or uri parameters. + /// + /// + /// designated name + /// public string Name { get; set; } + + /// + /// Specifies the location of security authentication information. + /// + /// + /// location of security authentication information. + /// + /// Possible values: + /// + /// "header" + /// "query" + /// "body" + /// "cookie" + /// "cookie" + /// + /// + /// public string In { get; set; } } @@ -1045,9 +1265,7 @@ public BasicSecurityScheme() { } /// public class ThingDescription { - /// - /// Base Constructor - /// + /// public ThingDescription() { } /// @@ -1059,7 +1277,7 @@ public ThingDescription() { } /// ///JSON-LD keyword to label the object with semantic tags (or types). - /// + /// [JsonProperty("@type")] [JsonConverter(typeof(StringTypeConverter))] public string[] AtType { get; set; } @@ -1179,9 +1397,9 @@ public ThingDescription() { } public Dictionary SchemaDefinitions { get; set; } /// - /// Define URI template variables according to [RFC6570] as collection based on DataSchema declarations. + /// Define URI template variables according to [RFC6570] as collection based on declarations. /// - /// + /// /// The Thing level uriVariables can be used in Thing level forms or in Interaction Affordances. /// The individual variables DataSchema cannot be an ObjectSchema or an ArraySchema since each variable needs to be serialized to a string inside the href upon the execution of the operation. /// If the same variable is both declared in Thing level uriVariables and in Interaction Affordance level, the Interaction Affordance level variable takes precedence. diff --git a/WoT/docs/getting-started.md b/WoT/docs/getting-started.md deleted file mode 100644 index 8b3a794..0000000 --- a/WoT/docs/getting-started.md +++ /dev/null @@ -1 +0,0 @@ -# Getting Started \ No newline at end of file diff --git a/WoT/docs/introduction.md b/WoT/docs/introduction.md deleted file mode 100644 index f6ecaa6..0000000 --- a/WoT/docs/introduction.md +++ /dev/null @@ -1 +0,0 @@ -# Introduction \ No newline at end of file diff --git a/WoT/docs/toc.yml b/WoT/docs/toc.yml deleted file mode 100644 index d7e9ea8..0000000 --- a/WoT/docs/toc.yml +++ /dev/null @@ -1,4 +0,0 @@ -- name: Introduction - href: introduction.md -- name: Getting Started - href: getting-started.md \ No newline at end of file diff --git a/WoT/images/WoT_DoT_Net_Logo.svg b/WoT/images/WoT_DoT_Net_Logo.svg deleted file mode 100644 index 7c76383..0000000 --- a/WoT/images/WoT_DoT_Net_Logo.svg +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - WOT.NET - - - - diff --git a/WoT/images/WoT_DoT_Net_Logo_no_background.svg b/WoT/images/WoT_DoT_Net_Logo_no_background.svg deleted file mode 100644 index 6753bae..0000000 --- a/WoT/images/WoT_DoT_Net_Logo_no_background.svg +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - WOT.NET - - - - diff --git a/WoT/images/WoT_DoT_Net_Logo_no_background_small.svg b/WoT/images/WoT_DoT_Net_Logo_no_background_small.svg deleted file mode 100644 index 8dbf877..0000000 --- a/WoT/images/WoT_DoT_Net_Logo_no_background_small.svg +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - WOT.NET - - - - - diff --git a/WoT/images/favicon.ico b/WoT/images/favicon.ico deleted file mode 100644 index 80d2971..0000000 Binary files a/WoT/images/favicon.ico and /dev/null differ