essencebit / SignalRSwaggerGen

MIT License
70 stars 8 forks source link

IEnumerables #12

Closed RobertHaerle closed 2 years ago

RobertHaerle commented 2 years ago

Having a method with the signature [SignalRMethod(SignalR.Cartridges.ChangedSetupCartridgesEvent, OperationType.Get)] public async Task SendChangedSetupCartridgesAsync([SignalRArg("the info about the changes.", typeof (CartridgeInfoSignalR[]))] CartridgeInfoSignalR[] changedSetupCartridges) generates only an object array in swagger.html

changedSetupCartridges | the info about the changes. array[object] (query)

"Try It Out" somehow finds the class used as an argument

Dorin-Mocan commented 2 years ago

Hello @RobertHaerle , I'll investigate the issues by tomorrow evening and come back to you. Sorry for not reacting quicker, it's just I haven't entered GitHub for several days.

Dorin-Mocan commented 2 years ago

@RobertHaerle , unfortunately Swagger does not support as parameters complex type array, only arrays of primitive type. For reference: swagger documentation On the bottom of the page in FAQ section the following is mentioned: schema is only used with in: body parameters. Any other parameters expect a primitive type, such as type: string, or an array of primitives.

You can observe the same issue if you try adding complex type arrays as query parameters for controller actions.

Dorin-Mocan commented 2 years ago

@RobertHaerle , as an alternative of using this single parameter, you could use a request body to depict what data the method will get. For this decorate the method with SignalRRequestBodyAttribute.