papsign / Ktor-OpenAPI-Generator

Ktor OpenAPI/Swagger 3 Generator
Apache License 2.0
241 stars 42 forks source link

FormDataRequest issue with nullable parameters #83

Closed BernatCarbo closed 3 years ago

BernatCarbo commented 3 years ago

Hi there, I'm having a little issue with a FormDataRequest post request, I'm using the next request body: testRequest

This is translated as: requestBody testRequest2

But all the parameters are added to the request (even the ones which are not specified) at this way:

"Content-Type: multipart/form-data" -F "abbreviation= " -F "name= " -F "icon= "

I believe that those shouldn't be added to the request if aren't specified

Wicpar commented 3 years ago

You mean in the swagger UI interface ? This is expected behavior as there is no way to separate empty strings from null, since the field is always displayed.

BernatCarbo commented 3 years ago

Hello, Yes, from the swagger UI, when I click at 'execute' I would expect to be sent only the paramaters that have been specified with values (and hence the rest are null), for example from this (only the name field have a value, the rest are null): 101406177-66483900-38d9-11eb-9991-bc3713fb431c I would expect the parameter 'name' to be sent at the request, but not the rest of them which doesn't have any value specified.

Wicpar commented 3 years ago

I do not manage the swagger UI project so I cannot help you with that, you can find another ui that accepts OpenAPI.json that suits your needs and disable the swagger ui in the settings.