RicoSuter/NSwag

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

Open

#3398 aperta il 7 apr 2021

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)C# (1189 fork)batch import
help wantedproject: NSwag.CodeGeneration.CSharp (Clients)

Metriche repository

Star
 (6291 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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?

Guida contributor