Skip to content
This repository was archived by the owner on Mar 15, 2019. It is now read-only.

Commit 91d6a18

Browse files
Gaston LodieuMarc MacLeod
authored andcommitted
Issue32 (#34)
* closes #32 * add tests
1 parent 3b2d67b commit 91d6a18

File tree

3 files changed

+8
-95
lines changed

3 files changed

+8
-95
lines changed

lib/exporters/baseraml.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,7 @@ RAML.prototype.convertRefFromModel = function(object) {
368368
object[id] = {
369369
type: 'string'
370370
};
371-
}
372-
if (val.format == 'date') {
371+
} else if (val.format == 'date') {
373372
object[id] = {
374373
type: 'date-only'
375374
};
@@ -378,7 +377,11 @@ RAML.prototype.convertRefFromModel = function(object) {
378377
type: 'datetime',
379378
format: 'rfc3339'
380379
};
381-
}
380+
} else { //remove invalid format.
381+
if (ramlHelper.getValidFormat.indexOf(val.format) < 0) {
382+
delete object[id].format;
383+
}
384+
}
382385
} else {
383386
object[id] = this.convertRefFromModel(val);
384387
}

lib/helpers/raml.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ var _ = require('lodash');
33
module.exports = {
44

55
getScalarTypes: ['string', 'number', 'integer', 'boolean', 'date', 'datetime', 'date-only', 'file', 'array', 'nilValue'],
6+
7+
getValidFormat: [ 'byte', 'binary', 'password', 'date', 'date-time' ],
68

79
parameterMappings: {},
810

0 commit comments

Comments
 (0)