swagger-api / swagger-api/swagger-codegen

[SWIFT4] POST payload being sent as Base64Encoded data (under "jsonData") instead of normal JSON

Open
#8,709 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

For some reason, the generated SWIFT4 code is sending our POST payload as a single-key dictionary like:
[ "jsonData": "base64EncodedString"]

instead of a [String:Any] payload
our server (GCP Endpoints) does not like it and I don't understand why it's happening

Swagger-codegen version
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-project</artifactId>
<packaging>pom</packaging>
<name>swagger-codegen-project</name>
<version>2.4.0-SNAPSHOT</version>
Command line used for generation

java -jar /Users/dgaedcke/dev/swagger-codegen/swagger-codegen-cli.jar generate -c apigen_config.json -l swift4 -i /Users/dgaedcke/dev/tsSwagger/tstone1_0_1openapi.json -o /Users/dgaedcke/Downloads/TsApiBackend

apigen_config is:
{
"responseAs": "PromiseKit",
"projectName": "TsApi"
}

Steps to reproduce

I'm mostly asking a question here ... is this something we're doing wrong or some config-parameter we're missing here?

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 reproducing the swift4 generation command with apigen_config.json and the referenced OpenAPI input, then inspect the generated client in the output directory for the POST request body. Compare the generated jsonData payload with the reported [String:Any] expectation; done means the cause and required generator change are identified and verified against the reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.