Repository: postmanlabs/postman-code-generators
Pull request #24 (2019-06-11 10:08:01)

Added support  to use option defaults when not submitted by users
Implemented a check in every codegen to use option's default value if it isn't submitted by user, thus getOptions works as source of truth for defaults


Patch:
diff --git a/codegens/csharp-restsharp/lib/restsharp.js b/codegens/csharp-restsharp/lib/restsharp.js
index 694d3ab..c12f670 100644
--- a/codegens/csharp-restsharp/lib/restsharp.js
+++ b/codegens/csharp-restsharp/lib/restsharp.js
@@ -1,7 +1,9 @@
 var _ = require('./lodash'),
 
     parseRequest = require('./parseRequest'),
-    sanitize = require('./util').sanitize;
+    sanitize = require('./util').sanitize,
+    sanitizeOptions = require('./util').sanitizeOptions,
+    self;
 
 /**
  * Generates snippet in csharp-restsharp by parsing data from Postman-SDK request object
@@ -40,7 +42,7 @@ function makeSnippet (request, options) {
     return snippet;
 }
 
-module.exports = {
+self = module.exports = {
     /**
      * Used in order to get additional options for generation of C# code snippet (i.e. Include Boilerplate code)
      *
@@ -60,7 +62,7 @@ module.exports = {
             {
                 name: 'Indent count',
                 id: 'indentCount',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 2,
                 description: 'Number of indentation characters to add per code level'
             },
@@ -75,7 +77,7 @@ module.exports = {
             {
                 name: 'Request timeout',
                 id: 'requestTimeout',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 0,
                 description: 'How long the request should wait for a response before timing out (milliseconds)'
             },
@@ -130,8 +132,10 @@ module.exports = {
             //  snippet to create request in csharp-restsharp
             snippet = '';
 
+        options = sanitizeOptions(options, self.getOptions());
+
         indentString = options.indentType === 'tab' ? '\t' : ' ';
-        indentString = indentString.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+        indentString = indentString.repeat(options.indentCount);
 
         if (options.includeBoilerplate) {
             headerSnippet = 'using System;\n' +
diff --git a/codegens/csharp-restsharp/lib/util.js b/codegens/csharp-restsharp/lib/util.js
index ecc5fe8..e306797 100644
--- a/codegens/csharp-restsharp/lib/util.js
+++ b/codegens/csharp-restsharp/lib/util.js
@@ -1,6 +1,6 @@
 /**
  * sanitizes input string by handling escape characters eg: converts '''' to '\'\'' and trim input if required
- * 
+ *
  * @param {String} inputString - Input String to sanitize
  * @param {Boolean} [trim] - Indicates whether to trim string or not
  * @returns {String} Sanitized String handling escape characters
@@ -8,12 +8,80 @@
 function sanitize (inputString, trim) {
     /* istanbul ignore next */
     if (typeof inputString !== 'string') {
-        throw new Error(`Csharp-Restsharp-Converter:function expects input to be string, found ${typeof inputString}`);
+        return '';
     }
     inputString = inputString.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
     return trim ? inputString.trim() : inputString;
 }
 
+/**
+ * sanitizes input options
+ *
+ * @param {Object} options - Options provided by the user
+ * @param {Array} optionsArray - options array received from getOptions function
+ *
+ * @returns {Object} - Sanitized options object
+ */
+function sanitizeOptions (options, optionsArray) {
+    var result = {},
+        defaultOptions = {},
+        id;
+    optionsArray.forEach((option) => {
+        defaultOptions[option.id] = {
+            default: option.default,
+            type: option.type
+        };
+        if (option.type === 'enum') {
+            defaultOptions[option.id].availableOptions = option.availableOptions;
+        }
+    });
+    for (id in options) {
+        if (options.hasOwnProperty(id)) {
+            if (defaultOptions[id] === undefined) {
+                continue;
+            }
+            switch (defaultOptions[id].type) {
+                case 'boolean':
+                    if (typeof options[id] !== 'boolean') {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'positiveInteger':
+                    if (typeof options[id] !== 'number' || options[id] < 0) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'enum':
+                    if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                default:
+                    result[id] = options[id];
+            }
+        }
+    }
+
+    for (id in defaultOptions) {
+        if (defaultOptions.hasOwnProperty(id)) {
+            if (result[id] === undefined) {
+                result[id] = defaultOptions[id].default;
+            }
+        }
+    }
+    return result;
+}
+
 module.exports = {
-    sanitize: sanitize
+    sanitize: sanitize,
+    sanitizeOptions: sanitizeOptions
 };
diff --git a/codegens/curl/lib/index.js b/codegens/curl/lib/index.js
index 67f9fec..f2a571c 100644
--- a/codegens/curl/lib/index.js
+++ b/codegens/curl/lib/index.js
@@ -1,21 +1,24 @@
 var sanitize = require('./util').sanitize,
+    sanitizeOptions = require('./util').sanitizeOptions,
     form = require('./util').form,
-    _ = require('./lodash');
+    _ = require('./lodash'),
+    self;
 
-module.exports = {
+self = module.exports = {
     convert: function (request, options, callback) {
 
         if (!_.isFunction(callback)) {
             throw new Error('Curl-Converter: callback is not valid function');
         }
+        options = sanitizeOptions(options, self.getOptions());
 
         var indent, trim, headersData, body, text, redirect, timeout, multiLine, format, snippet, silent;
-        redirect = options.followRedirect || _.isUndefined(options.followRedirect);
-        timeout = options.requestTimeout ? options.requestTimeout : 0;
-        multiLine = options.multiLine || _.isUndefined(options.multiLine);
-        format = options.longFormat || _.isUndefined(options.longFormat);
-        trim = options.trimRequestBody ? options.trimRequestBody : false;
-        silent = options.silent ? options.silent : false;
+        redirect = options.followRedirect;
+        timeout = options.requestTimeout;
+        multiLine = options.multiLine;
+        format = options.longFormat;
+        trim = options.trimRequestBody;
+        silent = options.silent;
 
         snippet = silent ? `curl ${form('-s', format)}` : 'curl';
         if (redirect) {
@@ -26,7 +29,7 @@ module.exports = {
         }
         if (multiLine) {
             indent = options.indentType === 'tab' ? '\t' : ' ';
-            indent = ' ' + options.lineContinuationCharacter + '\n' + indent.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4)); // eslint-disable-line max-len
+            indent = ' ' + options.lineContinuationCharacter + '\n' + indent.repeat(options.indentCount); // eslint-disable-line max-len
         }
         else {
             indent = ' ';
@@ -113,9 +116,9 @@ module.exports = {
             {
                 name: 'Request timeout',
                 id: 'requestTimeout',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 0,
-                description: 'How long the request should wait for a response before timing out (seconds)'
+                description: 'How long the request should wait for a response before timing out (milliseconds)'
             },
             {
                 name: 'Follow redirect',
diff --git a/codegens/curl/lib/util.js b/codegens/curl/lib/util.js
index 7845c54..061a3be 100644
--- a/codegens/curl/lib/util.js
+++ b/codegens/curl/lib/util.js
@@ -42,5 +42,73 @@ module.exports = {
         else {
             return option;
         }
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/golang/lib/index.js b/codegens/golang/lib/index.js
index b683159..0817541 100644
--- a/codegens/golang/lib/index.js
+++ b/codegens/golang/lib/index.js
@@ -1,6 +1,8 @@
 var _ = require('./lodash'),
     sanitize = require('./util').sanitize,
-    isFile = false;
+    sanitizeOptions = require('./util').sanitizeOptions,
+    isFile = false,
+    self;
 
 /**
  * Parses Raw data to fetch syntax
@@ -122,12 +124,13 @@ function parseHeaders (headers, indent) {
     return headerSnippet;
 }
 
-module.exports = {
+self = module.exports = {
     convert: function (request, options, callback) {
 
         if (!_.isFunction(callback)) {
             throw new Error('GoLang-Converter: callback is not valid function');
         }
+        options = sanitizeOptions(options, self.getOptions());
 
         var codeSnippet, indent, trim, timeout, followRedirect,
             bodySnippet = '',
@@ -135,7 +138,7 @@ module.exports = {
             headerSnippet = '';
 
         indent = options.indentType === 'tab' ? '\t' : ' ';
-        indent = indent.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+        indent = indent.repeat(options.indentCount);
         timeout = options.requestTimeout;
         followRedirect = options.followRedirect;
         trim = options.trimRequestBody;
@@ -207,7 +210,7 @@ module.exports = {
         return [{
             name: 'Indent count',
             id: 'indentCount',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 2,
             description: 'Number of indentation characters to add per code level'
         },
@@ -222,9 +225,9 @@ module.exports = {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
-            description: 'How long the request should wait for a response before timing out (seconds)'
+            description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
         {
             name: 'Follow redirect',
diff --git a/codegens/golang/lib/util.js b/codegens/golang/lib/util.js
index 8d1eeab..21c0e42 100644
--- a/codegens/golang/lib/util.js
+++ b/codegens/golang/lib/util.js
@@ -14,5 +14,73 @@ module.exports = {
         inputString = inputString.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
         return trim ? inputString.trim() : inputString;
 
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/http/lib/code-http-converter.js b/codegens/http/lib/code-http-converter.js
index e84f25e..6e6b1a5 100644
--- a/codegens/http/lib/code-http-converter.js
+++ b/codegens/http/lib/code-http-converter.js
@@ -1,5 +1,22 @@
 let utils = require('./util');
 
+/**
+ * Used in order to get additional options for generation of C# code snippet (i.e. Include Boilerplate code)
+ *
+ * @module getOptions
+ *
+ * @returns {Array} Additional options specific to generation of http code snippet
+ */
+function getOptions () {
+  return [{
+    name: 'Body trim',
+    id: 'trimRequestBody',
+    type: 'boolean',
+    default: true,
+    description: 'Trim request body fields'
+  }];
+}
+
 /**
  * Converts a Postman SDK request to HTTP message
  * 
@@ -11,7 +28,7 @@ let utils = require('./util');
  */
 function convert (request, options, callback) {
   let snippet = '';
-
+  options = utils.sanitizeOptions(options, getOptions());
   snippet = `${request.method} ${utils.getEndPoint(request)} HTTP/1.1\n`;
   snippet += `Host: ${utils.getHost(request)}\n`;
   snippet += `${utils.getHeaders(request)}\n`;
@@ -21,15 +38,6 @@ function convert (request, options, callback) {
 }
 
 module.exports = {
-  getOptions: function () {
-    return [{
-      name: 'Body trim',
-      id: 'trimRequestBody',
-      type: 'boolean',
-      default: true,
-      description: 'Trim request body fields'
-    }];
-  },
-
+  getOptions: getOptions,
   convert: convert
 };
diff --git a/codegens/http/lib/util.js b/codegens/http/lib/util.js
index 8a807a1..5555926 100644
--- a/codegens/http/lib/util.js
+++ b/codegens/http/lib/util.js
@@ -162,9 +162,78 @@ function getBody (request, trimRequestBody) {
   return '';
 }
 
+/**
+ * sanitizes input options
+ *
+ * @param {Object} options - Options provided by the user
+ * @param {Array} optionsArray - options array received from getOptions function
+ *
+ * @returns {Object} - Sanitized options object
+ */
+function sanitizeOptions (options, optionsArray) {
+  var result = {},
+    defaultOptions = {},
+    id;
+  optionsArray.forEach((option) => {
+    defaultOptions[option.id] = {
+      default: option.default,
+      type: option.type
+    };
+    if (option.type === 'enum') {
+      defaultOptions[option.id].availableOptions = option.availableOptions;
+    }
+  });
+
+  for (id in options) {
+    if (options.hasOwnProperty(id)) {
+      if (defaultOptions[id] === undefined) {
+        continue;
+      }
+      switch (defaultOptions[id].type) {
+        case 'boolean':
+          if (typeof options[id] !== 'boolean') {
+            result[id] = defaultOptions[id].default;
+          }
+          else {
+            result[id] = options[id];
+          }
+          break;
+        case 'positiveInteger':
+          if (typeof options[id] !== 'number' || options[id] < 0) {
+            result[id] = defaultOptions[id].default;
+          }
+          else {
+            result[id] = options[id];
+          }
+          break;
+        case 'enum':
+          if (!defaultOptions[id].availableOptions.includes(options[id])) {
+            result[id] = defaultOptions[id].default;
+          }
+          else {
+            result[id] = options[id];
+          }
+          break;
+        default:
+          result[id] = options[id];
+      }
+    }
+  }
+
+  for (id in defaultOptions) {
+    if (defaultOptions.hasOwnProperty(id)) {
+      if (result[id] === undefined) {
+        result[id] = defaultOptions[id].default;
+      }
+    }
+  }
+  return result;
+}
+
 module.exports = {
   getEndPoint: getEndPoint,
   getHost: getHost,
   getHeaders: getHeaders,
-  getBody: getBody
+  getBody: getBody,
+  sanitizeOptions: sanitizeOptions
 };
diff --git a/codegens/java-okhttp/README.md b/codegens/java-okhttp/README.md
index 854074c..84bf37a 100644
--- a/codegens/java-okhttp/README.md
+++ b/codegens/java-okhttp/README.md
@@ -25,7 +25,7 @@ Convert function will take three parameters
 
 * `options`- options is an object which can have following properties
     * `indentType`- string representing type of indentation for code snippet. eg: 'space', 'tab'
-    * `indentCount`- integer representing count of indentation required.
+    * `indentCount`- positiveInteger representing count of indentation required.
     * `includeBoilerplate`- boolean representing whether to include class definition in code snippet 
     * `requestTimeout` : Integer denoting time after which the request will bail out in milli-seconds
     * `trimRequestBody` : Trim request body fields
diff --git a/codegens/java-okhttp/lib/index.js b/codegens/java-okhttp/lib/index.js
index 40dc74d..0b35f72 100644
--- a/codegens/java-okhttp/lib/index.js
+++ b/codegens/java-okhttp/lib/index.js
@@ -1,58 +1,4 @@
 module.exports = {
-    convert: require('./okhttp'),
-
-    /**
-     * Used in order to get options for generation of Java okhattp code snippet (i.e. Include Boilerplate code)
-     *
-     * @module getOptions
-     *
-     * @returns {Array} Options specific to generation of Java okhattp code snippet
-     */
-    getOptions: function () {
-        return [
-            {
-                name: 'Include boilerplate',
-                id: 'includeBoilerplate',
-                type: 'boolean',
-                default: false,
-                description: 'Include class definition and import statements in snippet'
-            },
-            {
-                name: 'Indent count',
-                id: 'indentCount',
-                type: 'integer',
-                default: 2,
-                description: 'Number of indentation characters to add per code level'
-            },
-            {
-                name: 'Indent type',
-                id: 'indentType',
-                type: 'enum',
-                availableOptions: ['tab', 'space'],
-                default: 'space',
-                description: 'Character used for indentation'
-            },
-            {
-                name: 'Request timeout',
-                id: 'requestTimeout',
-                type: 'integer',
-                default: 0,
-                description: 'How long the request should wait for a response before timing out (milliseconds)'
-            },
-            {
-                name: 'Follow redirect',
-                id: 'followRedirect',
-                type: 'boolean',
-                default: true,
-                description: 'Automatically follow HTTP redirects'
-            },
-            {
-                name: 'Body trim',
-                id: 'trimRequestBody',
-                type: 'boolean',
-                default: true,
-                description: 'Trim request body fields'
-            }
-        ];
-    }
+    convert: require('./okhttp').convert,
+    getOptions: require('./okhttp').getOptions
 };
diff --git a/codegens/java-okhttp/lib/okhttp.js b/codegens/java-okhttp/lib/okhttp.js
index dfc28ab..5f181ed 100644
--- a/codegens/java-okhttp/lib/okhttp.js
+++ b/codegens/java-okhttp/lib/okhttp.js
@@ -1,7 +1,8 @@
 var _ = require('./lodash'),
 
     parseRequest = require('./parseRequest'),
-    sanitize = require('./util').sanitize;
+    sanitize = require('./util').sanitize,
+    sanitizeOptions = require('./util').sanitizeOptions;
 
 //  Since Java OkHttp requires to add extralines of code to handle methods with body
 const METHODS_WITHOUT_BODY = ['GET', 'HEAD', 'COPY', 'UNLOCK', 'UNLINK', 'PURGE', 'LINK', 'VIEW'];
@@ -49,6 +50,61 @@ function makeSnippet (request, indentString, options) {
     return snippet;
 }
 
+/**
+ * Used in order to get options for generation of Java okhattp code snippet (i.e. Include Boilerplate code)
+ *
+ * @module getOptions
+ *
+ * @returns {Array} Options specific to generation of Java okhattp code snippet
+ */
+function getOptions () {
+    return [
+        {
+            name: 'Include boilerplate',
+            id: 'includeBoilerplate',
+            type: 'boolean',
+            default: false,
+            description: 'Include class definition and import statements in snippet'
+        },
+        {
+            name: 'Indent count',
+            id: 'indentCount',
+            type: 'positiveInteger',
+            default: 2,
+            description: 'Number of indentation characters to add per code level'
+        },
+        {
+            name: 'Indent type',
+            id: 'indentType',
+            type: 'enum',
+            availableOptions: ['tab', 'space'],
+            default: 'space',
+            description: 'Character used for indentation'
+        },
+        {
+            name: 'Request timeout',
+            id: 'requestTimeout',
+            type: 'positiveInteger',
+            default: 0,
+            description: 'How long the request should wait for a response before timing out (milliseconds)'
+        },
+        {
+            name: 'Follow redirect',
+            id: 'followRedirect',
+            type: 'boolean',
+            default: true,
+            description: 'Automatically follow HTTP redirects'
+        },
+        {
+            name: 'Body trim',
+            id: 'trimRequestBody',
+            type: 'boolean',
+            default: true,
+            description: 'Trim request body fields'
+        }
+    ];
+}
+
 /**
  * Converts Postman sdk request object to java okhttp code snippet
  *
@@ -64,7 +120,7 @@ function makeSnippet (request, indentString, options) {
  * @param {Number} options.requestTimeout : time in milli-seconds after which request will bail out
  * @param {Function} callback - callback function with parameters (error, snippet)
  */
-module.exports = function (request, options, callback) {
+function convert (request, options, callback) {
 
     if (_.isFunction(options)) {
         callback = options;
@@ -73,7 +129,7 @@ module.exports = function (request, options, callback) {
     else if (!_.isFunction(callback)) {
         throw new Error('Java-OkHttp-Converter: callback is not valid function');
     }
-
+    options = sanitizeOptions(options, getOptions());
     //  String representing value of indentation required
     var indentString,
 
@@ -85,7 +141,7 @@ module.exports = function (request, options, callback) {
         snippet = '';
 
     indentString = options.indentType === 'tab' ? '\t' : ' ';
-    indentString = indentString.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+    indentString = indentString.repeat(options.indentCount);
 
     if (options.includeBoilerplate) {
         headerSnippet = 'import java.io.*;\n' +
@@ -103,4 +159,8 @@ module.exports = function (request, options, callback) {
     (snippet = indentString.repeat(2) + snippet.split('\n').join('\n' + indentString.repeat(2)) + '\n');
 
     return callback(null, headerSnippet + snippet + footerSnippet);
+}
+module.exports = {
+    convert: convert,
+    getOptions: getOptions
 };
diff --git a/codegens/java-okhttp/lib/util.js b/codegens/java-okhttp/lib/util.js
index 2ff1d1b..35b0b9c 100644
--- a/codegens/java-okhttp/lib/util.js
+++ b/codegens/java-okhttp/lib/util.js
@@ -2,10 +2,10 @@ module.exports = {
     /**
      * sanitizes input string by handling escape characters eg: converts '''' to '\'\''
      * and trim input if required
-     * 
+     *
      * @param {String} inputString - Input string being sanitized
      * @param {Boolean} [trim] - indicates whether to trim string or not
-     * @returns {String} 
+     * @returns {String}
      */
     sanitize: function (inputString, trim) {
         if (typeof inputString !== 'string') {
@@ -14,5 +14,73 @@ module.exports = {
         inputString = inputString.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
         return trim ? inputString.trim() : inputString;
 
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/java-unirest/README.md b/codegens/java-unirest/README.md
index 72addb4..808207c 100644
--- a/codegens/java-unirest/README.md
+++ b/codegens/java-unirest/README.md
@@ -25,7 +25,7 @@ Convert function will take three parameters
 
 * `options`- options is an object which can have following properties
     * `indentType`- string representing type of indentation for code snippet. eg: 'space', 'tab'
-    * `indentCount`- integer representing count of indentation required.
+    * `indentCount`- positiveInteger representing count of indentation required.
     * `includeBoilerplate`- boolean representing whether to include class definition in code snippet 
     * `requestTimeout` : Integer denoting time after which the request will bail out in milli-seconds
     * `trimRequestBody` : Trim request body fields
diff --git a/codegens/java-unirest/lib/index.js b/codegens/java-unirest/lib/index.js
index 09cd3fe..d712541 100644
--- a/codegens/java-unirest/lib/index.js
+++ b/codegens/java-unirest/lib/index.js
@@ -1,58 +1,5 @@
 
-/**
- * Specifies the additional options applicable to this code generator other than standard options
- *
- * @returns {Array} - Array of the particular options applicable to java unirest
- */
-function getOptions () {
-    return [
-        {
-            name: 'Include boilerplate',
-            id: 'includeBoilerplate',
-            type: 'boolean',
-            default: false,
-            description: 'Include class definition and import statements in snippet'
-        },
-        {
-            name: 'Indent count',
-            id: 'indentCount',
-            type: 'integer',
-            default: 2,
-            description: 'Number of indentation characters to add per code level'
-        },
-        {
-            name: 'Indent type',
-            id: 'indentType',
-            type: 'enum',
-            availableOptions: ['tab', 'space'],
-            default: 'space',
-            description: 'Character used for indentation'
-        },
-        {
-            name: 'Request timeout',
-            id: 'requestTimeout',
-            type: 'integer',
-            default: 0,
-            description: 'How long the request should wait for a response before timing out (milliseconds)'
-        },
-        {
-            name: 'Follow redirect',
-            id: 'followRedirect',
-            type: 'boolean',
-            default: true,
-            description: 'Automatically follow HTTP redirects'
-        },
-        {
-            name: 'Body trim',
-            id: 'trimRequestBody',
-            type: 'boolean',
-            default: true,
-            description: 'Trim request body fields'
-        }
-    ];
-}
-
 module.exports = {
     convert: require('./unirest').convert,
-    getOptions: getOptions
+    getOptions: require('./unirest').getOptions
 };
diff --git a/codegens/java-unirest/lib/unirest.js b/codegens/java-unirest/lib/unirest.js
index 51b2d80..d17cee9 100644
--- a/codegens/java-unirest/lib/unirest.js
+++ b/codegens/java-unirest/lib/unirest.js
@@ -1,4 +1,5 @@
 var _ = require('./lodash'),
+    sanitizeOptions = require('./util').sanitizeOptions,
 
     parseRequest = require('./parseRequest');
 
@@ -47,6 +48,59 @@ function makeSnippet (request, indentString, options) {
     return snippet;
 }
 
+/**
+ * Specifies the additional options applicable to this code generator other than standard options
+ *
+ * @returns {Array} - Array of the particular options applicable to java unirest
+ */
+function getOptions () {
+    return [
+        {
+            name: 'Include boilerplate',
+            id: 'includeBoilerplate',
+            type: 'boolean',
+            default: false,
+            description: 'Include class definition and import statements in snippet'
+        },
+        {
+            name: 'Indent count',
+            id: 'indentCount',
+            type: 'positiveInteger',
+            default: 2,
+            description: 'Number of indentation characters to add per code level'
+        },
+        {
+            name: 'Indent type',
+            id: 'indentType',
+            type: 'enum',
+            availableOptions: ['tab', 'space'],
+            default: 'space',
+            description: 'Character used for indentation'
+        },
+        {
+            name: 'Request timeout',
+            id: 'requestTimeout',
+            type: 'positiveInteger',
+            default: 0,
+            description: 'How long the request should wait for a response before timing out (milliseconds)'
+        },
+        {
+            name: 'Follow redirect',
+            id: 'followRedirect',
+            type: 'boolean',
+            default: true,
+            description: 'Automatically follow HTTP redirects'
+        },
+        {
+            name: 'Body trim',
+            id: 'trimRequestBody',
+            type: 'boolean',
+            default: true,
+            description: 'Trim request body fields'
+        }
+    ];
+}
+
 /**
  * Converts postman sdk request object into http snippet for java unirest
  *
@@ -65,7 +119,7 @@ function convert (request, options, callback) {
     if (!_.isFunction(callback)) {
         throw new Error('Java-Unirest-Converter: callback is not valid function');
     }
-
+    options = sanitizeOptions(options, getOptions());
     //  String representing value of indentation required
     var indentString,
 
@@ -97,5 +151,6 @@ function convert (request, options, callback) {
     return callback(null, headerSnippet + snippet + footerSnippet);
 }
 module.exports = {
-    convert: convert
+    convert: convert,
+    getOptions: getOptions
 };
diff --git a/codegens/java-unirest/lib/util.js b/codegens/java-unirest/lib/util.js
index aa8ef54..46a8f16 100644
--- a/codegens/java-unirest/lib/util.js
+++ b/codegens/java-unirest/lib/util.js
@@ -2,10 +2,10 @@
 /**
  * sanitizes input string by handling escape characters eg: converts '''' to '\'\''
  * and trim input if required
- * 
+ *
  * @param {String} inputString
  * @param {Boolean} [trim] - indicates whether to trim string or not
- * @returns {String} 
+ * @returns {String}
  */
 function sanitize (inputString, trim) {
     if (typeof inputString !== 'string') {
@@ -14,6 +14,75 @@ function sanitize (inputString, trim) {
     (trim) && (inputString = inputString.trim());
     return inputString.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
 }
+
+/**
+ * sanitizes input options
+ *
+ * @param {Object} options - Options provided by the user
+ * @param {Array} optionsArray - options array received from getOptions function
+ *
+ * @returns {Object} - Sanitized options object
+ */
+function sanitizeOptions (options, optionsArray) {
+    var result = {},
+        defaultOptions = {},
+        id;
+    optionsArray.forEach((option) => {
+        defaultOptions[option.id] = {
+            default: option.default,
+            type: option.type
+        };
+        if (option.type === 'enum') {
+            defaultOptions[option.id].availableOptions = option.availableOptions;
+        }
+    });
+
+    for (id in options) {
+        if (options.hasOwnProperty(id)) {
+            if (defaultOptions[id] === undefined) {
+                continue;
+            }
+            switch (defaultOptions[id].type) {
+                case 'boolean':
+                    if (typeof options[id] !== 'boolean') {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'positiveInteger':
+                    if (typeof options[id] !== 'number' || options[id] < 0) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'enum':
+                    if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                default:
+                    result[id] = options[id];
+            }
+        }
+    }
+
+    for (id in defaultOptions) {
+        if (defaultOptions.hasOwnProperty(id)) {
+            if (result[id] === undefined) {
+                result[id] = defaultOptions[id].default;
+            }
+        }
+    }
+    return result;
+}
 module.exports = {
-    sanitize: sanitize
+    sanitize: sanitize,
+    sanitizeOptions: sanitizeOptions
 };
diff --git a/codegens/js-fetch/lib/index.js b/codegens/js-fetch/lib/index.js
index 573a092..472f9c3 100644
--- a/codegens/js-fetch/lib/index.js
+++ b/codegens/js-fetch/lib/index.js
@@ -1,5 +1,6 @@
 var _ = require('./lodash'),
-    sanitize = require('./util').sanitize;
+    sanitize = require('./util').sanitize,
+    sanitizeOptions = require('./util').sanitizeOptions;
 const VALID_BODY_MODES = ['urlencoded', 'raw', 'file', 'formdata'];
 
 /**
@@ -127,7 +128,7 @@ function getOptions () {
         {
             name: 'Indent count',
             id: 'indentCount',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 2,
             description: 'Number of indentation characters to add per code level'
         },
@@ -142,7 +143,7 @@ function getOptions () {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
             description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
@@ -179,6 +180,7 @@ function convert (request, options, callback) {
     if (!_.isFunction(callback)) {
         throw new Error('JS-Fetch Converter callback is not a valid function');
     }
+    options = sanitizeOptions(options, getOptions());
 
     var indent = options.indentType === 'tab' ? '\t' : ' ',
         trim = options.trimRequestBody,
diff --git a/codegens/js-fetch/lib/util.js b/codegens/js-fetch/lib/util.js
index 9193fd1..0982395 100644
--- a/codegens/js-fetch/lib/util.js
+++ b/codegens/js-fetch/lib/util.js
@@ -14,6 +14,75 @@ function sanitize (inputString, trim) {
     return trim ? inputString.trim() : inputString;
 }
 
+/**
+ * sanitizes input options
+ *
+ * @param {Object} options - Options provided by the user
+ * @param {Array} optionsArray - options array received from getOptions function
+ *
+ * @returns {Object} - Sanitized options object
+ */
+function sanitizeOptions (options, optionsArray) {
+    var result = {},
+        defaultOptions = {},
+        id;
+    optionsArray.forEach((option) => {
+        defaultOptions[option.id] = {
+            default: option.default,
+            type: option.type
+        };
+        if (option.type === 'enum') {
+            defaultOptions[option.id].availableOptions = option.availableOptions;
+        }
+    });
+
+    for (id in options) {
+        if (options.hasOwnProperty(id)) {
+            if (defaultOptions[id] === undefined) {
+                continue;
+            }
+            switch (defaultOptions[id].type) {
+                case 'boolean':
+                    if (typeof options[id] !== 'boolean') {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'positiveInteger':
+                    if (typeof options[id] !== 'number' || options[id] < 0) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'enum':
+                    if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                default:
+                    result[id] = options[id];
+            }
+        }
+    }
+
+    for (id in defaultOptions) {
+        if (defaultOptions.hasOwnProperty(id)) {
+            if (result[id] === undefined) {
+                result[id] = defaultOptions[id].default;
+            }
+        }
+    }
+    return result;
+}
+
 module.exports = {
-    sanitize: sanitize
+    sanitize: sanitize,
+    sanitizeOptions: sanitizeOptions
 };
diff --git a/codegens/js-jquery/lib/js-jquery.js b/codegens/js-jquery/lib/js-jquery.js
index be42268..27e1971 100644
--- a/codegens/js-jquery/lib/js-jquery.js
+++ b/codegens/js-jquery/lib/js-jquery.js
@@ -1,6 +1,8 @@
 var _ = require('./lodash'),
     parseBody = require('./util/parseBody'),
-    sanitize = require('./util/sanitize').sanitize;
+    sanitize = require('./util/sanitize').sanitize,
+    sanitizeOptions = require('./util/sanitize').sanitizeOptions,
+    self;
 
 /**
      * Used to parse the request headers
@@ -47,7 +49,7 @@ function createForm (request, trimRequestBody) {
     return form;
 }
 
-module.exports = {
+self = module.exports = {
     /**
      * Used to return options which are specific to a particular plugin
      *
@@ -57,7 +59,7 @@ module.exports = {
         return [{
             name: 'Indent count',
             id: 'indentCount',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 2,
             description: 'Number of indentation characters to add per code level'
         },
@@ -72,7 +74,7 @@ module.exports = {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
             description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
@@ -110,11 +112,10 @@ module.exports = {
         else if (!_.isFunction(callback)) {
             throw new Error('js-jQuery~convert: Callback is not a function');
         }
-
+        options = sanitizeOptions(options, self.getOptions());
         indentType = (options.indentType === 'tab') ? '\t' : ' ';
 
-        indent = indentType.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
-        options.requestTimeout = options.requestTimeout || 0;
+        indent = indentType.repeat(options.indentCount);
 
         if (request.body && request.body.mode === 'formdata') {
             jQueryCode = createForm(request.toJSON(), options.trimRequestBody);
diff --git a/codegens/js-jquery/lib/util/sanitize.js b/codegens/js-jquery/lib/util/sanitize.js
index 6b5ae16..fda224f 100644
--- a/codegens/js-jquery/lib/util/sanitize.js
+++ b/codegens/js-jquery/lib/util/sanitize.js
@@ -30,5 +30,73 @@ module.exports = {
             }
         }
         return inputString;
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/js-xhr/lib/index.js b/codegens/js-xhr/lib/index.js
index 6adc6bf..2373e17 100644
--- a/codegens/js-xhr/lib/index.js
+++ b/codegens/js-xhr/lib/index.js
@@ -1,5 +1,6 @@
 var _ = require('./lodash'),
-    sanitize = require('./util').sanitize;
+    sanitize = require('./util').sanitize,
+    sanitizeOptions = require('./util').sanitizeOptions;
 
 /**
  * Parses URLEncoded body from request
@@ -118,7 +119,7 @@ function getOptions () {
         {
             name: 'Indent count',
             id: 'indentCount',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 2,
             description: 'Number of indentation characters to add per code level'
         },
@@ -133,7 +134,7 @@ function getOptions () {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
             description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
@@ -142,7 +143,7 @@ function getOptions () {
             id: 'trimRequestBody',
             type: 'boolean',
             default: true,
-            description: 'Automatically follow HTTP redirects'
+            description: 'Trim request body fields'
         }
     ];
 }
@@ -162,7 +163,7 @@ function convert (request, options, callback) {
     if (!_.isFunction(callback)) {
         throw new Error('JS-XHR-Converter: callback is not valid function');
     }
-
+    options = sanitizeOptions(options, getOptions());
     var indent, trim, headerSnippet,
         codeSnippet = '',
         bodySnippet = '';
diff --git a/codegens/js-xhr/lib/util.js b/codegens/js-xhr/lib/util.js
index 8d1eeab..21c0e42 100644
--- a/codegens/js-xhr/lib/util.js
+++ b/codegens/js-xhr/lib/util.js
@@ -14,5 +14,73 @@ module.exports = {
         inputString = inputString.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
         return trim ? inputString.trim() : inputString;
 
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/libcurl/lib/index.js b/codegens/libcurl/lib/index.js
index 32dd5c1..89405bd 100644
--- a/codegens/libcurl/lib/index.js
+++ b/codegens/libcurl/lib/index.js
@@ -1,12 +1,15 @@
 var sanitize = require('./util').sanitize,
-  _ = require('./lodash');
+  sanitizeOptions = require('./util').sanitizeOptions,
+  _ = require('./lodash'),
+  self;
 
-module.exports = {
+self = module.exports = {
   convert: function (request, options, callback) {
 
     if (!_.isFunction(callback)) {
       throw new Error('Curl-Converter: callback is not valid function');
     }
+    options = sanitizeOptions(options, self.getOptions());
 
     var indent = '',
       trim, headersData, body, text,
@@ -20,9 +23,9 @@ module.exports = {
       responseCode,
       timeout;
 
-    multiLine = options.multiLine || _.isUndefined(options.multiLine);
-    trim = options.trimRequestBody ? options.trimRequestBody : false;
-    protocol = options.protocol ? options.protocol : 'https';
+    multiLine = options.multiLine;
+    trim = options.trimRequestBody;
+    protocol = options.protocol;
     timeout = options.requestTimeout;
 
     if (multiLine) {
@@ -142,7 +145,7 @@ module.exports = {
         id: 'multiLine',
         type: 'boolean',
         default: true,
-        description: 'Split code across multiple lines'
+        description: 'Split cURL command across multiple lines'
       },
       {
         name: 'Protocol',
@@ -155,7 +158,7 @@ module.exports = {
       {
         name: 'Indent count',
         id: 'indentCount',
-        type: 'integer',
+        type: 'positiveInteger',
         default: 2,
         description: 'Number of indentation characters to add per code level'
       },
@@ -184,7 +187,7 @@ module.exports = {
       {
         name: 'Request timeout',
         id: 'requestTimeout',
-        type: 'integer',
+        type: 'positiveInteger',
         default: 0,
         description: 'How long the request should wait for a response before timing out (milliseconds)'
       }
diff --git a/codegens/libcurl/lib/util.js b/codegens/libcurl/lib/util.js
index e7bf55d..fd0b82a 100644
--- a/codegens/libcurl/lib/util.js
+++ b/codegens/libcurl/lib/util.js
@@ -14,5 +14,75 @@ module.exports = {
     inputString = inputString.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n');
 
     return trim ? inputString.trim() : inputString;
+  },
+
+  /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+  sanitizeOptions: function (options, optionsArray) {
+    var result = {},
+      defaultOptions = {},
+      id;
+
+    optionsArray.forEach((option) => {
+      defaultOptions[option.id] = {
+        default: option.default,
+        type: option.type
+      };
+      if (option.type === 'enum') {
+        defaultOptions[option.id].availableOptions = option.availableOptions;
+      }
+    });
+
+    for (id in options) {
+      if (options.hasOwnProperty(id)) {
+        if (defaultOptions[id] === undefined) {
+          continue;
+        }
+        switch (defaultOptions[id].type) {
+          case 'boolean':
+            if (typeof options[id] !== 'boolean') {
+              result[id] = defaultOptions[id].default;
+            }
+            else {
+              result[id] = options[id];
+            }
+            break;
+          case 'positiveInteger':
+            if (typeof options[id] !== 'number' || options[id] < 0) {
+              result[id] = defaultOptions[id].default;
+            }
+            else {
+              result[id] = options[id];
+            }
+            break;
+          case 'enum':
+            if (!defaultOptions[id].availableOptions.includes(options[id])) {
+              result[id] = defaultOptions[id].default;
+            }
+            else {
+              result[id] = options[id];
+            }
+            break;
+          default:
+            result[id] = options[id];
+        }
+      }
+    }
+
+    for (id in defaultOptions) {
+      if (defaultOptions.hasOwnProperty(id)) {
+        if (result[id] === undefined) {
+          result[id] = defaultOptions[id].default;
+        }
+      }
+    }
+
+    return result;
   }
 };
diff --git a/codegens/nodejs-native/README.md b/codegens/nodejs-native/README.md
index 1aa0e1c..2837b69 100644
--- a/codegens/nodejs-native/README.md
+++ b/codegens/nodejs-native/README.md
@@ -16,7 +16,7 @@ Convert function will take three parameters
 
 * `options`- options is an object which can have following properties
     * `indentType`- string representing type of indentation for code snippet. eg: 'space', 'tab'
-    * `indentCount`- integer representing count of indentation required.
+    * `indentCount`- positiveInteger representing count of indentation required.
     * `requestTimeout` : Integer denoting time after which the request will bail out in milli-seconds
     * `trimRequestBody` : Trim request body fields
     * `followRedirect` : Boolean denoting whether to redirect a request
diff --git a/codegens/nodejs-native/lib/request.js b/codegens/nodejs-native/lib/request.js
index 7bc3d7e..d1e8729 100644
--- a/codegens/nodejs-native/lib/request.js
+++ b/codegens/nodejs-native/lib/request.js
@@ -1,6 +1,8 @@
 const _ = require('./lodash'),
+    sanitizeOptions = require('./util').sanitizeOptions,
 
     parseRequest = require('./parseRequest');
+var self;
 
 /**
  * retuns snippet of nodejs(native) by parsing data from Postman-SDK request object
@@ -113,7 +115,7 @@ function makeSnippet (request, indentString, options) {
  * @param {Number} options.requestTimeout : time in milli-seconds after which request will bail out
  * @param {Function} callback - callback function with parameters (error, snippet)
  */
-module.exports = {
+self = module.exports = {
     /**
      * Used to return options which are specific to a particular plugin
      *
@@ -123,7 +125,7 @@ module.exports = {
         return [{
             name: 'Indent count',
             id: 'indentCount',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 2,
             description: 'Number of indentation characters to add per code level'
         },
@@ -138,7 +140,7 @@ module.exports = {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
             description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
@@ -162,12 +164,13 @@ module.exports = {
         if (!_.isFunction(callback)) {
             throw new Error('NodeJS-Request-Converter: callback is not valid function');
         }
+        options = sanitizeOptions(options, self.getOptions());
 
         //  String representing value of indentation required
         var indentString;
 
         indentString = options.indentType === 'tab' ? '\t' : ' ';
-        indentString = indentString.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+        indentString = indentString.repeat(options.indentCount);
 
         return callback(null, makeSnippet(request, indentString, options));
     }
diff --git a/codegens/nodejs-native/lib/util.js b/codegens/nodejs-native/lib/util.js
index aa3f28d..f1cf9cb 100644
--- a/codegens/nodejs-native/lib/util.js
+++ b/codegens/nodejs-native/lib/util.js
@@ -13,5 +13,73 @@ module.exports = {
         }
         (trim) && (inputString = inputString.trim());
         return inputString.replace(/\\/g, '\\\\').replace(/'/g, '\\\'');
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/nodejs-request/README.md b/codegens/nodejs-request/README.md
index df96a23..aaeeb77 100644
--- a/codegens/nodejs-request/README.md
+++ b/codegens/nodejs-request/README.md
@@ -25,7 +25,7 @@ Convert function will take three parameters
 
 * `options`- options is an object which can have following properties
     * `indentType`- string representing type of indentation for code snippet. eg: 'space', 'tab'
-    * `indentCount`- integer representing count of indentation required.
+    * `indentCount`- positiveInteger representing count of indentation required.
     * `requestTimeout` : Integer denoting time after which the request will bail out in milli-seconds
     * `trimRequestBody` : Trim request body fields
     * `followRedirect` : Boolean denoting whether to redirect a request
diff --git a/codegens/nodejs-request/lib/request.js b/codegens/nodejs-request/lib/request.js
index e4b4651..82d6416 100644
--- a/codegens/nodejs-request/lib/request.js
+++ b/codegens/nodejs-request/lib/request.js
@@ -1,7 +1,8 @@
 var _ = require('./lodash'),
 
     parseRequest = require('./parseRequest'),
-    sanitize = require('./util').sanitize;
+    sanitize = require('./util').sanitize,
+    sanitizeOptions = require('./util').sanitizeOptions;
 
 /**
  * retuns snippet of nodejs(request) by parsing data from Postman-SDK request object
@@ -64,7 +65,7 @@ function getOptions () {
         {
             name: 'Indent count',
             id: 'indentCount',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 2,
             description: 'Number of indentation characters to add per code level'
         },
@@ -79,7 +80,7 @@ function getOptions () {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
             description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
@@ -116,6 +117,7 @@ function convert (request, options, callback) {
     if (!_.isFunction(callback)) {
         throw new Error('NodeJS-Request-Converter: callback is not valid function');
     }
+    options = sanitizeOptions(options, getOptions());
 
     //  String representing value of indentation required
     var indentString;
diff --git a/codegens/nodejs-request/lib/util.js b/codegens/nodejs-request/lib/util.js
index 2a01b1a..0a2949f 100644
--- a/codegens/nodejs-request/lib/util.js
+++ b/codegens/nodejs-request/lib/util.js
@@ -2,10 +2,10 @@
 /**
  * sanitizes input string by handling escape characters eg: converts '''' to '\'\''
  * and trim input if required
- * 
+ *
  * @param {String} inputString
  * @param {Boolean} [trim] - indicates whether to trim string or not
- * @returns {String} 
+ * @returns {String}
  */
 function sanitize (inputString, trim) {
     if (typeof inputString !== 'string') {
@@ -14,6 +14,75 @@ function sanitize (inputString, trim) {
     (trim) && (inputString = inputString.trim());
     return inputString.replace(/\\/g, '\\\\').replace(/'/g, '\\\'');
 }
+
+/**
+ * sanitizes input options
+ *
+ * @param {Object} options - Options provided by the user
+ * @param {Array} optionsArray - options array received from getOptions function
+ *
+ * @returns {Object} - Sanitized options object
+ */
+function sanitizeOptions (options, optionsArray) {
+    var result = {},
+        defaultOptions = {},
+        id;
+    optionsArray.forEach((option) => {
+        defaultOptions[option.id] = {
+            default: option.default,
+            type: option.type
+        };
+        if (option.type === 'enum') {
+            defaultOptions[option.id].availableOptions = option.availableOptions;
+        }
+    });
+
+    for (id in options) {
+        if (options.hasOwnProperty(id)) {
+            if (defaultOptions[id] === undefined) {
+                continue;
+            }
+            switch (defaultOptions[id].type) {
+                case 'boolean':
+                    if (typeof options[id] !== 'boolean') {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'positiveInteger':
+                    if (typeof options[id] !== 'number' || options[id] < 0) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'enum':
+                    if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                default:
+                    result[id] = options[id];
+            }
+        }
+    }
+
+    for (id in defaultOptions) {
+        if (defaultOptions.hasOwnProperty(id)) {
+            if (result[id] === undefined) {
+                result[id] = defaultOptions[id].default;
+            }
+        }
+    }
+    return result;
+}
 module.exports = {
-    sanitize: sanitize
+    sanitize: sanitize,
+    sanitizeOptions: sanitizeOptions
 };
diff --git a/codegens/nodejs-unirest/README.md b/codegens/nodejs-unirest/README.md
index edfe5ac..0e0803f 100644
--- a/codegens/nodejs-unirest/README.md
+++ b/codegens/nodejs-unirest/README.md
@@ -25,7 +25,7 @@ Convert function will take three parameters
 
 * `options`- options is an object which can have following properties
     * `indentType`- string representing type of indentation for code snippet. eg: 'space', 'tab' (default: 'tab')
-    * `indentCount`- integer representing count of indentation required.
+    * `indentCount`- positiveInteger representing count of indentation required.
     * `requestTimeout` : Integer denoting time after which the request will bail out in milli-seconds
     * `trimRequestBody` : Trim request body fields
     * `followRedirect` : Boolean denoting whether to redirect a request
diff --git a/codegens/nodejs-unirest/lib/unirest.js b/codegens/nodejs-unirest/lib/unirest.js
index 84161eb..b878ebf 100644
--- a/codegens/nodejs-unirest/lib/unirest.js
+++ b/codegens/nodejs-unirest/lib/unirest.js
@@ -1,4 +1,5 @@
 var _ = require('./lodash'),
+    sanitizeOptions = require('./util').sanitizeOptions,
 
     parseRequest = require('./parseRequest');
 
@@ -45,7 +46,7 @@ function getOptions () {
         {
             name: 'Indent count',
             id: 'indentCount',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 2,
             description: 'Number of indentation characters to add per code level'
         },
@@ -60,7 +61,7 @@ function getOptions () {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
             description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
@@ -97,6 +98,7 @@ function convert (request, options, callback) {
     if (!_.isFunction(callback)) {
         throw new Error('Nodejs-Unirest-Converter: callback is not valid function');
     }
+    options = sanitizeOptions(options, getOptions());
 
     //  String representing value of indentation required
     var indentString;
diff --git a/codegens/nodejs-unirest/lib/util.js b/codegens/nodejs-unirest/lib/util.js
index ff49c0f..6ea9826 100644
--- a/codegens/nodejs-unirest/lib/util.js
+++ b/codegens/nodejs-unirest/lib/util.js
@@ -1,10 +1,10 @@
 /**
  * sanitizes input string by handling escape characters eg: converts '''' to '\'\''
  * and trim input if required
- * 
+ *
  * @param {String} inputString
  * @param {Boolean} [trim] - indicates whether to trim string or not
- * @returns {String} 
+ * @returns {String}
  */
 function sanitize (inputString, trim) {
     if (typeof inputString !== 'string') {
@@ -14,6 +14,75 @@ function sanitize (inputString, trim) {
     return inputString.replace(/\\/g, '\\\\').replace(/'/g, '\\\'');
 }
 
+/**
+ * sanitizes input options
+ *
+ * @param {Object} options - Options provided by the user
+ * @param {Array} optionsArray - options array received from getOptions function
+ *
+ * @returns {Object} - Sanitized options object
+ */
+function sanitizeOptions (options, optionsArray) {
+    var result = {},
+        defaultOptions = {},
+        id;
+    optionsArray.forEach((option) => {
+        defaultOptions[option.id] = {
+            default: option.default,
+            type: option.type
+        };
+        if (option.type === 'enum') {
+            defaultOptions[option.id].availableOptions = option.availableOptions;
+        }
+    });
+
+    for (id in options) {
+        if (options.hasOwnProperty(id)) {
+            if (defaultOptions[id] === undefined) {
+                continue;
+            }
+            switch (defaultOptions[id].type) {
+                case 'boolean':
+                    if (typeof options[id] !== 'boolean') {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'positiveInteger':
+                    if (typeof options[id] !== 'number' || options[id] < 0) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'enum':
+                    if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                default:
+                    result[id] = options[id];
+            }
+        }
+    }
+
+    for (id in defaultOptions) {
+        if (defaultOptions.hasOwnProperty(id)) {
+            if (result[id] === undefined) {
+                result[id] = defaultOptions[id].default;
+            }
+        }
+    }
+    return result;
+}
+
 module.exports = {
-    sanitize: sanitize
+    sanitize: sanitize,
+    sanitizeOptions: sanitizeOptions
 };
diff --git a/codegens/ocaml-cohttp/lib/ocaml.js b/codegens/ocaml-cohttp/lib/ocaml.js
index 31bc589..f4ff7d3 100644
--- a/codegens/ocaml-cohttp/lib/ocaml.js
+++ b/codegens/ocaml-cohttp/lib/ocaml.js
@@ -1,5 +1,7 @@
 var _ = require('./lodash'),
-    sanitize = require('./util').sanitize;
+    sanitize = require('./util').sanitize,
+    sanitizeOptions = require('./util').sanitizeOptions,
+    self;
 
 /**
  * Parses Raw data from request to fetch syntax
@@ -192,7 +194,7 @@ function getMethodArg (method) {
     return methodArg;
 }
 
-module.exports = {
+self = module.exports = {
     /**
      * Used in order to get options for generation of OCaml code snippet
      *
@@ -205,7 +207,7 @@ module.exports = {
             {
                 name: 'Indent count',
                 id: 'indentCount',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 2,
                 description: 'Number of indentation characters to add per code level'
             },
@@ -227,7 +229,7 @@ module.exports = {
             {
                 name: 'Request timeout',
                 id: 'requestTimeout',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 0,
                 description: 'How long the request should wait for a response before timing out (milliseconds)'
             },
@@ -267,6 +269,7 @@ module.exports = {
         else if (!_.isFunction(callback)) {
             throw new Error('OCaml-Cohttp-Converter: callback is not valid function');
         }
+        options = sanitizeOptions(options, self.getOptions());
 
         var codeSnippet, indent, trim, finalUrl, methodArg, // timeout, followRedirect,
             bodySnippet = '',
@@ -275,7 +278,7 @@ module.exports = {
             requestBodyMode = (request.body ? request.body.mode : 'raw');
 
         indent = options.indentType === 'tab' ? '\t' : ' ';
-        indent = indent.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+        indent = indent.repeat(options.indentCount);
         // timeout = options.requestTimeout;
         // followRedirect = options.followRedirect;
         trim = options.trimRequestBody;
diff --git a/codegens/ocaml-cohttp/lib/util.js b/codegens/ocaml-cohttp/lib/util.js
index 8238dcd..efb18c9 100644
--- a/codegens/ocaml-cohttp/lib/util.js
+++ b/codegens/ocaml-cohttp/lib/util.js
@@ -32,5 +32,73 @@ module.exports = {
             }
         }
         return inputString;
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/php-curl/lib/php-curl.js b/codegens/php-curl/lib/php-curl.js
index 0d6fea1..34555e0 100644
--- a/codegens/php-curl/lib/php-curl.js
+++ b/codegens/php-curl/lib/php-curl.js
@@ -1,6 +1,8 @@
 var _ = require('./lodash'),
     parseBody = require('./util/parseBody'),
-    sanitize = require('./util/sanitize').sanitize;
+    sanitize = require('./util/sanitize').sanitize,
+    sanitizeOptions = require('./util/sanitize').sanitizeOptions,
+    self;
 
 /**
  * Used to parse the request headers
@@ -23,7 +25,7 @@ function getHeaders (request, indentation) {
     return '';
 }
 
-module.exports = {
+self = module.exports = {
     /**
      * Used to return options which are specific to a particular plugin
      *
@@ -33,7 +35,7 @@ module.exports = {
         return [{
             name: 'Indent count',
             id: 'indentCount',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 2,
             description: 'Number of indentation characters to add per code level'
         },
@@ -48,7 +50,7 @@ module.exports = {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
             description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
@@ -95,9 +97,10 @@ module.exports = {
         else if (!_.isFunction(callback)) {
             throw new Error('Php-Curl~convert: Callback is not a function');
         }
+        options = sanitizeOptions(options, self.getOptions());
 
         identity = options.indentType === 'tab' ? '\t' : ' ';
-        indentation = identity.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+        indentation = identity.repeat(options.indentCount);
         // concatenation and making up the final string
         finalUrl = request.url.toString();
         if (finalUrl !== encodeURI(finalUrl)) {
@@ -110,8 +113,8 @@ module.exports = {
         snippet += `${indentation}CURLOPT_RETURNTRANSFER => true,\n`;
         snippet += `${indentation}CURLOPT_ENCODING => "",\n`;
         snippet += `${indentation}CURLOPT_MAXREDIRS => 10,\n`;
-        snippet += `${indentation}CURLOPT_TIMEOUT => ${options.requestTimeout || 0},\n`;
-        snippet += `${indentation}CURLOPT_FOLLOWLOCATION => ${options.followRedirect || false},\n`;
+        snippet += `${indentation}CURLOPT_TIMEOUT => ${options.requestTimeout},\n`;
+        snippet += `${indentation}CURLOPT_FOLLOWLOCATION => ${options.followRedirect},\n`;
         snippet += `${indentation}CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n`;
         snippet += `${indentation}CURLOPT_CUSTOMREQUEST => "${request.method}",\n`;
         snippet += `${parseBody(request.toJSON(), options.trimRequestBody, indentation)}`;
diff --git a/codegens/php-curl/lib/util/sanitize.js b/codegens/php-curl/lib/util/sanitize.js
index 34d81c5..5bf3d19 100644
--- a/codegens/php-curl/lib/util/sanitize.js
+++ b/codegens/php-curl/lib/util/sanitize.js
@@ -1,11 +1,11 @@
 module.exports = {
 /**
 * sanitization of values : trim, escape characters
-* 
+*
 * @param {String} inputString - input
-* @param {String} escapeCharFor - escape for headers, body: raw, formdata etc 
+* @param {String} escapeCharFor - escape for headers, body: raw, formdata etc
 * @param {Boolean} [inputTrim] - whether to trim the input
-* @returns {String} 
+* @returns {String}
 */
     sanitize: function (inputString, escapeCharFor, inputTrim) {
 
@@ -30,5 +30,73 @@ module.exports = {
             }
         }
         return inputString;
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/php-pecl-http/lib/phpPecl.js b/codegens/php-pecl-http/lib/phpPecl.js
index 3ec8bea..a080031 100644
--- a/codegens/php-pecl-http/lib/phpPecl.js
+++ b/codegens/php-pecl-http/lib/phpPecl.js
@@ -1,6 +1,8 @@
 var _ = require('./lodash'),
     parseBody = require('./util/parseBody'),
-    sanitize = require('./util/sanitize').sanitize;
+    sanitize = require('./util/sanitize').sanitize,
+    sanitizeOptions = require('./util/sanitize').sanitizeOptions,
+    self;
 
 /**
  * Used to get the headers and put them in the desired form of the language
@@ -24,7 +26,7 @@ function getHeaders (request, indentation) {
 }
 
 
-module.exports = {
+self = module.exports = {
     /**
      * @returns {Array} plugin specific options
      */
@@ -33,7 +35,7 @@ module.exports = {
             {
                 name: 'Indent count',
                 id: 'indentCount',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 2,
                 description: 'Number of indentation characters to add per code level'
             },
@@ -48,7 +50,7 @@ module.exports = {
             {
                 name: 'Request timeout',
                 id: 'requestTimeout',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 0,
                 description: 'How long the request should wait for a response before timing out (milliseconds)'
             },
@@ -77,7 +79,7 @@ module.exports = {
      *                                                               default: 2 for indentType: tab)
      * @param {Number} options.requestTimeout : time in milli-seconds after which request will bail out
                                                 (default: 0 -> never bail out)
-     * @param {Boolean} options.requestBodyTrim : whether to trim request body fields (default: false)
+     * @param {Boolean} options.trimRequestBody : whether to trim request body fields (default: false)
      * @param {Boolean} options.followRedirect : whether to allow redirects of a request
      * @param  {Function} callback - function with parameters (error, snippet)
      */
@@ -92,6 +94,7 @@ module.exports = {
         else if (!_.isFunction(callback)) {
             throw new Error('Php-Pecl(HTTP)~convert: Callback is not a function');
         }
+        options = sanitizeOptions(options, self.getOptions());
 
         identity = options.indentType === 'tab' ? '\t' : ' ';
         indentation = identity.repeat(options.indentCount);
@@ -103,7 +106,7 @@ module.exports = {
         snippet += `$request->setRequestMethod('${request.method}');\n`;
         if (!_.isEmpty(request.body)) {
             snippet += '$body = new http\\Message\\Body;\n';
-            snippet += `${parseBody(request.toJSON(), indentation, options.requestBodyTrim)}`;
+            snippet += `${parseBody(request.toJSON(), indentation, options.trimRequestBody)}`;
             snippet += '$request->setBody($body);\n';
         }
         snippet += '$request->setOptions(array(';
diff --git a/codegens/php-pecl-http/lib/util/sanitize.js b/codegens/php-pecl-http/lib/util/sanitize.js
index e0269ac..cd23c44 100644
--- a/codegens/php-pecl-http/lib/util/sanitize.js
+++ b/codegens/php-pecl-http/lib/util/sanitize.js
@@ -3,7 +3,7 @@ module.exports = {
     * used to sanitize eg: trim, handle escape characters
     * @param {String} inputString - input
     * @param {Boolean} [inputTrim] - whether to trim the input
-    * @returns {String} 
+    * @returns {String}
     */
 
     sanitize: function (inputString, inputTrim) {
@@ -13,5 +13,73 @@ module.exports = {
 
         inputString = inputTrim && typeof inputTrim === 'boolean' ? inputString.trim() : inputString;
         return inputString.replace(/\\/g, '\\\\').replace(/'/g, '\\\'');
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/powershell-restmethod/lib/index.js b/codegens/powershell-restmethod/lib/index.js
index 4cf2adb..61a24c4 100644
--- a/codegens/powershell-restmethod/lib/index.js
+++ b/codegens/powershell-restmethod/lib/index.js
@@ -1,5 +1,6 @@
 var _ = require('./lodash'),
-    sanitize = require('./util').sanitize;
+    sanitize = require('./util').sanitize,
+    sanitizeOptions = require('./util').sanitizeOptions;
 const VALID_METHODS = ['DEFAULT',
     'DELETE',
     'GET',
@@ -141,7 +142,7 @@ function getOptions () {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
             description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
@@ -176,6 +177,7 @@ function convert (request, options, callback) {
     if (!_.isFunction(callback)) {
         throw new Error('Powershell RestMethod Converter callback is not a valid function');
     }
+    options = sanitizeOptions(options, getOptions());
 
     var trim = options.trimRequestBody,
         headers, body,
diff --git a/codegens/powershell-restmethod/lib/util.js b/codegens/powershell-restmethod/lib/util.js
index c9b26d3..5bdd474 100644
--- a/codegens/powershell-restmethod/lib/util.js
+++ b/codegens/powershell-restmethod/lib/util.js
@@ -15,6 +15,75 @@ function sanitize (inputString, trim) {
     return trim ? inputString.trim() : inputString;
 }
 
+/**
+ * sanitizes input options
+ *
+ * @param {Object} options - Options provided by the user
+ * @param {Array} optionsArray - options array received from getOptions function
+ *
+ * @returns {Object} - Sanitized options object
+ */
+function sanitizeOptions (options, optionsArray) {
+    var result = {},
+        defaultOptions = {},
+        id;
+    optionsArray.forEach((option) => {
+        defaultOptions[option.id] = {
+            default: option.default,
+            type: option.type
+        };
+        if (option.type === 'enum') {
+            defaultOptions[option.id].availableOptions = option.availableOptions;
+        }
+    });
+
+    for (id in options) {
+        if (options.hasOwnProperty(id)) {
+            if (defaultOptions[id] === undefined) {
+                continue;
+            }
+            switch (defaultOptions[id].type) {
+                case 'boolean':
+                    if (typeof options[id] !== 'boolean') {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'positiveInteger':
+                    if (typeof options[id] !== 'number' || options[id] < 0) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'enum':
+                    if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                default:
+                    result[id] = options[id];
+            }
+        }
+    }
+
+    for (id in defaultOptions) {
+        if (defaultOptions.hasOwnProperty(id)) {
+            if (result[id] === undefined) {
+                result[id] = defaultOptions[id].default;
+            }
+        }
+    }
+    return result;
+}
+
 module.exports = {
-    sanitize: sanitize
+    sanitize: sanitize,
+    sanitizeOptions: sanitizeOptions
 };
diff --git a/codegens/python-http.client/lib/python-httpclient.js b/codegens/python-http.client/lib/python-httpclient.js
index 85c7290..550f5fd 100644
--- a/codegens/python-http.client/lib/python-httpclient.js
+++ b/codegens/python-http.client/lib/python-httpclient.js
@@ -1,6 +1,8 @@
 var _ = require('./lodash'),
     sanitize = require('./util/sanitize').sanitize,
-    parseBody = require('./util/parseBody');
+    sanitizeOptions = require('./util/sanitize').sanitizeOptions,
+    parseBody = require('./util/parseBody'),
+    self;
 
 /**
  * Used to parse the request headers
@@ -49,7 +51,7 @@ function getUrlPathWithQuery (requestUrl) {
     return urlPathWithQuery;
 }
 
-module.exports = {
+self = module.exports = {
     /**
      * Used to return options which are specific to a particular plugin
      *
@@ -62,7 +64,7 @@ module.exports = {
             {
                 name: 'Indent count',
                 id: 'indentCount',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 2,
                 description: 'Number of indentation characters to add per code level'
             },
@@ -77,7 +79,7 @@ module.exports = {
             {
                 name: 'Request timeout',
                 id: 'requestTimeout',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 0,
                 description: 'How long the request should wait for a response before timing out (milliseconds)'
             },
@@ -126,9 +128,10 @@ module.exports = {
         else if (!_.isFunction(callback)) {
             throw new Error('Python-Http.Client~convert: Callback is not a function');
         }
+        options = sanitizeOptions(options, self.getOptions());
 
         identity = options.indentType === 'tab' ? '\t' : ' ';
-        indentation = identity.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+        indentation = identity.repeat(options.indentCount);
 
         snippet += 'import http.client\n';
         snippet += `conn = http.client.HTTPSConnection("${request.url.host.join('.')}"`;
diff --git a/codegens/python-http.client/lib/util/sanitize.js b/codegens/python-http.client/lib/util/sanitize.js
index a2bedfc..b10a5ee 100644
--- a/codegens/python-http.client/lib/util/sanitize.js
+++ b/codegens/python-http.client/lib/util/sanitize.js
@@ -1,9 +1,9 @@
 module.exports = {
 /**
 * Sanitizes input string by handling escape characters according to request body type
-* 
+*
 * @param {String} inputString - Input String to sanitize
-* @param {String} escapeCharFor - Escape for headers, body: raw, formdata etc 
+* @param {String} escapeCharFor - Escape for headers, body: raw, formdata etc
 * @param {Boolean} [inputTrim] - Whether to trim the input
 * @returns {String} Sanitized String handling escape characters
 */
@@ -32,5 +32,73 @@ module.exports = {
             }
         }
         return inputString.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/python-requests/lib/python-requests.js b/codegens/python-requests/lib/python-requests.js
index 1823337..21334af 100644
--- a/codegens/python-requests/lib/python-requests.js
+++ b/codegens/python-requests/lib/python-requests.js
@@ -1,6 +1,8 @@
 var _ = require('./lodash'),
     parseBody = require('./util/parseBody'),
-    sanitize = require('./util/sanitize').sanitize;
+    sanitize = require('./util/sanitize').sanitize,
+    sanitizeOptions = require('./util/sanitize').sanitizeOptions,
+    self;
 
 /**
  * Used to parse the request headers
@@ -23,7 +25,7 @@ function getheaders (request, indentation) {
     return 'headers= {}\n';
 }
 
-module.exports = {
+self = module.exports = {
     /**
      * Used to return options which are specific to a particular plugin
      * 
@@ -33,7 +35,7 @@ module.exports = {
         return [{
             name: 'Indent count',
             id: 'indentCount',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 2,
             description: 'Number of indentation characters to add per code level'
         },
@@ -48,7 +50,7 @@ module.exports = {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
             description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
@@ -94,9 +96,10 @@ module.exports = {
         else if (!_.isFunction(callback)) {
             throw new Error('Python-Requests~convert: Callback is not a function');
         }
+        options = sanitizeOptions(options, self.getOptions());
 
         identity = options.indentType === 'tab' ? '\t' : ' ';
-        indentation = identity.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+        indentation = identity.repeat(options.indentCount);
         snippet += 'import requests\n\n';
         snippet += `url = "${sanitize(request.url.toString(), 'url')}"\n\n`;
         snippet += `${parseBody(request.toJSON(), indentation, options.trimRequestBody)}`;
diff --git a/codegens/python-requests/lib/util/sanitize.js b/codegens/python-requests/lib/util/sanitize.js
index 37baba5..63004b6 100644
--- a/codegens/python-requests/lib/util/sanitize.js
+++ b/codegens/python-requests/lib/util/sanitize.js
@@ -30,5 +30,73 @@ module.exports = {
             }
         }
         return inputString;
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/ruby/lib/ruby.js b/codegens/ruby/lib/ruby.js
index 6266f54..0739df5 100644
--- a/codegens/ruby/lib/ruby.js
+++ b/codegens/ruby/lib/ruby.js
@@ -1,6 +1,8 @@
 var _ = require('./lodash'),
     parseBody = require('./util/parseBody'),
-    sanitize = require('./util/sanitize').sanitize;
+    sanitize = require('./util/sanitize').sanitize,
+    sanitizeOptions = require('./util/sanitize').sanitizeOptions,
+    self;
 
 /**
  * Used to parse the request headers
@@ -18,7 +20,7 @@ function parseHeaders (headers) {
     return headerSnippet;
 }
 
-module.exports = {
+self = module.exports = {
     /**
      * Used to return options which are specific to a particular plugin
      *
@@ -28,7 +30,7 @@ module.exports = {
         return [{
             name: 'Indent count',
             id: 'indentCount',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 2,
             description: 'Number of indentation characters to add per code level'
         },
@@ -43,7 +45,7 @@ module.exports = {
         {
             name: 'Request timeout',
             id: 'requestTimeout',
-            type: 'integer',
+            type: 'positiveInteger',
             default: 0,
             description: 'How long the request should wait for a response before timing out (milliseconds)'
         },
@@ -92,9 +94,10 @@ module.exports = {
         else if (!_.isFunction(callback)) {
             throw new Error('Ruby~convert: Callback is not a function');
         }
+        options = sanitizeOptions(options, self.getOptions());
 
         identity = options.indentType === 'tab' ? '\t' : ' ';
-        indentation = identity.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+        indentation = identity.repeat(options.indentCount);
         // concatenation and making up the final string
         snippet = 'require "uri"\n';
         snippet += 'require "net/http"\n\n';
diff --git a/codegens/ruby/lib/util/sanitize.js b/codegens/ruby/lib/util/sanitize.js
index 34d81c5..5bf3d19 100644
--- a/codegens/ruby/lib/util/sanitize.js
+++ b/codegens/ruby/lib/util/sanitize.js
@@ -1,11 +1,11 @@
 module.exports = {
 /**
 * sanitization of values : trim, escape characters
-* 
+*
 * @param {String} inputString - input
-* @param {String} escapeCharFor - escape for headers, body: raw, formdata etc 
+* @param {String} escapeCharFor - escape for headers, body: raw, formdata etc
 * @param {Boolean} [inputTrim] - whether to trim the input
-* @returns {String} 
+* @returns {String}
 */
     sanitize: function (inputString, escapeCharFor, inputTrim) {
 
@@ -30,5 +30,73 @@ module.exports = {
             }
         }
         return inputString;
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/shell-httpie/lib/shell-httpie.js b/codegens/shell-httpie/lib/shell-httpie.js
index 0e700d8..2245f56 100644
--- a/codegens/shell-httpie/lib/shell-httpie.js
+++ b/codegens/shell-httpie/lib/shell-httpie.js
@@ -1,23 +1,40 @@
 var _ = require('./lodash'),
-  Helpers = require('./util/helpers');
+  Helpers = require('./util/helpers'),
+  sanitizeOptions = require('./util/sanitize').sanitizeOptions,
+  self;
 
 const GAP = ' ',
   URLENCODED = 'urlencoded',
   FORM_DATA = 'formdata',
   RAW = 'raw';
 
-module.exports = {
+self = module.exports = {
   /**
    * Used to return options which are specific to a particular plugin
    * 
    * @returns {Array}
    */
   getOptions: function () {
-    return [];
+    return [
+      {
+        name: 'Request timeout',
+        id: 'requestTimeout',
+        type: 'positiveInteger',
+        default: 0,
+        description: 'How long the request should wait for a response before timing out (milliseconds)'
+      },
+      {
+        name: 'Follow redirect',
+        id: 'followRedirect',
+        type: 'boolean',
+        default: true,
+        description: 'Automatically follow HTTP redirects'
+      }
+    ];
   },
 
   /**
-    * Used to convert the postman sdk-request object in php-curl reuqest snippet 
+    * Used to convert the postman sdk-request object in shell-httpie reuqest snippet 
     * 
     * @param  {Object} request - postman SDK-request object
     * @param  {Object} options
@@ -50,9 +67,11 @@ module.exports = {
       throw new Error('Shell-Httpie~convert: Callback not a function');
     }
 
+    options = sanitizeOptions(options, self.getOptions());
+
     Helpers.parseURLVariable(request);
     url = Helpers.addHost(request) + Helpers.addPathandQuery(request);
-    timeout = options.requestTimeout || '';
+    timeout = options.requestTimeout;
     parsedHeaders = Helpers.addHeaders(request);
 
     // snippet construction based on the request body
diff --git a/codegens/shell-httpie/lib/util/sanitize.js b/codegens/shell-httpie/lib/util/sanitize.js
index 81125e4..53dd5a8 100644
--- a/codegens/shell-httpie/lib/util/sanitize.js
+++ b/codegens/shell-httpie/lib/util/sanitize.js
@@ -4,5 +4,73 @@ module.exports = {
       return '';
     }
     return '\'' + value.replace(/\\/g, '\\\\').replace(/'/g, '\'\\\'\'') + '\'';
+  },
+
+  /**
+ * sanitizes input options
+ *
+ * @param {Object} options - Options provided by the user
+ * @param {Array} optionsArray - options array received from getOptions function
+ *
+ * @returns {Object} - Sanitized options object
+ */
+  sanitizeOptions: function (options, optionsArray) {
+    var result = {},
+      defaultOptions = {},
+      id;
+    optionsArray.forEach((option) => {
+      defaultOptions[option.id] = {
+        default: option.default,
+        type: option.type
+      };
+      if (option.type === 'enum') {
+        defaultOptions[option.id].availableOptions = option.availableOptions;
+      }
+    });
+
+    for (id in options) {
+      if (options.hasOwnProperty(id)) {
+        if (defaultOptions[id] === undefined) {
+          continue;
+        }
+        switch (defaultOptions[id].type) {
+          case 'boolean':
+            if (typeof options[id] !== 'boolean') {
+              result[id] = defaultOptions[id].default;
+            }
+            else {
+              result[id] = options[id];
+            }
+            break;
+          case 'positiveInteger':
+            if (typeof options[id] !== 'number' || options[id] < 0) {
+              result[id] = defaultOptions[id].default;
+            }
+            else {
+              result[id] = options[id];
+            }
+            break;
+          case 'enum':
+            if (!defaultOptions[id].availableOptions.includes(options[id])) {
+              result[id] = defaultOptions[id].default;
+            }
+            else {
+              result[id] = options[id];
+            }
+            break;
+          default:
+            result[id] = options[id];
+        }
+      }
+    }
+
+    for (id in defaultOptions) {
+      if (defaultOptions.hasOwnProperty(id)) {
+        if (result[id] === undefined) {
+          result[id] = defaultOptions[id].default;
+        }
+      }
+    }
+    return result;
   }
 };
diff --git a/codegens/shell-wget/lib/shell-wget.js b/codegens/shell-wget/lib/shell-wget.js
index 464fdff..a888ec8 100644
--- a/codegens/shell-wget/lib/shell-wget.js
+++ b/codegens/shell-wget/lib/shell-wget.js
@@ -1,6 +1,8 @@
 var _ = require('./lodash'),
     parseBody = require('./util/parseBody'),
-    sanitize = require('./util/sanitize').sanitize;
+    sanitize = require('./util/sanitize').sanitize,
+    sanitizeOptions = require('./util/sanitize').sanitizeOptions,
+    self;
 
 /**
  * Used to parse the request headers
@@ -23,7 +25,7 @@ function getHeaders (request, indentation) {
     return `${indentation}--header '' \\`;
 }
 
-module.exports = {
+self = module.exports = {
     /**
      * Used to return options which are specific to a particular plugin
      *
@@ -38,7 +40,7 @@ module.exports = {
             {
                 name: 'Indent count',
                 id: 'indentCount',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 2,
                 description: 'Number of indentation characters to add per code level'
             },
@@ -53,7 +55,7 @@ module.exports = {
             {
                 name: 'Request timeout',
                 id: 'requestTimeout',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 0,
                 description: 'How long the request should wait for a response before timing out (milliseconds)'
             },
@@ -103,8 +105,10 @@ module.exports = {
             throw new Error('Shell-wget~convert: Callback is not a function');
         }
 
+        options = sanitizeOptions(options, self.getOptions());
+
         identity = options.indentType === 'tab' ? '\t' : ' ';
-        indentation = identity.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+        indentation = identity.repeat(options.indentCount);
         // concatenation and making up the final string
 
         snippet = 'wget --no-check-certificate --quiet \\\n';
diff --git a/codegens/shell-wget/lib/util/sanitize.js b/codegens/shell-wget/lib/util/sanitize.js
index 4f87612..55f2161 100644
--- a/codegens/shell-wget/lib/util/sanitize.js
+++ b/codegens/shell-wget/lib/util/sanitize.js
@@ -1,11 +1,11 @@
 module.exports = {
 /**
 * sanitization of values : trim, escape characters
-* 
+*
 * @param {String} inputString - input
-* @param {String} escapeCharFor - escape for headers, body: raw, formdata etc 
+* @param {String} escapeCharFor - escape for headers, body: raw, formdata etc
 * @param {Boolean} [inputTrim] - whether to trim the input
-* @returns {String} 
+* @returns {String}
 */
     sanitize: function (inputString, escapeCharFor, inputTrim) {
 
@@ -31,5 +31,73 @@ module.exports = {
             }
         }
         return inputString;
+    },
+
+    /**
+    * sanitizes input options
+    *
+    * @param {Object} options - Options provided by the user
+    * @param {Array} optionsArray - options array received from getOptions function
+    *
+    * @returns {Object} - Sanitized options object
+    */
+    sanitizeOptions: function (options, optionsArray) {
+        var result = {},
+            defaultOptions = {},
+            id;
+        optionsArray.forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        for (id in options) {
+            if (options.hasOwnProperty(id)) {
+                if (defaultOptions[id] === undefined) {
+                    continue;
+                }
+                switch (defaultOptions[id].type) {
+                    case 'boolean':
+                        if (typeof options[id] !== 'boolean') {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'positiveInteger':
+                        if (typeof options[id] !== 'number' || options[id] < 0) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    case 'enum':
+                        if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                            result[id] = defaultOptions[id].default;
+                        }
+                        else {
+                            result[id] = options[id];
+                        }
+                        break;
+                    default:
+                        result[id] = options[id];
+                }
+            }
+        }
+
+        for (id in defaultOptions) {
+            if (defaultOptions.hasOwnProperty(id)) {
+                if (result[id] === undefined) {
+                    result[id] = defaultOptions[id].default;
+                }
+            }
+        }
+        return result;
     }
 };
diff --git a/codegens/swift/lib/swift.js b/codegens/swift/lib/swift.js
index 88afe0c..2ea3468 100644
--- a/codegens/swift/lib/swift.js
+++ b/codegens/swift/lib/swift.js
@@ -1,5 +1,7 @@
 var _ = require('./lodash'),
-    sanitize = require('./util').sanitize;
+    sanitize = require('./util').sanitize,
+    sanitizeOptions = require('./util').sanitizeOptions,
+    self;
 
 /**
  * Parses Raw data from request to fetch syntax
@@ -140,7 +142,7 @@ function parseHeaders (headers, mode) {
     return headerSnippet;
 }
 
-module.exports = {
+self = module.exports = {
     /**
      * Used in order to get additional options for generation of Swift code snippet
      *
@@ -153,7 +155,7 @@ module.exports = {
             {
                 name: 'Indent count',
                 id: 'indentCount',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 2,
                 description: 'Number of indentation characters to add per code level'
             },
@@ -168,7 +170,7 @@ module.exports = {
             {
                 name: 'Request timeout',
                 id: 'requestTimeout',
-                type: 'integer',
+                type: 'positiveInteger',
                 default: 0,
                 description: 'How long the request should wait for a response before timing out (milliseconds)'
             },
@@ -215,14 +217,14 @@ module.exports = {
         else if (!_.isFunction(callback)) {
             throw new Error('Swift-Converter: callback is not valid function');
         }
-
+        options = sanitizeOptions(options, self.getOptions());
         var codeSnippet, indent, trim, timeout, finalUrl, // followRedirect,
             bodySnippet = '',
             headerSnippet = '',
             requestBody = (request.body ? request.body.toJSON() : {});
 
         indent = options.indentType === 'tab' ? '\t' : ' ';
-        indent = indent.repeat(options.indentCount || (options.indentType === 'tab' ? 1 : 4));
+        indent = indent.repeat(options.indentCount);
         timeout = options.requestTimeout;
         // followRedirect = options.followRedirect;
         trim = options.trimRequestBody;
diff --git a/codegens/swift/lib/util.js b/codegens/swift/lib/util.js
index 752fcf2..cac4d4f 100644
--- a/codegens/swift/lib/util.js
+++ b/codegens/swift/lib/util.js
@@ -33,6 +33,75 @@ function sanitize (inputString, escapeCharFor, inputTrim) {
     return inputString;
 }
 
+/**
+ * sanitizes input options
+ *
+ * @param {Object} options - Options provided by the user
+ * @param {Array} optionsArray - options array received from getOptions function
+ *
+ * @returns {Object} - Sanitized options object
+ */
+function sanitizeOptions (options, optionsArray) {
+    var result = {},
+        defaultOptions = {},
+        id;
+    optionsArray.forEach((option) => {
+        defaultOptions[option.id] = {
+            default: option.default,
+            type: option.type
+        };
+        if (option.type === 'enum') {
+            defaultOptions[option.id].availableOptions = option.availableOptions;
+        }
+    });
+
+    for (id in options) {
+        if (options.hasOwnProperty(id)) {
+            if (defaultOptions[id] === undefined) {
+                continue;
+            }
+            switch (defaultOptions[id].type) {
+                case 'boolean':
+                    if (typeof options[id] !== 'boolean') {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'positiveInteger':
+                    if (typeof options[id] !== 'number' || options[id] < 0) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                case 'enum':
+                    if (!defaultOptions[id].availableOptions.includes(options[id])) {
+                        result[id] = defaultOptions[id].default;
+                    }
+                    else {
+                        result[id] = options[id];
+                    }
+                    break;
+                default:
+                    result[id] = options[id];
+            }
+        }
+    }
+
+    for (id in defaultOptions) {
+        if (defaultOptions.hasOwnProperty(id)) {
+            if (result[id] === undefined) {
+                result[id] = defaultOptions[id].default;
+            }
+        }
+    }
+    return result;
+}
+
 module.exports = {
-    sanitize: sanitize
+    sanitize: sanitize,
+    sanitizeOptions: sanitizeOptions
 };


Test patch:
diff --git a/codegens/csharp-restsharp/test/unit/convert.test.js b/codegens/csharp-restsharp/test/unit/convert.test.js
index c9533e3..d4287b6 100644
--- a/codegens/csharp-restsharp/test/unit/convert.test.js
+++ b/codegens/csharp-restsharp/test/unit/convert.test.js
@@ -9,7 +9,9 @@ var expect = require('chai').expect,
     mainCollection = require('./fixtures/testcollection/collection.json'),
     testCollection = require('./fixtures/testcollection/collectionForEdge.json'),
     getOptions = require('../../lib/index').getOptions,
-    testResponse = require('./fixtures/testresponse.json');
+    testResponse = require('./fixtures/testresponse.json'),
+    sanitize = require('../../lib/util').sanitize,
+    sanitizeOptions = require('../../lib/util').sanitizeOptions;
 
 /**
  * compiles and runs codesnippet then compare it with newman output
@@ -256,4 +258,84 @@ describe('csharp restsharp function', function () {
         });
     });
 
+    describe('Sanitize function', function () {
+
+        it('should return empty string when input is not a string type', function () {
+            expect(sanitize(123, false)).to.equal('');
+            expect(sanitize(null, false)).to.equal('');
+            expect(sanitize({}, false)).to.equal('');
+            expect(sanitize([], false)).to.equal('');
+        });
+
+        it('should trim input string when needed', function () {
+            expect(sanitize('inputString     ', true)).to.equal('inputString');
+        });
+    });
+
+    describe('sanitizeOptions function', function () {
+        var defaultOptions = {},
+            testOptions = {},
+            sanitizedOptions;
+
+        getOptions().forEach((option) => {
+            defaultOptions[option.id] = {
+                default: option.default,
+                type: option.type
+            };
+            if (option.type === 'enum') {
+                defaultOptions[option.id].availableOptions = option.availableOptions;
+            }
+        });
+
+        it('should remove option not supported by module', function () {
+            testOptions.randomName = 'random value';
+            sanitizedOptions = sanitizeOptions(testOptions, getOptions());
+            expect(sanitizedOptions).to.not.have.property('randomName');
+        });
+
+        it('should use defaults when option value type does not match with expected type', function () {
+            testOptions = {};
+            testOptions.indentCount = '5';
+            testOptions.trimRequestBody = 'true';
+            testOptions.indentType = 'tabSpace';
+            sanitizedOptions = sanitizeOptions(testOptions, getOptions());
+            expect(sanitizedOptions.indentCount).to.equal(defaultOptions.indentCount.default);
+            expect(sanitizedOptions.indentType).to.equal(defaultOptions.indentType.default);
+            expect(sanitizedOptions.trimRequestBody).to.equal(defaultOptions.trimRequestBody.default);
+        });
+
+        it('should use defaults when option type is valid but value is invalid', function () {
+            testOptions = {};
+            testOptions.indentCount = -1;
+            testOptions.indentType = 'spaceTab';
+            testOptions.requestTimeout = -3000;
+            sanitizedOptions = sanitizeOptions(testOptions, getOptions());
+            expect(sanitizedOptions.indentCount).to.equal(defaultOptions.indentCount.default);
+            expect(sanitizedOptions.indentType).to.equal(defaultOptions.indentType.default);
+            expect(sanitizedOptions.requestTimeout).to.equal(defaultOptions.requestTimeout.default);
+        });
+
+        it('should return the same object when default options are provided', function () {
+            for (var id in defaultOptions) {
+                if (defaultOptions.hasOwnProperty(id)) {
+                    testOptions[id] = defaultOptions[id].default;
+                }
+            }
+            sanitizedOptions = sanitizeOptions(testOptions, getOptions());
+            expect(sanitizedOptions).to.deep.equal(testOptions);
+        });
+
+        it('should return the same object when valid (but not necessarily defaults) options are provided', function () {
+            testOptions = {};
+            testOptions.indentType = 'tab';
+            testOptions.indentCount = 3;
+            testOptions.requestTimeout = 3000;
+            testOptions.trimRequestBody = true;
+            testOptions.followRedirect = false;
+            testOptions.includeBoilerplate = true;
+            sanitizedOptions = sanitizeOptions(testOptions, getOptions());
+            expect(sanitizedOptions).to.deep.equal(testOptions);
+        });
+    });
+
 });
diff --git a/codegens/http/test/unit/converter.test.js b/codegens/http/test/unit/converter.test.js
index a6229f1..6ef8030 100644
--- a/codegens/http/test/unit/converter.test.js
+++ b/codegens/http/test/unit/converter.test.js
@@ -11,7 +11,7 @@ describe('Converter test', function () {
 
   _.forEach(requests, function (r, ind) {
     let testRequest = new Request(r.request);
-    convert(testRequest, {}, function (err, snippet) {
+    convert(testRequest, {trimRequestBody: false}, function (err, snippet) {
       if (err) {
         console.log('Something went wrong while converting the request');
       }
diff --git a/codegens/nodejs-request/test/unit/snippet.test.js b/codegens/nodejs-request/test/unit/snippet.test.js
index 8fa0666..1e87c24 100644
--- a/codegens/nodejs-request/test/unit/snippet.test.js
+++ b/codegens/nodejs-request/test/unit/snippet.test.js
@@ -218,7 +218,7 @@ describe('nodejs-request convert function', function () {
                     return;
                 }
                 expect(snippet).to.be.a('string');
-                expect(snippet).to.include('\'headers\': {\n}');
+                expect(snippet).to.include('\'headers\': {\n  }');
             });
         });
 
diff --git a/codegens/ocaml-cohttp/test/unit/convert.test.js b/codegens/ocaml-cohttp/test/unit/convert.test.js
index 5efd203..f5fd59e 100644
--- a/codegens/ocaml-cohttp/test/unit/convert.test.js
+++ b/codegens/ocaml-cohttp/test/unit/convert.test.js
@@ -162,7 +162,7 @@ describe('Ocaml convert function', function () {
         var request = new sdk.Request(mainCollection.item[0].request),
             snippetArray;
 
-        const SINGLE_SPACE = ' '; // default indent type with indent count of 4
+        const SINGLE_SPACE = ' ';
 
         it('should generate snippet with default options given no options', function () {
             convert(request, function (error, snippet) {
@@ -173,8 +173,8 @@ describe('Ocaml convert function', function () {
                 snippetArray = snippet.split('\n');
                 for (var i = 0; i < snippetArray.length; i++) {
                     if (snippetArray[i].startsWith('let reqBody = ')) {
-                        expect(snippetArray[i + 1].substr(0, 4)).to.equal(SINGLE_SPACE.repeat(4));
-                        expect(snippetArray[i + 1].charAt(4)).to.not.equal(SINGLE_SPACE);
+                        expect(snippetArray[i + 1].substr(0, 2)).to.equal(SINGLE_SPACE.repeat(2));
+                        expect(snippetArray[i + 1].charAt(2)).to.not.equal(SINGLE_SPACE);
                     }
                 }
             });
@@ -196,9 +196,9 @@ describe('Ocaml convert function', function () {
             });
         });
 
-        // By default takes 1 as indent count for tab and indent count of 4 for space
+        // By default takes 2 spaces as indentCount and indentType
         it('should generate snippet with default indent count for absent option indentCount', function () {
-            convert(request, { indentType: 'tab' }, function (error, snippet) {
+            convert(request, { indentType: 'space' }, function (error, snippet) {
                 if (error) {
                     expect.fail(null, null, error);
                     return;
@@ -206,8 +206,8 @@ describe('Ocaml convert function', function () {
                 snippetArray = snippet.split('\n');
                 for (var i = 0; i < snippetArray.length; i++) {
                     if (snippetArray[i].startsWith('let reqBody = ')) {
-                        expect(snippetArray[i + 1].charAt(0)).to.equal('\t');
-                        expect(snippetArray[i + 1].charAt(1)).to.not.equal('\t');
+                        expect(snippetArray[i + 1].charAt(0)).to.equal(' ');
+                        expect(snippetArray[i + 1].charAt(1)).to.equal(' ');
                     }
                 }
             });
diff --git a/codegens/php-pecl-http/test/unit/converter.test.js b/codegens/php-pecl-http/test/unit/converter.test.js
index 311fa5b..6713c1a 100644
--- a/codegens/php-pecl-http/test/unit/converter.test.js
+++ b/codegens/php-pecl-http/test/unit/converter.test.js
@@ -19,7 +19,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -50,7 +50,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 10,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -83,7 +83,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -114,7 +114,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -143,7 +143,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: true,
+                trimRequestBody: true,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -178,7 +178,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -208,7 +208,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -243,7 +243,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -277,7 +277,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -309,7 +309,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -341,7 +341,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -373,7 +373,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -404,7 +404,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
@@ -439,7 +439,7 @@ describe('Request Snippet', function () {
             convert(request, {indentType: 'space',
                 indentCount: 4,
                 requestTimeout: 0,
-                requestBodyTrim: false,
+                trimRequestBody: false,
                 addCacheHeader: false,
                 followRedirect: true}, function (error, snippet) {
                 if (error) {
diff --git a/codegens/shell-wget/test/unit/converter.test.js b/codegens/shell-wget/test/unit/converter.test.js
index 54c603f..5a2d9e2 100644
--- a/codegens/shell-wget/test/unit/converter.test.js
+++ b/codegens/shell-wget/test/unit/converter.test.js
@@ -180,7 +180,7 @@ describe('Shell-Wget converter', function () {
                 snippetArray = snippet.split('\n');
                 for (var i = 0; i < snippetArray.length; i++) {
                     if (snippetArray[i].startsWith('wget --no-check-certificate --quiet')) {
-                        expect(snippetArray[i + 1].substr(0, 4)).to.equal(SINGLE_SPACE.repeat(4));
+                        expect(snippetArray[i + 1].substr(0, 2)).to.equal(SINGLE_SPACE.repeat(2));
                         expect(snippetArray[i + 1].charAt(4)).to.not.equal(SINGLE_SPACE);
                     }
                 }
diff --git a/codegens/swift/test/unit/convert.test.js b/codegens/swift/test/unit/convert.test.js
index 2fae6e5..c59cfd0 100644
--- a/codegens/swift/test/unit/convert.test.js
+++ b/codegens/swift/test/unit/convert.test.js
@@ -146,8 +146,7 @@ describe('Swift Converter', function () {
         var request = new sdk.Request(mainCollection.item[0].request),
             snippetArray;
 
-        const SINGLE_SPACE = ' '; // default indent type with indent count of 4
-
+        const SINGLE_SPACE = ' '; // default indent type with indent count of 2
         it('should generate snippet with default options given no options', function () {
             convert(request, function (error, snippet) {
                 if (error) {
@@ -157,15 +156,15 @@ describe('Swift Converter', function () {
                 snippetArray = snippet.split('\n');
                 for (var i = 0; i < snippetArray.length; i++) {
                     if (snippetArray[i].startsWith('let task = URLSession.shared.dataTask')) {
-                        expect(snippetArray[i + 1].substr(0, 4)).to.equal(SINGLE_SPACE.repeat(4));
-                        expect(snippetArray[i + 1].charAt(4)).to.not.equal(SINGLE_SPACE);
+                        expect(snippetArray[i + 1].charAt(0)).to.equal(SINGLE_SPACE);
+                        expect(snippetArray[i + 1].charAt(1)).to.equal(SINGLE_SPACE);
                     }
                 }
             });
         });
 
-        it('should generate snippet with tab as an indent type with default indent count', function () {
-            convert(request, { indentType: 'tab' }, function (error, snippet) {
+        it('should generate snippet with space as an indent type with default indent count', function () {
+            convert(request, { indentType: 'space' }, function (error, snippet) {
                 if (error) {
                     expect.fail(null, null, error);
                     return;
@@ -173,8 +172,8 @@ describe('Swift Converter', function () {
                 snippetArray = snippet.split('\n');
                 for (var i = 0; i < snippetArray.length; i++) {
                     if (snippetArray[i].startsWith('let task = URLSession.shared.dataTask')) {
-                        expect(snippetArray[i + 1].charAt(0)).to.equal('\t');
-                        expect(snippetArray[i + 1].charAt(1)).to.not.equal('\t');
+                        expect(snippetArray[i + 1].charAt(0)).to.equal(SINGLE_SPACE);
+                        expect(snippetArray[i + 1].charAt(1)).to.equal(SINGLE_SPACE);
                     }
                 }
             });
diff --git a/test/codegen/structure.test.js b/test/codegen/structure.test.js
index 5b7b256..c3e4541 100644
--- a/test/codegen/structure.test.js
+++ b/test/codegen/structure.test.js
@@ -27,7 +27,7 @@ const expectedOptions = {
     },
     indentCount: {
       name: 'Indent count',
-      type: 'integer',
+      type: 'positiveInteger',
       default: 0,
       description: 'Number of indentation characters to add per code level'
     },
@@ -39,7 +39,7 @@ const expectedOptions = {
     },
     requestTimeout: {
       name: 'Request timeout',
-      type: 'integer',
+      type: 'positiveInteger',
       default: 0,
       description: 'How long the request should wait for a response before timing out (milliseconds)'
     },
@@ -199,6 +199,7 @@ describe('Code-gen repository ' + codegen, function () {
           expect(option).to.have.property('description');
           expect(option.name).to.be.eql(expectedOptions[option.id].name);
           expect(option.type).to.be.eql(expectedOptions[option.id].type);
+          expect(option.description).to.be.eql(expectedOptions[option.id].description);
         }
         else {
           console.log(`Option ${option.name} not present in the list of expected options.`);