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

swagger2openapi: timestamp events get converted to YAML timestamps #500

Open
2 tasks done
delthas opened this issue Oct 12, 2021 · 0 comments
Open
2 tasks done

swagger2openapi: timestamp events get converted to YAML timestamps #500

delthas opened this issue Oct 12, 2021 · 0 comments

Comments

@delthas
Copy link

delthas commented Oct 12, 2021

swagger2openapi: timestamp events get converted to YAML timestamps

  • The Swagger code example: "2020-06-11T13:55:24Z"
  • gets converted to: example: 2020-06-11T13:55:24Z
  • whereas it should be example: "2020-06-11T13:55:24Z"

Checklist

  • Conversion: I have checked my source definition is valid OpenAPI 2.0
  • Conversion: On valid OpenAPI 2.0 input, the conversion looks wrong

Detailed Description

swagger: "2.0"
info:
  title: foo
  version: 0.0.1
paths:
  /events:
    get:
      responses:
        "200":
          description: "foo"
          schema:
            $ref: '#/definitions/Foo'
definitions:
  Foo:
    properties:
      foo:
        example: "2020-06-11T13:55:24Z"
        type: string

gets rendered with npx [email protected] swagger.yaml -f -o openapi.yaml as:

openapi: 3.0.0
info:
  title: foo
  version: 0.0.1
paths:
  /events:
    get:
      responses:
        "200":
          description: foo
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/Foo"
components:
  schemas:
    Foo:
      properties:
        foo:
          example: 2020-06-11T13:55:24Z
          type: string

The example value is a YAML timestamp object, not a string. Editors will then fail to parse this example correctly. The Swagger Editor for example, shows OrderedMap for the example value, instead of the string.

Expected behaviour: escape string values so that they stay strings.

Other stuff

[email protected]

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