swagger-api / swagger-api/swagger-codegen

[JAVA] type=string format=byte not serialised correctly in header

Open
#9,412 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

I have a byte[] (type=string format=byte) as header parameter. For creating (the header of) the request for calling the operation ApiClient.parameterToString(Object) will be used. While this uses JSON for handling date types, it uses Object.toString() for all other types including byte[]. With the changes of #4824 the byte[] should be serialised properly when delegating to JSON instead of calling Object.toString().

Swagger-codegen version

swagger-codegen-cli-3.0.8

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs

#4824

Suggest a fix/enhancement

Apply the special treatment of byte[] introduced with #4824 also to ApiClient.parameterToString(Object). And fix this in all relevant files of the template ApiClient.mustache (see #9411).

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 with ApiClient.parameterToString(Object) and the ApiClient.mustache templates referenced in the issue. Compare their byte[] handling with the special treatment introduced by #4824, and review #9411 for related template files. Done means byte[] header parameters are serialized correctly across all relevant templates.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
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.