django-ninja icon indicating copy to clipboard operation
django-ninja copied to clipboard

[BUG] Openapi generated docs won't submit arrays correctly in forms.

Open KonstantinosPetrakis opened this issue 6 months ago • 1 comments

Greetings. There's been an issue to the problem I am referring to, which was closed for no reason to my understanding.

Essentially, when you define a Schema with a List[str] field the openapi generated documentation is not in sync with what the schema excepts.

The schema excepts a repeated value (e.g names=John&names=Jane) or through JavaScript code:

const names = ["John", "Jane"];
const form = new FormData();
for (const name of names) form.append("names", name);
// make request

But the openapi docs send a single comma separated string resulting to an array with a single item containing that string (e.g ["John, Jane"].

The documentation is supposed to work out of the box. User code checking for commas to fix that library issue shouldn't be acceptable (what if the separated string contained a comma itself?).

KonstantinosPetrakis avatar Aug 30 '24 08:08 KonstantinosPetrakis