【发布时间】:2013-02-11 12:00:22
【问题描述】:
是否可以在属性中添加描述属性?
我正在使用 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 样式的 cmets 添加到 JSON 模式中作为描述?
【问题讨论】:
-
您找到解决方案了吗?