Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2157
Closed
Open
Issue created Feb 14, 2019 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[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

Assignee
Assign to
Time tracking