我正在使用 ServiceStack,我想帮助生成元数据的“自动文档”。
我最近找到了 ApiAttribute
和 ApiMemberAttribute
(mentioned here 和 here)。但是,我无法获取 http://me/api/metadata?op=ReadFormType
页面来为修饰的成员发出任何信息。
他是我的 DTO 的精简版(到目前为止它只是一个 stub ),它使用了一个测试属性:
[Api("Read FormType")]
[Route("/formTypes/{FormType}", "GET")]
public class ReadFormType
{
[ApiMember(Name = "X", Description = "X Description",
ParameterType = "path", DataType = "string", IsRequired = true)]
public string X { get; set; }
}
ApiAttribute
文本确实正确地出现在元数据响应的顶部,并且成员正确地列在下面的 Request DTO 部分中。
要使ApiMemberAttribute
中的额外信息出现,我需要做什么? (或者我误解了这个属性是如何工作的?)
ServiceStack的版本是3.9.35。
最佳答案
Api
和ApiMember
属性当前用于ServiceStack's Swagger support .
但在下一版本的 ServiceStack 中,我们还将它们包含到 ServiceStack 自动生成的元数据页面中。
关于c# - ApiMember 属性未显示在 ServiceStack 生成的元数据中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14782562/