OpenAPITools / OpenAPITools/openapi-generator

[BUG][SWIFT] Cannot upload file

Open
#14,268 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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?
Description

I'm using the latest OpenAPI Generator Version to generate swift5 for our project. I was really happy to see, there is an option to also file upload. So I tried the petstore.yml version 3.

to play around with that.
The generated Swift code accept a URL instead Data for the file as type.
How can I deal with that or isn't it fully supported at the moment?
Actually I'm building the request by myself.

image
openapi-generator version

Latest master.

OpenAPI declaration file content or url

My config.json

{
    "projectName": "MyAPIClient",
    "responseAs": "AsyncAwait",
    "library": "urlsession",
    "removeMigrationProjectNameClass": true
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by generating the Swift5 client with the provided petstore.yml uploadFile operation and the urlsession library using config.json. Inspect how the generated Swift request represents the application/octet-stream file parameter. Done means file uploads accept the expected input and the generated client sends the request successfully, with coverage for this operation.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, swift
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.