lib/swagger/swagger.js
function (yamlContent, context, callback) {
		var jsonAPISchema;
		
		try {
			jsonAPISchema = yamljs.parse(yamlContent);
		}
		catch (e) {
			return callback({"code": 851, "msg": e.message});
		}
		
		try {
			swagger.validateYaml(jsonAPISchema);
		}
		catch (e) {
			return callback({"code": 173, "msg": e.message});
		}
		
		context.yaml = jsonAPISchema;
		
		swagger.mapAPis(jsonAPISchema, function (response) {
			context.soajs.config.schema = response.schema;
			context.soajs.config.errors = response.errors;
			
			var myValidator = new Validator();
			var check = myValidator.validate(context.soajs.config, schema);
			if (check.valid) {
				return callback(null, true);
			}
			else {
				var errMsgs = [];
				check.errors.forEach(function (oneError) {
					errMsgs.push(oneError.stack);
				});
				return callback({"code": 172, "msg": new Error(errMsgs.join(" - ")).message});
			}
		});
	}
function (yamlContent, context, callback) {
		var jsonAPISchema;
		
		try {
			jsonAPISchema = yamljs.parse(yamlContent);
		}
		catch (e) {
			return callback({"code": 851, "msg": e.message});
		}
		
		try {
			swagger.validateYaml(jsonAPISchema);
		}
		catch (e) {
			return callback({"code": 173, "msg": e.message});
		}
		
		context.yaml = jsonAPISchema;
		
		swagger.mapAPis(jsonAPISchema, function (response) {
			context.soajs.config.schema = response.schema;
			context.soajs.config.errors = response.errors;
			
			var myValidator = new Validator();
			var check = myValidator.validate(context.soajs.config, schema);
			if (check.valid) {
				return callback(null, true);
			}
			else {
				var errMsgs = [];
				check.errors.forEach(function (oneError) {
					errMsgs.push(oneError.stack);
				});
				return callback({"code": 172, "msg": new Error(errMsgs.join(" - ")).message});
			}
		});
	}
function ( yamlContent , context , callback ) { var jsonAPISchema ; try { jsonAPISchema = yamljs . parse ( yamlContent ) ; } catch ( e ) { return callback ( { "code" : 851 , "msg" : e . message } ) ; } try { swagger . validateYaml ( jsonAPISchema ) ; } catch ( e ) { return callback ( { "code" : 173 , "msg" : e . message } ) ; } context . yaml = jsonAPISchema ; swagger . mapAPis ( jsonAPISchema , function ( response ) { context . soajs . config . schema = response . schema ; context . soajs . config . errors = response . errors ; var myValidator = new Validator ( ) ; var check = myValidator . validate ( context . soajs . config , schema ) ; if ( check . valid ) { return callback ( null , true ) ; } else { var errMsgs = [ ] ; check . errors . forEach ( function ( oneError ) { errMsgs . push ( oneError . stack ) ; } ) ; return callback ( { "code" : 172 , "msg" : new Error ( errMsgs . join ( " - " ) ) . message } ) ; } } ) ; }
parse the yaml and generate a config.js content from it
@param cb
@returns {*}
parse the yaml and generate a config . js content from it