src/dt2js.js
function convertDateType (data) {
  switch (data.type) {
    case 'date-only':
      data['type'] = 'string'
      data['pattern'] = constants.dateOnlyPattern
      break
    case 'time-only':
      data['type'] = 'string'
      data['pattern'] = constants.timeOnlyPattern
      break
    case 'datetime-only':
      data['type'] = 'string'
      data['pattern'] = constants.dateTimeOnlyPattern
      break
    case 'datetime':
      data['type'] = 'string'
      if (data.format === undefined || data.format.toLowerCase() === constants.RFC3339) {
        data['pattern'] = constants.RFC3339DatetimePattern
      } else if (data.format.toLowerCase() === constants.RFC2616) {
        data['pattern'] = constants.RFC2616DatetimePattern
      }
      delete data.format
      break
  }
  return data
}
function convertDateType (data) {
  switch (data.type) {
    case 'date-only':
      data['type'] = 'string'
      data['pattern'] = constants.dateOnlyPattern
      break
    case 'time-only':
      data['type'] = 'string'
      data['pattern'] = constants.timeOnlyPattern
      break
    case 'datetime-only':
      data['type'] = 'string'
      data['pattern'] = constants.dateTimeOnlyPattern
      break
    case 'datetime':
      data['type'] = 'string'
      if (data.format === undefined || data.format.toLowerCase() === constants.RFC3339) {
        data['pattern'] = constants.RFC3339DatetimePattern
      } else if (data.format.toLowerCase() === constants.RFC2616) {
        data['pattern'] = constants.RFC2616DatetimePattern
      }
      delete data.format
      break
  }
  return data
}
function convertDateType ( data ) { switch ( data . type ) { case 'date-only' : data [ 'type' ] = 'string' data [ 'pattern' ] = constants . dateOnlyPattern break case 'time-only' : data [ 'type' ] = 'string' data [ 'pattern' ] = constants . timeOnlyPattern break case 'datetime-only' : data [ 'type' ] = 'string' data [ 'pattern' ] = constants . dateTimeOnlyPattern break case 'datetime' : data [ 'type' ] = 'string' if ( data . format === undefined || data . format . toLowerCase ( ) === constants . RFC3339 ) { data [ 'pattern' ] = constants . RFC3339DatetimePattern } else if ( data . format . toLowerCase ( ) === constants . RFC2616 ) { data [ 'pattern' ] = constants . RFC2616DatetimePattern } delete data . format break } return data }
Change RAML date type of data to valid JSON schema type.

@param  {Object} data
@returns  {Object}
Change RAML date type of data to valid JSON schema type .