[BUG][core] collectionFormat used for request body parameters
Created by: rienafairefr
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output?
Description
OAS3 specifies collectionFormat
that is useful for serializing collection parameters into places where collections need to be serialized, like in query, header, cookie parameters or path parameters. But it does not mention using collectionFormat for parameters that are somewhere else, for example as a request body.
But openapi-generator provides a collectionFormat value, including for parameters that are not query/header/path/cookie.
This means if we want to pass an array as a JSON in the body, for example, the only workaround is to declare that parameter as not array
but string
, and force the clients to pass us a json string instead of an array.
openapi-generator version
latest master 2593d78c
OpenAPI declaration file content or url
/endpoint:
post:
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
values:
type: array
items:
type: string
description: list of values
Related issues/PRs
#2125 is close, but for path
parameters
Suggest a fix
the collectionFormat
field for CodegenParameter
should stay null in case of body parameters