在SwaggerWcf中更改参数类型

时间:2017-05-09 14:25:46

标签: wcf configuration swagger swagger-wcf

Swagger允许设置parameter type但是SwaggerWcf我无法编辑此文件,它已生成。它默认设置为body,但我需要它为path。

有人可能认为SwaggerWcfParameterAttribute会允许设置此项。但它只允许DescriptionRequired

如何具体设置?

1 个答案:

答案 0 :(得分:2)

您是否尝试使用示例服务中的格式?

https://github.com/abelsilva/swaggerwcf/blob/master/src/SwaggerWcf.Test.Service/IStore.cs#L48

    [SwaggerWcfPath("Get book author", "Retrieve the author of a book using the book id")]
    [WebGet(UriTemplate = "/books/{id}/author", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
    [OperationContract]
    Author ReadBookAuthor(string id);

路径中的参数id将传递给函数