[BUG] [typescript-fetch] JSON Strings include quotes in response
Created by: vkhougaz-sonatype
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
I have an API that returns JSON encoded strings, similar to
"API Result Information"
INCLUDING the quotes.
openapi-generator version
Usually 5.1.0
, also reproduced on
OpenAPI declaration file content or url
https://github.com/vkhougaz-sonatype/openapi-bug/blob/master/swagger.yaml
swagger: "2.0"
info:
version: v1
title: Our API
description: The REST API for interacting with Our API
host: localhost:1234
schemes:
- http
paths:
"/api/job/{jobid}/status":
get:
summary: getJobStatus
description: Get the current status for a job.
operationId: getJobStatus
produces:
- application/json;charset=utf-8
parameters:
- required: true
in: path
name: jobid
type: string
responses:
"200":
schema:
$ref: "#/definitions/JobStatus"
description: ""
"404":
description: "`jobid` not found"
definitions:
JobStatus:
type: string
Generation Details
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate -i /local/swagger.yaml -g typescript-fetch -o /local/out
Steps to reproduce
- Install demo repo
git clone https://github.com/vkhougaz-sonatype/openapi-bug
cd openapi-bug
# node >v10
npm install
./build-and-serve.sh
- open browser to http://localhost:1234
- See status
Got `"ok"` expected `ok`
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/3709 https://github.com/OpenAPITools/openapi-generator/pull/4028
Suggest a fix
Update api code to not use simple response for "string" type?