OpenAPITools / OpenAPITools/openapi-generator

[BUG][Openapi-yaml] Single quotes are deleted in examples

Open
#4,365 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

I use the generator openapi-yaml for merge serveral yaml files into one. The bug is that the generator remove de simple quotes in examples.

openapi-generator version

4.1.3, 4.2.0

OpenAPI declaration file content or url

Simplified input file:

openapi: 3.0.1
info:
  title: ping test
  version: '1.0'
servers:
  - url: 'http://localhost:8000/'
paths:
  /search:
    get:
      operationId: search
      parameters:
        - name: date
          in: query
          description: The date of the document.
          example: '2019-08-06T13:40:43.449Z'
          required: true
          schema:
            type: string
            format: date-time
      responses:
        '201':
          description: OK
Command line used for generation

java -jar openapi-generator-cli.jar generate -g openapi-yaml -i openapi.yml

Steps to reproduce

Run the above command
Expected output:

...
     parameters:
        - name: date
          in: query
          description: The date of the document.
          example: '2019-08-06T13:40:43.449Z'
...

Actual output:

...
     parameters:
        - name: date
          in: query
          description: The date of the document.
          example: 2019-08-06T13:40:43.449Z
...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the openapi-yaml generator using the provided OpenAPI declaration and the Java command shown. Compare the generated YAML with the expected output, focusing on the quoted date-time example. Done means generation preserves the single quotes around that example.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, yaml
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.