koa-swagger-decorator
koa-swagger-decorator copied to clipboard
Add support for operationId
官网文档说明链接:https://swagger.io/docs/specification/paths-and-operations/
operationId is an optional unique string used to identify an operation. If provided, these IDs must be unique among all operations described in your API.
没用过 operationId 这个功能,对此不是很了解。如果有相关的需求可以在这里讨论或提交 PR
需求:通过swagger文档生成前端取数函数的命名,后端实现了这种统一且规范的命名,前端就可以直接拿来用了,避免前后重复命名以及沟通成本
我这里根据自己的需求更改之后,提交PR
参考项目:https://github.com/lukeautry/tsoa
好的,感谢~
Hello, OperationId is available only for the UI mode not for the JSON mode, am I right? Thank you!
我尝试使用提供的desc方法写入一个operationId, const operationId = desc("operationId"); ... @operationId("userLogin") ...
但发现最终没有被写入到json中,看了源码发现swaggerJSON中没有可能自行添加字段。
paths[path][method] = {
consumes,
summary,
description,
parameters,
responses,
tags,
security,
deprecated
};
只能修改源码了吗?
需求:通过swagger文档生成前端取数函数的命名,后端实现了这种统一且规范的命名,前端就可以直接拿来用了,避免前后重复命名以及沟通成本
我这里根据自己的需求更改之后,提交PR 这个PR 你提交了吗?