RicoSuter/NSwag

need to remove/replace some more characters that are invalid for C# method names when using operationId and path segments

开放

#3,398 创建于 2021年4月7日

 (3 条评论) (0 个反应) (0 位负责人)C# (1,356 个派生)batch import
help wantedproject: NSwag.CodeGeneration.CSharp (Clients)

仓库指标

星标
 (7,358 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

I have a swagger 2.0 file that uses a query parameter in the path and has an operationId that contains a $

This is hitting VMware's vCenter

    "/rest/vcenter/vcha/cluster/mode?vmw-task=true": {
        "put": {
            [... extra deleted ...]
            "operationId": "set$task"
        }
    },

when using SingleClientFromPathSegments, the method name generated is "RestVcenterVchaClusterMode?vmwTask=trueAsync" which is invalid (? and = need to be removed or replaced AFAICT?)

when using SingleClientFromOperationId, the method name generated is "Set$taskAsync" which is invalid ($ needs to be removed or replaced AFAICT?)

Hopefully filtering out characters that are invalid C# would do the trick?

贡献者指南