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
  • #14987
Closed
Open
Issue created Mar 17, 2023 by Shon Feder@shonfeder5 of 6 checklist items completed5/6 checklist items

[BUG][OCaml] Construction of multipart/form-data is incorrect

Hi and many thanks to all maintainers and workers on the OpenAPI initiative! This is a great effort :)

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The template for OCaml client generation does not construct multipart/form-data correctly. The incorect logic can be seen

https://github.com/OpenAPITools/openapi-generator/blob/c6a4947523dd079492d3604d45e451a31f5e94a7/modules/openapi-generator/src/main/resources/ocaml/support.mustache#L83-L97

It looks like it is instead producing x-www-form-urlencoded data, but this still ends up being supplied as the body for POST requests specified as taking form-data.

openapi-generator version

Visible on head.

OpenAPI declaration file content or url

Any spec with something like

      requestBody:
        required: true
        content:
          multipart/form-data:

should produce a broken client, but you can see the incorrect logic from the source code.

Related issues/PRs
Suggest a fix

I have hit too many bugs in the generated OCaml library for me to have time to report them all. Other errors included incorret deserialization logid for data including the object keyword and syntactically incorrect datatypes for endpoints taking no data.

I appologize for not having time to report all the details.

I recommend updating the tables on the OCaml client generation to mark it as unstable, and remove the claim to support multipart forms.

I am experimenting with a fix, but not thru the handlebars approach, which looks too brittle IMO. I'll update here if I produce anything that will be of general interest.

Assignee
Assign to
Time tracking