danieleteti / delphimvcframework

DMVCFramework (for short) is a popular and powerful framework for WEB API in Delphi. Supports RESTful and JSON-RPC WEB APIs development.
Apache License 2.0
1.23k stars 356 forks source link

Swagger Param Body Array #713

Closed intracloud closed 6 months ago

intracloud commented 10 months ago

Hi,

How define in MVCSwagParam that body is jsonArray and not jsonBody. If I indicate that the body is of type ptArray, Swagger still shows the interface as a jsonObject and not as a jsonArray

[MVCSwagParam(TMVCSwagParamLocation.plBody,'xxx,'xxx',TClass, TMVCSwagParamType.ptArray)]

In MVCSwagResponses is possible add true in the fourth parameter.

Thanks for all.

danieleteti commented 10 months ago

Maybe @joaoduarte19 can help you with this

joaoduarte19 commented 10 months ago

Hi,

How define in MVCSwagParam that body is jsonArray and not jsonBody. If I indicate that the body is of type ptArray, Swagger still shows the interface as a jsonObject and not as a jsonArray

[MVCSwagParam(TMVCSwagParamLocation.plBody,'xxx,'xxx',TClass, TMVCSwagParamType.ptArray)]

In MVCSwagResponses is possible add true in the fourth parameter.

Thanks for all.

Currently it is not possible to define the body type parameter as an array.

I'll add this function ASAP.

intracloud commented 10 months ago

Thanks.

On Tue, Nov 28, 2023 at 6:14 PM João Antônio Duarte < @.***> wrote:

Hi,

How define in MVCSwagParam that body is jsonArray and not jsonBody. If I indicate that the body is of type ptArray, Swagger still shows the interface as a jsonObject and not as a jsonArray

[MVCSwagParam(TMVCSwagParamLocation.plBody,'xxx,'xxx',TClass, TMVCSwagParamType.ptArray)]

In MVCSwagResponses is possible add true in the fourth parameter.

Thanks for all.

Currently it is not possible to define the body type parameter as an array.

I'll add this function ASAP.

— Reply to this email directly, view it on GitHub https://github.com/danieleteti/delphimvcframework/issues/713#issuecomment-1830326052, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACERZMWAULBGFKXUS5C5ZALYGYLWXAVCNFSM6AAAAAA7JJY5ESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZQGMZDMMBVGI . You are receiving this because you authored the thread.Message ID: @.***>

--

RAFA FERNÁNDEZCEO CTO Intracloud 655.52.98.79 @.*** http://www.intracloud.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener información privilegiada y/o confidencial. Si no es Vd. el destinatario indicado queda notificado de que la utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error le rogamos nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción.

This message is intended exclusively for its address and may contain information that is CONFIDENTIAL and protected by professional privilege. If you are not the intended recipient you are hereby notified that any dissemination, copy or disclosure of this communication is strictly prohibited by law. If this message has been received in error, please immediately notify us via e-mail and delete it.

danieleteti commented 7 months ago

Any news about this? 3.4.2-magnesium could receive this fix.

joaoduarte19 commented 6 months ago

Hi,

How define in MVCSwagParam that body is jsonArray and not jsonBody. If I indicate that the body is of type ptArray, Swagger still shows the interface as a jsonObject and not as a jsonArray

[MVCSwagParam(TMVCSwagParamLocation.plBody,'xxx,'xxx',TClass, TMVCSwagParamType.ptArray)]

In MVCSwagResponses is possible add true in the fourth parameter.

Thanks for all.

The Swagger generator has been modified to accept body parameters as an array of objects. It was done as suggested: [MVCSwagParam(TMVCSwagParamLocation.plBody,'xxx,'xxx',TClass, TMVCSwagParamType.ptArray)]

See this being used in samples/swaggerdoc

intracloud commented 6 months ago

Thanks. Greet job.