nenoNaninu / TypedSignalR.Client.DevTools

SignalR development tools inspired by SwaggerUI.
MIT License
47 stars 3 forks source link

Overriding method name using HubMethodNameAttribute #102

Open alefcarlos opened 3 weeks ago

alefcarlos commented 3 weeks ago

Hey! This is a great project !

It would be cool if the HubMethodNameAttribute is applied replace the methodName on jsonSpec.

[Authorize]
public class TrackingsHub : Hub<ITrackingsClientContract>, ITrackingsHub
{
    [HubMethodName("subscribe-pusher")]
    public async Task<ReplyPayload> SubscribePushersAsync(SubscribeOptions options)
    {
       .....
    }
}
[
    {
        "name": "TrackingsHub",
        "path": "/hubs/trackings",
        "isAuthRequired": true,
        "hubType": {
            "interfaceName": "ITrackingsHub",
            "interfaceFullName": "global::Hbsa.Navigation.Tracker.Hubs.Client.ITrackingsHub",
            "collisionFreeName": "global__Hbsa_Navigation_Tracker_Hubs_Client_ITrackingsHub",
            "methods": [
                {
                    "methodName": "subscribe-pusher", 👈Here
                    "returnType": "global::System.Threading.Tasks.Task<global::Hbsa.Navigation.Tracker.Hubs.Client.Contracts.ReplyPayload>",
                    "isGenericReturnType": true,
                    "genericReturnTypeArgument": "global::Hbsa.Navigation.Tracker.Hubs.Client.Contracts.ReplyPayload",
                    "parameters": [
                        {
                            "name": "options",
                            "typeName": "global::Hbsa.Navigation.Tracker.Hubs.Client.SubscribeOptions"
                        }
                    ]
                },
            ]
        }
    }
]

If you accept I could help with a PR ;)

nenoNaninu commented 2 weeks ago

Related: https://github.com/nenoNaninu/TypedSignalR.Client.TypeScript/issues/139