You can provide metadata descriptions for each of your web services by attributing your Request DTOs with [Api] and [ApiMember] attributes. This information will be displayed on the dynamic metadata pages.
Another option is to simply create your own dynamic html page, which ServiceStack allows you to do by simply returning a string (containing your html markup). If you go this route you can access the Service Types metadata with the global EndpointHost.ServiceOperations property.
Also if dynamically generating html with C# is not your preference you can also generate html using the built-in Razor Markdown format which makes generating html quite pleasant :)
发布评论
评论(2)
您可以通过使用 [Api] 和 [ApiMember] 属性为您的请求 DTO 提供元数据描述。
此信息将显示在动态元数据页面上。
另一种选择是简单地创建您自己的动态 html 页面,ServiceStack 允许您通过简单地返回一个字符串(包含您的 html 标记)来完成此操作。如果您选择此路线,则可以使用全局 EndpointHost.ServiceOperations 属性访问服务类型元数据。
此外,如果您不喜欢使用 C# 动态生成 html,您还可以使用内置的 生成 html Razor Markdown 格式 这使得生成 html 变得非常愉快:)
You can provide metadata descriptions for each of your web services by attributing your Request DTOs with [Api] and [ApiMember] attributes.
This information will be displayed on the dynamic metadata pages.
Another option is to simply create your own dynamic html page, which ServiceStack allows you to do by simply returning a string (containing your html markup). If you go this route you can access the Service Types metadata with the global EndpointHost.ServiceOperations property.
Also if dynamically generating html with C# is not your preference you can also generate html using the built-in Razor Markdown format which makes generating html quite pleasant :)
我意识到这个问题已经有几年了,但是现在 Swagger 支持 ServiceStack API @ https ://github.com/ServiceStack/ServiceStack/wiki/Swagger-API
I realize this question is a couple years old, but there is now Swagger support for ServiceStack API's @ https://github.com/ServiceStack/ServiceStack/wiki/Swagger-API