Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #9364
Closed
Open
Issue created Apr 28, 2021 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[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
  1. Install demo repo
git clone https://github.com/vkhougaz-sonatype/openapi-bug
cd openapi-bug
# node >v10
npm install
./build-and-serve.sh
  1. open browser to http://localhost:1234
  2. 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?

Assignee
Assign to
Time tracking