koa-swagger-decorator icon indicating copy to clipboard operation
koa-swagger-decorator copied to clipboard

Add support for operationId

Open haitaodesign opened this issue 5 years ago • 7 comments

官网文档说明链接: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.

haitaodesign avatar Apr 17 '19 16:04 haitaodesign

没用过 operationId 这个功能,对此不是很了解。如果有相关的需求可以在这里讨论或提交 PR

Cody2333 avatar Apr 19 '19 02:04 Cody2333

需求:通过swagger文档生成前端取数函数的命名,后端实现了这种统一且规范的命名,前端就可以直接拿来用了,避免前后重复命名以及沟通成本

我这里根据自己的需求更改之后,提交PR

haitaodesign avatar Apr 22 '19 13:04 haitaodesign

参考项目:https://github.com/lukeautry/tsoa

haitaodesign avatar Apr 22 '19 13:04 haitaodesign

好的,感谢~

Cody2333 avatar Apr 22 '19 14:04 Cody2333

Hello, OperationId is available only for the UI mode not for the JSON mode, am I right? Thank you!

nvt1995-dev avatar Mar 29 '20 14:03 nvt1995-dev

我尝试使用提供的desc方法写入一个operationId, const operationId = desc("operationId"); ... @operationId("userLogin") ...

但发现最终没有被写入到json中,看了源码发现swaggerJSON中没有可能自行添加字段。

    paths[path][method] = {
        consumes,
        summary,
        description,
        parameters,
        responses,
        tags,
        security,
        deprecated
    };

只能修改源码了吗?

jscoolso avatar Feb 20 '21 10:02 jscoolso

需求:通过swagger文档生成前端取数函数的命名,后端实现了这种统一且规范的命名,前端就可以直接拿来用了,避免前后重复命名以及沟通成本

我这里根据自己的需求更改之后,提交PR 这个PR 你提交了吗?

imakan avatar Oct 18 '21 08:10 imakan