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
  • #5218
Closed
Open
Issue created Feb 05, 2020 by Administrator@rootContributor

[REQ] Honor MIME types specified in body Content-Type header

Created by: dmcguire81

Is your feature request related to a problem? Please describe.

Several of the generators we've used (rust, typescript-axios, swift5) forcefully serialize and deserialize request/response bodies to JSON irrespective of the setting of the Content-Type header. For example, see this needsSerialization declaration, which serializes to JSON any body argument that is not a string, when the underlying library, axios, will happily handle native types that correspond to useful MIME types like image/*, etc.

This leaves me in a bind as an API designer: either use correct MIME types that tools like cURL and Postman handle well and forego meaningful code generation, or forego external, code-agnostic testing and diagnostic tools, and get code that works on shallow application/json-based objects that have MIME-types embedded in them.

Describe the solution you'd like

I'd like to be able to use native MIME types where appropriate and useful.

Describe alternatives you've considered

Modeling media as shallow objects that will encode to application/json, just for the purposes of code-generation.

Additional context

Really, this is a philosophical question about how the owners see this tool being used. Should I file defects when I encode MIME types and they are not respected, as detailed above? Should I just make peace with the trade-offs, as described, and choose as best I can?

Assignee
Assign to
Time tracking