Uploaded image for project: 'Talend API Design and Testing'
  1. Talend API Design and Testing
  2. ADT-54

Default values for date and datetime types are lost when exporting to Swagger 2 or OAS3

Apply templateInsert Lucidchart Diagram
    XMLWordPrintable

Details

      • Import the Rwadef inlined in the ticket description into the designer
      • Export Swagger 2
      • default value for date and datetime should be present
    • All
    • Small

    Description

      When I export to Swagger 2 a definition with data type containing date and datetime properties, their default value is lost. 

       

      Example of Rwadef to reproduce the issue

      ---
      specVersion: "3.0.2"
      info:
        name: "qwert"
        version: "1.0.0"
        description: "No description"
      contract:
        mediaTypes:
        - "application/json"
        unsortedElementOrder:
        - "#/types/datatype"
        types:
          datatype:
            type: "object"
            properties:
              date:
                type: "date"
                default: "def"
              datetime:
                type: "datetime"
                default: "2016-02-28T16:41:41.090Z"
              string:
                type: "string"
                default: "def"
       

       

      Exported Swagger (dafault is missing for date and datetime)

      ---
      swagger: "2.0"
      info:
        description: "No description"
        version: "1.0.0"
        title: "qwert"
      consumes:
      - "application/json"
      produces:
      - "application/json"
      paths: {}
      definitions:
        datatype:
          type: "object"
          properties:
            date:
              type: "string"
              format: "date"
            datetime:
              type: "string"
              format: "date-time"
            string:
              type: "string"
              default: "def"

      Attachments

        Activity

          People

            Unassigned Unassigned
            gblondeau Guillaume Blondeau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: