Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks
gnl42 opened this issue Aug 9, 2023 · 3 comments

Comments

@gnl42
Copy link

gnl42 commented Aug 9, 2023

  • 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

@wing328
Copy link
Member

wing328 commented Aug 9, 2023

Can you please file a PR with the suggested fix?

@gnl42
Copy link
Author

gnl42 commented Aug 13, 2023

Working on it.

One question, what is the java.util.Scanner s = new java.util.Scanner(localVarResponse.body()).useDelimiter("\\A"); all about?
From what I can tell it just matches the whole string, Why not just use localVarResponse.body()?

@wing328
Copy link
Member

wing328 commented Aug 15, 2023

if i remember correctly body is a stream and that's why we need that to convert the stream into a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants