command.js
function generateNames(model, prefix, name) {
    if (name === void 0) { name = ""; }
    model.fullPackageName = prefix + (name != "." ? name : "");
    // Copies the settings (I'm lazy)
    model.properties = argv.properties;
    model.explicitRequired = argv.explicitRequired;
    model.camelCaseProperties = argv.camelCaseProperties;
    model.camelCaseGetSet = argv.camelCaseGetSet;
    model.underscoreGetSet = argv.underscoreGetSet;
    model.generateBuilders = argv.generateBuilders;
    var newDefinitions = {};
    // Generate names for messages
    // Recursive call for all messages
    var key;
    for (key in model.messages) {
        var message = model.messages[key];
        newDefinitions[message.name] = "Builder";
        generateNames(message, model.fullPackageName, "." + (model.name ? model.name : ""));
    }
    // Generate names for enums
    for (key in model.enums) {
        var currentEnum = model.enums[key];
        newDefinitions[currentEnum.name] = "";
        currentEnum.fullPackageName = model.fullPackageName + (model.name ? "." + model.name : "");
    }
    // For fields of types which are defined in the same message,
    // update the field type in consequence
    for (key in model.fields) {
        var field = model.fields[key];
        if (typeof newDefinitions[field.type] !== "undefined") {
            field.type = model.name + "." + field.type;
        }
    }
    model.oneofsArray = [];
    for (key in model.oneofs) {
        var oneof = model.oneofs[key];
        model.oneofsArray.push({ name: key, value: oneof });
    }
    // Add the new definitions in the model for generate builders
    var definitions = [];
    for (key in newDefinitions) {
        definitions.push({ name: key, type: ((model.name ? (model.name + ".") : "") + key) + newDefinitions[key] });
    }
    model.definitions = definitions;
}
function generateNames(model, prefix, name) {
    if (name === void 0) { name = ""; }
    model.fullPackageName = prefix + (name != "." ? name : "");
    // Copies the settings (I'm lazy)
    model.properties = argv.properties;
    model.explicitRequired = argv.explicitRequired;
    model.camelCaseProperties = argv.camelCaseProperties;
    model.camelCaseGetSet = argv.camelCaseGetSet;
    model.underscoreGetSet = argv.underscoreGetSet;
    model.generateBuilders = argv.generateBuilders;
    var newDefinitions = {};
    // Generate names for messages
    // Recursive call for all messages
    var key;
    for (key in model.messages) {
        var message = model.messages[key];
        newDefinitions[message.name] = "Builder";
        generateNames(message, model.fullPackageName, "." + (model.name ? model.name : ""));
    }
    // Generate names for enums
    for (key in model.enums) {
        var currentEnum = model.enums[key];
        newDefinitions[currentEnum.name] = "";
        currentEnum.fullPackageName = model.fullPackageName + (model.name ? "." + model.name : "");
    }
    // For fields of types which are defined in the same message,
    // update the field type in consequence
    for (key in model.fields) {
        var field = model.fields[key];
        if (typeof newDefinitions[field.type] !== "undefined") {
            field.type = model.name + "." + field.type;
        }
    }
    model.oneofsArray = [];
    for (key in model.oneofs) {
        var oneof = model.oneofs[key];
        model.oneofsArray.push({ name: key, value: oneof });
    }
    // Add the new definitions in the model for generate builders
    var definitions = [];
    for (key in newDefinitions) {
        definitions.push({ name: key, type: ((model.name ? (model.name + ".") : "") + key) + newDefinitions[key] });
    }
    model.definitions = definitions;
}
function generateNames ( model , prefix , name ) { if ( name === void 0 ) { name = "" ; } model . fullPackageName = prefix + ( name != "." ? name : "" ) ; // Copies the settings (I'm lazy) model . properties = argv . properties ; model . explicitRequired = argv . explicitRequired ; model . camelCaseProperties = argv . camelCaseProperties ; model . camelCaseGetSet = argv . camelCaseGetSet ; model . underscoreGetSet = argv . underscoreGetSet ; model . generateBuilders = argv . generateBuilders ; var newDefinitions = { } ; // Generate names for messages // Recursive call for all messages var key ; for ( key in model . messages ) { var message = model . messages [ key ] ; newDefinitions [ message . name ] = "Builder" ; generateNames ( message , model . fullPackageName , "." + ( model . name ? model . name : "" ) ) ; } // Generate names for enums for ( key in model . enums ) { var currentEnum = model . enums [ key ] ; newDefinitions [ currentEnum . name ] = "" ; currentEnum . fullPackageName = model . fullPackageName + ( model . name ? "." + model . name : "" ) ; } // For fields of types which are defined in the same message, // update the field type in consequence for ( key in model . fields ) { var field = model . fields [ key ] ; if ( typeof newDefinitions [ field . type ] !== "undefined" ) { field . type = model . name + "." + field . type ; } } model . oneofsArray = [ ] ; for ( key in model . oneofs ) { var oneof = model . oneofs [ key ] ; model . oneofsArray . push ( { name : key , value : oneof } ) ; } // Add the new definitions in the model for generate builders var definitions = [ ] ; for ( key in newDefinitions ) { definitions . push ( { name : key , type : ( ( model . name ? ( model . name + "." ) : "" ) + key ) + newDefinitions [ key ] } ) ; } model . definitions = definitions ; }
Generate the names for the model, the types, and the interfaces
Generate the names for the model the types and the interfaces