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
  • #2118
Closed
Open
Issue created Feb 11, 2019 by Administrator@rootContributor4 of 4 checklist items completed4/4 checklist items

[BUG][Python] file upload seems broken

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? latest master
  • Have you search for related issues/PRs?
Description

When using a multipart/form-data request body like the example in the spec

requestBody:
  content:
    multipart/form-data:
      schema:
        properties:
                # The property name 'file' will be used for all files.
          file:
            type: array
            items:
              type: string
              format: binary

the ApiClient tries to 'sanitize_for_serializationthe(fileName, fileContent, fileMIME)` tuple that is describing the file data, so we get a string with that tuple, instead of the actual tuple, being sent to urllib3, and the API doesn't identify the content of the file correctly (it believes the serialized tuple is the content of the file...)

Suggest a fix

I seem to be able to upload a file or multiple files by adding the files tuples after the 'sanitization', but I need more testing before a PR can be sent

Assignee
Assign to
Time tracking