记录ServiceStack Web服务 [英] Documenting ServiceStack web services

查看:151
本文介绍了记录ServiceStack Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

记录基于Web服务的ServiceStack有哪些选项,我不是在说一行字符串。



我想能够详细的记录(可能很长),返回类型,可能的HTTP响应,添加详细示例等。 b
$ b

在ServiceStack中是否有任何支持(我找不到)?
如果没有人以某种其他方式解决了问题。

解决方案

您可以为每个通过将您的请求DTO归因于[Api]和[ApiMember]属性来进行Web服务。
此信息将显示在动态元数据页面上。



另一个选项是简单地创建自己的动态HTML页面,ServiceStack允许您简单地返回一个字符串(包含你的html标记)。如果您走这条路线,您可以使用全局 EndpointHost.ServiceOperations 属性访问服务类型元数据。



此外,如果使用C#动态生成html不是您的偏好,您也可以使用内置的 Razor Markdown格式生成html使生成html相当愉快:)


What are the options for documenting a ServiceStack bases web services and I'm not talking about a one line string.

I would like to be able to document, in detail (which can be long), return types, possible HTTP responses, add detailed examples etc.

Is there any support for this in ServiceStack (I couldn't find it)? If not has anybody solved the problem in some other way.

解决方案

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 :)

这篇关于记录ServiceStack Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆