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

[R] strings are unquoted in JSON encoding #8611

Open
calbach opened this issue Aug 21, 2018 · 1 comment
Open

[R] strings are unquoted in JSON encoding #8611

calbach opened this issue Aug 21, 2018 · 1 comment

Comments

@calbach
Copy link

calbach commented Aug 21, 2018

Description

toJSONString() produces invalid JSON when containing string values.

Swagger-codegen version

swagger-codegen-cli-2.4.0-20180821.200234-311

Swagger declaration file content or url
swagger: "2.0"
info:
  description: ""
  title: "repro"
  version: "1"
paths:
  /pet:
    post:
      tags:
      - "pet"
      summary: "Add a new pet to the store"
      description: ""
      operationId: "addPet"
      parameters:
      - in: "body"
        name: "body"
        description: "Pet object that needs to be added to the store"
        required: true
        schema:
          $ref: "#/definitions/Pet"
      responses:
        200:
          description: ""
definitions:
  Pet:
    type: "object"
    properties:
      foo:
        type: string
Command line used for generation

java -jar swagger-codegen-cli-2.4.0-20180821.200234-311.jar generate --lang r -i swagger.yaml

Steps to reproduce
$ R
> library(devtools); install("."); library(swagger)
> Pet$new(foo="bar")$toJSONString()
[1] "{\n           \"foo\": bar\n        }"
Related issues/PRs

#8610

Suggest a fix/enhancement

Quote string values.

@calbach
Copy link
Author

calbach commented Aug 27, 2018

Expected output (ignoring whitespace): "{\"foo\": \"bar\"}"

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

No branches or pull requests

1 participant