Swagger 允许设置 parameter type但与 SwaggerWcf我无法编辑该文件,它已生成。默认情况下它设置为正文,但我需要它是路径。
有人可能会认为 SwaggerWcfParameterAttribute
允许设置此项。但它只允许 Description
和 Required
。
具体如何设置?
最佳答案
您是否尝试过使用示例服务中的格式?
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 将传递给函数
关于wcf - 更改 SwaggerWcf 中的参数类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43872506/