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

Commit

Permalink
Issue32 (#34)
Browse files Browse the repository at this point in the history
* closes #32

* add tests
  • Loading branch information
Gaston Lodieu authored and Marc MacLeod committed Oct 7, 2016
1 parent 3b2d67b commit 91d6a18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 95 deletions.
9 changes: 6 additions & 3 deletions lib/exporters/baseraml.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ RAML.prototype.convertRefFromModel = function(object) {
object[id] = {
type: 'string'
};
}
if (val.format == 'date') {
} else if (val.format == 'date') {
object[id] = {
type: 'date-only'
};
Expand All @@ -378,7 +377,11 @@ RAML.prototype.convertRefFromModel = function(object) {
type: 'datetime',
format: 'rfc3339'
};
}
} else { //remove invalid format.
if (ramlHelper.getValidFormat.indexOf(val.format) < 0) {
delete object[id].format;
}
}
} else {
object[id] = this.convertRefFromModel(val);
}
Expand Down
2 changes: 2 additions & 0 deletions lib/helpers/raml.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ var _ = require('lodash');
module.exports = {

getScalarTypes: ['string', 'number', 'integer', 'boolean', 'date', 'datetime', 'date-only', 'file', 'array', 'nilValue'],

getValidFormat: [ 'byte', 'binary', 'password', 'date', 'date-time' ],

parameterMappings: {},

Expand Down
Loading

0 comments on commit 91d6a18

Please sign in to comment.