OpenAPITools / OpenAPITools/openapi-generator

[BUG] [JAVA] [NATIVE] api.moustache asyncNative is missing vendorExtensions.x-java-text-plain-string code

Open
#16,287 3 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

  • Have you provided a full/minimal spec to reproduce the issue?
  "paths" : {
    "/" : {
      "get" : {
        "tags" : [ "download" ],
        "operationId" : "getFile",
        "responses" : {
          "200" : {
            "description" : "OK",
            "content" : {
              "text/plain" : {
                "schema" : {
                  "type" : "string"
                }
              }
            }
          }
        }
      }
    }

  • Have you tested with the latest master to confirm the issue still exists?
    Fails against 7.0.0-beta
  • What's the actual output vs expected output?
    Code tries to parse string as a json object
Description

Trying to return a file but the result kept being parsed as a json response.
Discovered I needed to use <asyncNative>false</asyncNative> in order for vendorExtensions.x-java-text-plain-string
to work

openapi-generator version

7.0.0-beta

Steps to reproduce

Run with "nativeAsync" option

Related issues/PRs

Result of #14132

Suggest a fix

Replicate non-async code section in async secion

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 in the api.moustache template and compare the nativeAsync section with the non-async section that handles vendorExtensions.x-java-text-plain-string. Reproduce the provided text/plain response with the nativeAsync option and verify that generated code no longer parses the string as a JSON object.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.