OpenAPITools / OpenAPITools/openapi-generator

[BUG][Java][native] Client - wrong Content-Type, double-quoted payload

Open
#3,712 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Java 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?
    https://github.com/cjc343/wrapped-string

  • Have you validated the input using an OpenAPI validator (example)?

  • What's the version of OpenAPI Generator used?
    4.1.0

  • Have you search for related issues/PRs?
    Possibly: #3672

  • What's the actual output vs expected output?
    Given a payload of test, the body generated by the client:
    Actual: "test"
    Expected: test

    Given a content definition of text/csv, the Content-Type header:
    Actual: application/json
    Expected: text/csv

Description
  • Content-Type header does not match API definition
  • Payload is malformed
openapi-generator version

4.1.0, not a regression, first version to support java 11 native client

OpenAPI declaration file content or url

https://github.com/cjc343/wrapped-string/blob/master/src/main/resources/api.yml

Command line used for generation

mvn package

Steps to reproduce
  • Run the tests in the sample project
Related issues/PRs

Possibly: #3672

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 the sample project's API declaration at src/main/resources/api.yml and run its tests with mvn package. Compare the generated Java native client's request body and Content-Type for the test payload and text/csv definition with the expected values. Done means the sample tests show an unquoted payload and the declared Content-Type.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.