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
  • #2092
Closed
Open
Issue created Feb 07, 2019 by Administrator@rootContributor

[BUG] Parameter example strings rendered without quotes in docs

Created by: timbedard

Description

For several generators (tested Python, Java, and JavaScript), parameter example strings are rendered without quotes for example code in docs, resulting in invalid example code. It's worth noting that values for the default property of parameters are rendered correctly.

openapi-generator version

4.0.0

OpenAPI declaration file content or url
openapi: "3.0.0"
info:
  version: 1.0.0
  title: Status Check API
paths:
  /check/{target}:
    get:
      summary: Check Pass/Fail Status
      operationId: checkStatus
      parameters:
      - name: target
        in: path
        description: target whose status will be checked
        required: true
        schema:
          type: string
        example: potato  # or 'potato'
      responses:
        default:
          description: Status
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Status"

components:
  schemas:
    Status:
      type: object
      required:
        - pass
      properties:
        pass:
          type: boolean
        description:
          type: string
          example: 'out to pasture'
Command line used for generation

openapi-generator generate --i openapi.yaml --g python

Steps to reproduce
  1. Create a declaration that includes a path with a string parameter that has an example and no default.
  2. Run the above command and look at the API docs. The example code will not wrap the example value in quotes.
Suggest a fix

I can't seem to figure out what's causing it, so I'm not sure what to suggest.

Assignee
Assign to
Time tracking