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] [Rust] Text/plain response interpreted as json, causing error #20617

Open
5 of 6 tasks
gabriel-v opened this issue Feb 8, 2025 · 0 comments
Open
5 of 6 tasks

[BUG] [Rust] Text/plain response interpreted as json, causing error #20617

gabriel-v opened this issue Feb 8, 2025 · 0 comments

Comments

@gabriel-v
Copy link

gabriel-v commented Feb 8, 2025

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Generated code attempts to use JSON to read a text/plain string response.

openapi-generator version

Used docker latest version

REPOSITORY                                          TAG                            IMAGE ID       CREATED         SIZE
openapitools/openapi-generator-cli                  latest                         ec2c9381a2be   2 days ago      303MB
OpenAPI declaration file content or url

https://github.com/SeekStorm/SeekStorm/blob/42810560e4cbb22a6ad59cfd31c65c837e5a223e/src/seekstorm_server/openapi/openapi.yml#L110-L112

Generation Details

https://github.com/liquidinvestigations/hoover3/blob/bea9f7ba9a297ed8845dea2650ce254d67fdb6ff/packages/seekstorm-client/generate.sh

Results in this function

https://github.com/liquidinvestigations/hoover3/blob/bea9f7ba9a297ed8845dea2650ce254d67fdb6ff/packages/seekstorm-client/src/apis/api_key_api.rs#L67

The function attemps to do serde_json::from_str(&content).map_err(Error::from) on a response marked text/plain, which causes crash (since the json expects to see a quote surrounded string, not a plain string)

Expected output: return Ok(content.to_string()) instead of attempting json parse of text/plain response

Steps to reproduce
Related issues/PRs

Nothing about text/plain vs. json confusion

Suggest a fix
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

1 participant