Skip to content

Commit 3ca894d

Browse files
committed
[DCS] Adds a warning if version param is unset
If the "version" query parameter is not specified by the user, a default value of yesterday's date will be used. In this case, we want to warn the user that their API calls may fail if the service introduces API-breaking changes.
1 parent 49421df commit 3ca894d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

services/document_conversion/v1-experimental.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ function DocumentConversion(options) {
2929
qs: { version: moment.utc().subtract(1, 'd').format('YYYY-MM-DD') }
3030
};
3131

32+
// Warn if not specifying version date
33+
if(!options || !options.qs || !options.qs.version) {
34+
console.warn("[DocumentConversion] WARNING: Not specifying a version query parameter may result in code instability. " +
35+
"e.g. watson.document_conversion({ qs: { version: '2015-12-01' } })")
36+
}
37+
3238
// Replace default options with user provided
3339
this._options = extend(serviceDefaults, options);
3440
}

0 commit comments

Comments
 (0)