Swagger UI描述

时间:2016-12-16 14:22:59

标签: c# swagger

    /// <summary>
    /// This method will retrieve a company in portal
    /// </summary>
    /// <param name="UserName">This is the Username assigned to a company to allow service procesing</param>
    /// <param name="ActualCompanyName">Actual Name of the company</param>
    /// <returns>This returns a PortalCompany object <see cref="PortalCompany"/> upon successful completion.  If a failure arises it will return <see cref="SiteAccessException"/> object.  The restful nodes will return</returns>

    [OperationContract]
    [WebInvoke(Method = "GET",
        UriTemplate = "GetCompany/{UserName}/{ActualCompanyName}")]
    [SwaggerWcf.Attributes.SwaggerWcfPath("Get Company", "Get Company to the portal")]
    PortalCompany GetCompany(String UserName, String ActualCompanyName);

这是我的运营合同。我需要在本节中查看说明。请参阅图片以供参考。

Swagger UI

1 个答案:

答案 0 :(得分:0)

您正在寻找参数的描述,而不是终点。

如果您需要在任何DataContract属性上显示说明,则应在其上添加DescriptionAttribute

[DataContract(Name = "book")]
public class MyContract
{
    [DataMember(Name = "UserName")]
    [Description("Name of the user")]
    public string UserName{ get; set; }

    // [.......]
}

您应该查看文档,以便更好地保留这些参数:SwaggerWcf