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
  • #5536
Closed
Open
Issue created Mar 06, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] PHP client is not sending multipart request unless a file is part of the schema

Created by: reeperbahnause

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix
Description

I noticed that even if the OpenAPI3 definition says it consumes multipart/form-data the generated client is not sending multipart request. It only sends multipart requests if a property of the type string and format binary is defined and used in the request (definition only is not changing anything). In my point of view the client should send what the server api has defined to be consumed.

openapi-generator version

4.2.3, 4.3.0 and 5.0.0

OpenAPI declaration file content or url

https://gist.github.com/reeperbahnause/07fc91a8c276e7479c270b8353eb45d9#file-openapi-generator-php-client-multipart-json

Command line used for generation

java -jar openapi-generator-cli-4.2.3.jar generate -i apitestminimal.json -g php -o apitestdir

Steps to reproduce

Generate the php client api send a request and check the request on the server side. It wont be a multipart/form-data request.

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/pull/3750

Suggest a fix

If the parameter is not a file, it might still be a multipart-form-data message, but it's not set to true? I think, this is the spot to look at: https://github.com/OpenAPITools/openapi-generator/blob/3588990a4f9f7e7d3e3ae8e2dda59206f57bf676/modules/openapi-generator/src/main/resources/php/api.mustache#L533-L541

Assignee
Assign to
Time tracking