4
是否可以向屬性添加描述屬性?在使用json.net生成JSON模式時向屬性添加描述
我使用json.net生成模式:
var shema = new Newtonsoft.Json.Schema.JsonSchemaGenerator();
var sh = shema.Generate(typeof(APIDocumentation.AlertDTO), false).ToString();
而且我想補充一些簡單的文檔,供用戶瞭解每個字段的含義。 現在,我可以使用[JsonObject(Description =「my description」)]將描述屬性添加到類中,但它不能用於類中的屬性。是否有一個方法可行這樣做:
[JsonObject(Description = "My description")]
public class AlertDTO
{
[SomeAttribute(Description="Property description")]
public string Type { get; set; }
}
或者,也許有一種方式,採取VS風格的註釋,並將它們添加到JSON模式的描述?
需要這樣太:/ – Sebastian 2017-01-31 09:54:42
你找到解決辦法了嗎? – Yoztastic 2017-05-25 08:57:18