Skip to content

Swift client produces wrong JSON data for date-time format #1616

@nkreipke

Description

@nkreipke

In this small example, the TestObject.datetime property is defined to have the "date-time" format. When converting to JSON, the generated Swift client converts it as if it was a "date".

swagger: '2.0'
info:
  title: Test
  version: 1.0.0
produces:
  - application/json
paths:
  /test:
    put:
      parameters:
        - name: testObject
          in: body
          required: true
          schema:
            $ref: '#/definitions/TestObject'
      responses:
        '200':
          description: OK
definitions:
  TestObject:
    type: object
    properties:
      datetime:
        type: string
        format: date-time
        description: Date Time

Resulting JSON string:

{datetime: "2015-11-25"}

Expected:

{datetime: "2015-11-25T12:00:00Z"}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions