Skip to content

Commit 442b82d

Browse files
committed
Add error messages
1 parent c01a838 commit 442b82d

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/nodegen.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ function swagger2node(data, options) {
299299
}
300300
});
301301

302+
if (swagger.swagger !== '2.0') {
303+
reject('unsupported version of OpenAPI document');
304+
return;
305+
}
306+
307+
if (!swagger.info.title) {
308+
reject('No title is specified in OpenAPI document');
309+
return;
310+
}
311+
302312
var className = swagger.info.title.toLowerCase().replace(/(^|[^a-z0-9]+)[a-z0-9]/g,
303313
function (str) {
304314
return str.replace(/^[^a-z0-9]+/, '').toUpperCase();
@@ -310,7 +320,7 @@ function swagger2node(data, options) {
310320

311321
if (data.module) {
312322
if (data.prefix) {
313-
reject('error: module name and prefix are conflicted.');
323+
reject('module name and prefix are conflicted.');
314324
return;
315325
}
316326
} else {
@@ -603,7 +613,7 @@ function wottd2node(data, options) {
603613

604614
if (data.module) {
605615
if (data.prefix) {
606-
reject('error: module name and prefix are conflicted');
616+
reject('module name and prefix are conflicted');
607617
return;
608618
}
609619
} else {

0 commit comments

Comments
 (0)