Class DefaultCodegen

    • Field Detail

      • LOGGER

        protected static final org.slf4j.Logger LOGGER
      • inputSpec

        protected String inputSpec
      • outputFolder

        protected String outputFolder
      • defaultIncludes

        protected Set<String> defaultIncludes
      • reservedWords

        protected Set<String> reservedWords
      • languageSpecificPrimitives

        protected Set<String> languageSpecificPrimitives
      • modelPackage

        protected String modelPackage
      • apiPackage

        protected String apiPackage
      • fileSuffix

        protected String fileSuffix
      • modelNamePrefix

        protected String modelNamePrefix
      • modelNameSuffix

        protected String modelNameSuffix
      • testPackage

        protected String testPackage
      • apiTestTemplateFiles

        protected Map<String,​String> apiTestTemplateFiles
      • modelTestTemplateFiles

        protected Map<String,​String> modelTestTemplateFiles
      • modelDocTemplateFiles

        protected Map<String,​String> modelDocTemplateFiles
      • reservedWordsMappings

        protected Map<String,​String> reservedWordsMappings
      • templateDir

        protected String templateDir
      • embeddedTemplateDir

        protected String embeddedTemplateDir
      • commonTemplateDir

        protected String commonTemplateDir
      • additionalProperties

        protected Map<String,​Object> additionalProperties
      • skipOverwrite

        protected boolean skipOverwrite
      • removeOperationIdPrefix

        protected boolean removeOperationIdPrefix
      • supportsInheritance

        protected boolean supportsInheritance
      • supportsMixins

        protected boolean supportsMixins
      • library

        protected String library
      • sortParamsByRequiredFlag

        protected Boolean sortParamsByRequiredFlag
      • ensureUniqueParams

        protected Boolean ensureUniqueParams
      • allowUnicodeIdentifiers

        protected Boolean allowUnicodeIdentifiers
      • gitUserId

        protected String gitUserId
      • gitRepoId

        protected String gitRepoId
      • releaseNote

        protected String releaseNote
      • gitRepoBaseURL

        protected String gitRepoBaseURL
      • httpUserAgent

        protected String httpUserAgent
      • hideGenerationTimestamp

        protected Boolean hideGenerationTimestamp
      • skipAliasGeneration

        protected Boolean skipAliasGeneration
      • ignoreImportMapping

        protected boolean ignoreImportMapping
      • specialCharReplacements

        protected Map<String,​String> specialCharReplacements
      • ignoreFilePathOverride

        protected String ignoreFilePathOverride
    • Constructor Detail

      • DefaultCodegen

        public DefaultCodegen()
        Default constructor. This method will map between Swagger type and language-specified type, as well as mapping between Swagger type and the corresponding import statement for the language. This will also add some language specified CLI options, if any. returns string presentation of the example path (it's a constructor)
    • Method Detail

      • processOpts

        public void processOpts()
      • fixUpParentAndInterfaces

        protected void fixUpParentAndInterfaces​(CodegenModel codegenModel,
                                                Map<String,​CodegenModel> allModels)
        Fix up all parent and interface CodegenModel references.
        Parameters:
        allModels -
      • postProcessModelsEnum

        public Map<String,​Object> postProcessModelsEnum​(Map<String,​Object> objs)
        post process enum defined in model's properties
        Parameters:
        objs - Map of models
        Returns:
        maps of models with better enum support
      • findCommonPrefixOfVars

        public String findCommonPrefixOfVars​(List<Object> vars)
        Returns the common prefix of variables for enum naming if two or more variables are present.
        Parameters:
        vars - List of variable names
        Returns:
        the common prefix for naming
      • ensureUniqueName

        protected String ensureUniqueName​(Map<String,​Integer> uniqueNames,
                                          String name)
        If necessary, appends a suffix to enforce uniqueness of names within a namespace.
        Parameters:
        uniqueNames - Counts name occurrences within a namespace.
        name - The proposed name.
        Returns:
        name, uniquely suffixed as necessary.
      • toEnumDefaultValue

        public String toEnumDefaultValue​(String value,
                                         String datatype)
        Return the enum default value in the language specified format
        Parameters:
        value - enum variable name
        datatype - data type
        Returns:
        the default value for the enum
      • toEnumValue

        public String toEnumValue​(String value,
                                  String datatype)
        Return the enum value in the language specified format e.g. status becomes "status"
        Parameters:
        value - enum variable name
        datatype - data type
        Returns:
        the sanitized value for enum
      • toEnumVarName

        public String toEnumVarName​(String value,
                                    String datatype)
        Return the sanitized variable name for enum
        Parameters:
        value - enum variable name
        datatype - data type
        Returns:
        the sanitized variable name for enum
      • isPrimivite

        public boolean isPrimivite​(String datatype)
      • postProcessModelProperties

        public void postProcessModelProperties​(CodegenModel model)
      • postProcessParameter

        public void postProcessParameter​(CodegenParameter parameter)
      • preprocessSwagger

        public void preprocessSwagger​(io.swagger.models.Swagger swagger)
      • processSwagger

        public void processSwagger​(io.swagger.models.Swagger swagger)
      • processCompiler

        public com.samskivert.mustache.Mustache.Compiler processCompiler​(com.samskivert.mustache.Mustache.Compiler compiler)
      • escapeUnsafeCharacters

        public String escapeUnsafeCharacters​(String input)
        override with any special text escaping logic to handle unsafe characters so as to avoid code injection
        Parameters:
        input - String to be cleaned up
        Returns:
        string with unsafe characters removed or escaped
      • escapeQuotationMark

        public String escapeQuotationMark​(String input)
        Escape single and/or double quote to avoid code injection
        Parameters:
        input - String to be cleaned up
        Returns:
        string with quotation mark removed or escaped
      • defaultIncludes

        public Set<String> defaultIncludes()
      • reservedWords

        public Set<String> reservedWords()
      • languageSpecificPrimitives

        public Set<String> languageSpecificPrimitives()
      • testPackage

        public String testPackage()
      • modelPackage

        public String modelPackage()
      • apiPackage

        public String apiPackage()
      • fileSuffix

        public String fileSuffix()
      • templateDir

        public String templateDir()
      • embeddedTemplateDir

        public String embeddedTemplateDir()
      • getCommonTemplateDir

        public String getCommonTemplateDir()
      • setCommonTemplateDir

        public void setCommonTemplateDir​(String commonTemplateDir)
      • modelDocTemplateFiles

        public Map<String,​String> modelDocTemplateFiles()
      • reservedWordsMappings

        public Map<String,​String> reservedWordsMappings()
      • apiTestTemplateFiles

        public Map<String,​String> apiTestTemplateFiles()
      • modelTestTemplateFiles

        public Map<String,​String> modelTestTemplateFiles()
      • apiFileFolder

        public String apiFileFolder()
      • modelFileFolder

        public String modelFileFolder()
      • apiTestFileFolder

        public String apiTestFileFolder()
      • modelTestFileFolder

        public String modelTestFileFolder()
      • apiDocFileFolder

        public String apiDocFileFolder()
      • modelDocFileFolder

        public String modelDocFileFolder()
      • additionalProperties

        public Map<String,​Object> additionalProperties()
      • outputFolder

        public String outputFolder()
      • setOutputDir

        public void setOutputDir​(String dir)
      • getOutputDir

        public String getOutputDir()
      • getInputSpec

        public String getInputSpec()
      • setInputSpec

        public void setInputSpec​(String inputSpec)
      • setTemplateDir

        public void setTemplateDir​(String templateDir)
      • setModelPackage

        public void setModelPackage​(String modelPackage)
      • setModelNamePrefix

        public void setModelNamePrefix​(String modelNamePrefix)
      • setModelNameSuffix

        public void setModelNameSuffix​(String modelNameSuffix)
      • setApiPackage

        public void setApiPackage​(String apiPackage)
      • setSortParamsByRequiredFlag

        public void setSortParamsByRequiredFlag​(Boolean sortParamsByRequiredFlag)
      • setEnsureUniqueParams

        public void setEnsureUniqueParams​(Boolean ensureUniqueParams)
      • setAllowUnicodeIdentifiers

        public void setAllowUnicodeIdentifiers​(Boolean allowUnicodeIdentifiers)
      • toRegularExpression

        public String toRegularExpression​(String pattern)
        Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)
        Parameters:
        pattern - the pattern (regular expression)
        Returns:
        properly-escaped pattern
      • toApiFilename

        public String toApiFilename​(String name)
        Return the file name of the Api Test
        Parameters:
        name - the file name of the Api
        Returns:
        the file name of the Api
      • toApiDocFilename

        public String toApiDocFilename​(String name)
        Return the file name of the Api Documentation
        Parameters:
        name - the file name of the Api
        Returns:
        the file name of the Api
      • toApiTestFilename

        public String toApiTestFilename​(String name)
        Return the file name of the Api Test
        Parameters:
        name - the file name of the Api
        Returns:
        the file name of the Api
      • toApiVarName

        public String toApiVarName​(String name)
        Return the variable name in the Api
        Parameters:
        name - the varible name of the Api
        Returns:
        the snake-cased variable name
      • toModelFilename

        public String toModelFilename​(String name)
        Return the capitalized file name of the model
        Parameters:
        name - the model name
        Returns:
        the file name of the model
      • toModelTestFilename

        public String toModelTestFilename​(String name)
        Return the capitalized file name of the model test
        Parameters:
        name - the model name
        Returns:
        the file name of the model
      • toModelDocFilename

        public String toModelDocFilename​(String name)
        Return the capitalized file name of the model documentation
        Parameters:
        name - the model name
        Returns:
        the file name of the model
      • toOperationId

        public String toOperationId​(String operationId)
        Return the operation ID (method name)
        Parameters:
        operationId - operation ID
        Returns:
        the sanitized method name
      • toVarName

        public String toVarName​(String name)
        Return the variable name by removing invalid characters and proper escaping if it's a reserved word.
        Parameters:
        name - the variable name
        Returns:
        the sanitized variable name
      • toParamName

        public String toParamName​(String name)
        Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.
        Parameters:
        name - Codegen property object
        Returns:
        the sanitized parameter name
      • toEnumName

        public String toEnumName​(CodegenProperty property)
        Return the Enum name (e.g. StatusEnum given 'status')
        Parameters:
        property - Codegen property
        Returns:
        the Enum name
      • escapeReservedWord

        public String escapeReservedWord​(String name)
        Return the escaped name of the reserved word
        Parameters:
        name - the name to be escaped
        Returns:
        the escaped reserved word throws Runtime exception as reserved word is not allowed (default behavior)
      • toModelImport

        public String toModelImport​(String name)
        Return the fully-qualified "Model" name for import
        Parameters:
        name - the name of the "Model"
        Returns:
        the fully-qualified "Model" name for import
      • toApiImport

        public String toApiImport​(String name)
        Return the fully-qualified "Api" name for import
        Parameters:
        name - the name of the "Api"
        Returns:
        the fully-qualified "Api" name for import
      • initalizeSpecialCharacterMapping

        protected void initalizeSpecialCharacterMapping()
        Initialize special character mapping
      • getSymbolName

        protected String getSymbolName​(String input)
        Return the symbol name of a symbol
        Parameters:
        input - Symbol (e.g. $)
        Returns:
        Symbol name (e.g. Dollar)
      • generateExamplePath

        public String generateExamplePath​(String path,
                                          io.swagger.models.Operation operation)
        Return the example path
        Parameters:
        path - the path of the operation
        operation - Swagger operation object
        Returns:
        string presentation of the example path
      • toInstantiationType

        public String toInstantiationType​(io.swagger.models.properties.Property p)
        Return the instantiation type of the property, especially for map and array
        Parameters:
        p - Swagger property object
        Returns:
        string presentation of the instantiation type of the property
      • setParameterExampleValue

        public void setParameterExampleValue​(CodegenParameter p)
        Return the example value of the parameter.
        Parameters:
        p - Swagger property object
      • toExampleValue

        public String toExampleValue​(io.swagger.models.properties.Property p)
        Return the example value of the property
        Parameters:
        p - Swagger property object
        Returns:
        string presentation of the example value of the property
      • toDefaultValue

        public String toDefaultValue​(io.swagger.models.properties.Property p)
        Return the default value of the property
        Parameters:
        p - Swagger property object
        Returns:
        string presentation of the default value of the property
      • toDefaultValueWithParam

        public String toDefaultValueWithParam​(String name,
                                              io.swagger.models.properties.Property p)
        Return the property initialized from a data object Useful for initialization with a plain object in Javascript
        Parameters:
        name - Name of the property object
        p - Swagger property object
        Returns:
        string presentation of the default value of the property
      • getSwaggerType

        public String getSwaggerType​(io.swagger.models.properties.Property p)
        returns the swagger type for the property
        Parameters:
        p - Swagger property object
        Returns:
        string presentation of the type
      • snakeCase

        public String snakeCase​(String name)
        Return the snake-case of the string
        Parameters:
        name - string to be snake-cased
        Returns:
        snake-cased string
      • titleCase

        public static String titleCase​(String input)
        Capitalise first character of string
      • initialCaps

        public String initialCaps​(String name)
        Capitalize the string
        Parameters:
        name - string to be capitalized
        Returns:
        capitalized string
      • getTypeDeclaration

        public String getTypeDeclaration​(String name)
        Output the type declaration of a given name
        Parameters:
        name - name
        Returns:
        a string presentation of the type
      • getTypeDeclaration

        public String getTypeDeclaration​(io.swagger.models.properties.Property p)
        Output the type declaration of the property
        Parameters:
        p - Swagger Property object
        Returns:
        a string presentation of the property type
      • getAlias

        public String getAlias​(String name)
        Determine the type alias for the given type if it exists. This feature is only used for Java, because the language does not have a aliasing mechanism of its own.
        Parameters:
        name - The type name.
        Returns:
        The alias of the given type, if it exists. If there is no alias for this type, then returns the input type name.
      • toBooleanGetter

        public String toBooleanGetter​(String name)
        Output the Getter name for boolean property, e.g. getActive
        Parameters:
        name - the name of the property
        Returns:
        getter name based on naming convention
      • toGetter

        public String toGetter​(String name)
        Output the Getter name, e.g. getSize
        Parameters:
        name - the name of the property
        Returns:
        getter name based on naming convention
      • toSetter

        public String toSetter​(String name)
        Output the Getter name, e.g. getSize
        Parameters:
        name - the name of the property
        Returns:
        setter name based on naming convention
      • toApiName

        public String toApiName​(String name)
        Output the API (class) name (capitalized) ending with "Api" Return DefaultApi if name is empty
        Parameters:
        name - the name of the Api
        Returns:
        capitalized Api name ending with "Api"
      • toModelName

        public String toModelName​(String name)
        Output the proper model name (capitalized). In case the name belongs to the TypeSystem it won't be renamed.
        Parameters:
        name - the name of the model
        Returns:
        capitalized model name
      • fromModel

        public CodegenModel fromModel​(String name,
                                      io.swagger.models.Model model)
        Convert Swagger Model object to Codegen Model object without providing all model definitions
        Parameters:
        name - the name of the model
        model - Swagger Model object
        Returns:
        Codegen Model object
      • fromModel

        public CodegenModel fromModel​(String name,
                                      io.swagger.models.Model model,
                                      Map<String,​io.swagger.models.Model> allDefinitions)
        Convert Swagger Model object to Codegen Model object
        Parameters:
        name - the name of the model
        model - Swagger Model object
        allDefinitions - a map of all Swagger models from the spec
        Returns:
        Codegen Model object
      • addAdditionPropertiesToCodeGenModel

        protected void addAdditionPropertiesToCodeGenModel​(CodegenModel codegenModel,
                                                           io.swagger.models.ModelImpl swaggerModel)
      • addProperties

        protected void addProperties​(Map<String,​io.swagger.models.properties.Property> properties,
                                     List<String> required,
                                     io.swagger.models.Model model,
                                     Map<String,​io.swagger.models.Model> allDefinitions)
      • getterAndSetterCapitalize

        public String getterAndSetterCapitalize​(String name)
        Camelize the method name of the getter and setter
        Parameters:
        name - string to be camelized
        Returns:
        Camelized string
      • fromProperty

        public CodegenProperty fromProperty​(String name,
                                            io.swagger.models.properties.Property p)
        Convert Swagger Property object to Codegen Property object
        Parameters:
        name - name of the property
        p - Swagger property object
        Returns:
        Codegen Property object
      • updatePropertyForArray

        protected void updatePropertyForArray​(CodegenProperty property,
                                              CodegenProperty innerProperty)
        Update property for array(list) container
        Parameters:
        property - Codegen property
        innerProperty - Codegen inner property of map or list
      • updatePropertyForMap

        protected void updatePropertyForMap​(CodegenProperty property,
                                            CodegenProperty innerProperty)
        Update property for map container
        Parameters:
        property - Codegen property
        innerProperty - Codegen inner property of map or list
      • isPropertyInnerMostEnum

        protected Boolean isPropertyInnerMostEnum​(CodegenProperty property)
        Update property for map container
        Parameters:
        property - Codegen property
        Returns:
        True if the inner most type is enum
      • updateDataTypeWithEnumForArray

        protected void updateDataTypeWithEnumForArray​(CodegenProperty property)
        Update datatypeWithEnum for array container
        Parameters:
        property - Codegen property
      • updateDataTypeWithEnumForMap

        protected void updateDataTypeWithEnumForMap​(CodegenProperty property)
        Update datatypeWithEnum for map container
        Parameters:
        property - Codegen property
      • setNonArrayMapProperty

        protected void setNonArrayMapProperty​(CodegenProperty property,
                                              String type)
      • findMethodResponse

        protected io.swagger.models.Response findMethodResponse​(Map<String,​io.swagger.models.Response> responses)
        Override with any special handling of response codes
        Parameters:
        responses - Swagger Operation's responses
        Returns:
        default method response or <tt>null</tt> if not found
      • fromOperation

        public CodegenOperation fromOperation​(String path,
                                              String httpMethod,
                                              io.swagger.models.Operation operation,
                                              Map<String,​io.swagger.models.Model> definitions)
        Convert Swagger Operation object to Codegen Operation object (without providing a Swagger object)
        Parameters:
        path - the path of the operation
        httpMethod - HTTP method
        operation - Swagger operation object
        definitions - a map of Swagger models
        Returns:
        Codegen Operation object
      • fromOperation

        public CodegenOperation fromOperation​(String path,
                                              String httpMethod,
                                              io.swagger.models.Operation operation,
                                              Map<String,​io.swagger.models.Model> definitions,
                                              io.swagger.models.Swagger swagger)
        Convert Swagger Operation object to Codegen Operation object
        Parameters:
        path - the path of the operation
        httpMethod - HTTP method
        operation - Swagger operation object
        definitions - a map of Swagger models
        swagger - a Swagger object representing the spec
        Returns:
        Codegen Operation object
      • fromResponse

        public CodegenResponse fromResponse​(String responseCode,
                                            io.swagger.models.Response response)
        Convert Swagger Response object to Codegen Response object
        Parameters:
        responseCode - HTTP response code
        response - Swagger Response object
        Returns:
        Codegen Response object
      • fromParameter

        public CodegenParameter fromParameter​(io.swagger.models.parameters.Parameter param,
                                              Set<String> imports)
        Convert Swagger Parameter object to Codegen Parameter object
        Parameters:
        param - Swagger parameter object
        imports - set of imports for library/package/module
        Returns:
        Codegen Parameter object
      • getParameterDataType

        protected String getParameterDataType​(io.swagger.models.parameters.Parameter parameter,
                                              io.swagger.models.properties.Property property)
        Returns the data type of a parameter. Returns null by default to use the CodegenProperty.datatype value
        Parameters:
        parameter -
        property -
        Returns:
      • isDataTypeBinary

        public boolean isDataTypeBinary​(String dataType)
      • isDataTypeFile

        public boolean isDataTypeFile​(String dataType)
      • readRefModelParameter

        protected void readRefModelParameter​(io.swagger.models.RefModel refModel,
                                             CodegenParameter codegenParameter,
                                             Set<String> imports)
      • fromSecurity

        public List<CodegenSecurity> fromSecurity​(Map<String,​io.swagger.models.auth.SecuritySchemeDefinition> schemes)
        Convert map of Swagger SecuritySchemeDefinition objects to a list of Codegen Security objects
        Parameters:
        schemes - a map of Swagger SecuritySchemeDefinition object
        Returns:
        a list of Codegen Security objects
      • setReservedWordsLowerCase

        protected void setReservedWordsLowerCase​(List<String> words)
      • isReservedWord

        protected boolean isReservedWord​(String word)
      • getOrGenerateOperationId

        protected String getOrGenerateOperationId​(io.swagger.models.Operation operation,
                                                  String path,
                                                  String httpMethod)
        Get operationId from the operation object, and if it's blank, generate a new one from the given parameters.
        Parameters:
        operation - the operation object
        path - the path of the operation
        httpMethod - the HTTP method of the operation
        Returns:
        the (generated) operationId
      • needToImport

        protected boolean needToImport​(String type)
        Check the type to see if it needs import the library/module/package
        Parameters:
        type - name of the type
        Returns:
        true if the library/module/package of the corresponding type needs to be imported
      • addOperationToGroup

        public void addOperationToGroup​(String tag,
                                        String resourcePath,
                                        io.swagger.models.Operation operation,
                                        CodegenOperation co,
                                        Map<String,​List<CodegenOperation>> operations)
        Add operation to group
        Parameters:
        tag - name of the tag
        resourcePath - path of the resource
        operation - Swagger Operation object
        co - Codegen Operation object
        operations - map of Codegen operations
      • addParentContainer

        protected void addParentContainer​(CodegenModel m,
                                          String name,
                                          io.swagger.models.properties.Property property)
      • underscore

        public static String underscore​(String word)
        Underscore the given word. Copied from Twitter elephant bird https://github.com/twitter/elephant-bird/blob/master/core/src/main/java/com/twitter/elephantbird/util/Strings.java
        Parameters:
        word - The word
        Returns:
        The underscored version of the word
      • dashize

        protected String dashize​(String word)
        Dashize the given word.
        Parameters:
        word - The word
        Returns:
        The dashized version of the word, e.g. "my-name"
      • getAllAliases

        protected Map<String,​String> getAllAliases​(Map<String,​io.swagger.models.Model> allDefinitions)
        Determine all of the types in the model definitions that are aliases of simple types.
        Parameters:
        allDefinitions - The complete set of model definitions.
        Returns:
        A mapping from model name to type alias
      • removeNonNameElementToCamelCase

        public String removeNonNameElementToCamelCase​(String name)
        Remove characters not suitable for variable or method name from the input and camelize it
        Parameters:
        name - string to be camelize
        Returns:
        camelized string
      • removeNonNameElementToCamelCase

        protected String removeNonNameElementToCamelCase​(String name,
                                                         String nonNameElementPattern)
        Remove characters that is not good to be included in method name from the input and camelize it
        Parameters:
        name - string to be camelize
        nonNameElementPattern - a regex pattern of the characters that is not good to be included in name
        Returns:
        camelized string
      • camelize

        public static String camelize​(String word)
        Camelize name (parameter, property, method, etc) with upper case for first letter copied from Twitter elephant bird https://github.com/twitter/elephant-bird/blob/master/core/src/main/java/com/twitter/elephantbird/util/Strings.java
        Parameters:
        word - string to be camelize
        Returns:
        camelized string
      • camelize

        public static String camelize​(String word,
                                      boolean lowercaseFirstLetter)
        Camelize name (parameter, property, method, etc)
        Parameters:
        word - string to be camelize
        lowercaseFirstLetter - lower case for first letter if set to true
        Returns:
        camelized string
      • apiDocFilename

        public String apiDocFilename​(String templateName,
                                     String tag)
        Return the full path and API documentation file
        Parameters:
        templateName - template name
        tag - tag
        Returns:
        the API documentation file name with full path
      • apiTestFilename

        public String apiTestFilename​(String templateName,
                                      String tag)
        Return the full path and API test file
        Parameters:
        templateName - template name
        tag - tag
        Returns:
        the API test file name with full path
      • shouldOverwrite

        public boolean shouldOverwrite​(String filename)
      • isSkipOverwrite

        public boolean isSkipOverwrite()
      • setSkipOverwrite

        public void setSkipOverwrite​(boolean skipOverwrite)
      • setSkipAliasGeneration

        public void setSkipAliasGeneration​(Boolean skipAliasGeneration)
      • getSkipAliasGeneration

        public Boolean getSkipAliasGeneration()
      • isRemoveOperationIdPrefix

        public boolean isRemoveOperationIdPrefix()
      • setRemoveOperationIdPrefix

        public void setRemoveOperationIdPrefix​(boolean removeOperationIdPrefix)
      • isHideGenerationTimestamp

        public boolean isHideGenerationTimestamp()
      • setHideGenerationTimestamp

        public void setHideGenerationTimestamp​(boolean hideGenerationTimestamp)
      • supportedLibraries

        public Map<String,​String> supportedLibraries()
        All library templates supported. (key: library name, value: library description)
        Returns:
        the supported libraries
      • setLibrary

        public void setLibrary​(String library)
        Set library template (sub-template).
        Parameters:
        library - Library template
      • getLibrary

        public String getLibrary()
        Library template (sub-template).
        Returns:
        Library template
      • setGitUserId

        public void setGitUserId​(String gitUserId)
        Set Git user ID.
        Parameters:
        gitUserId - Git user ID
      • getGitUserId

        public String getGitUserId()
        Git user ID
        Returns:
        Git user ID
      • setGitRepoId

        public void setGitRepoId​(String gitRepoId)
        Set Git repo ID.
        Parameters:
        gitRepoId - Git repo ID
      • getGitRepoId

        public String getGitRepoId()
        Git repo ID
        Returns:
        Git repo ID
      • setGitRepoBaseURL

        public void setGitRepoBaseURL​(String gitRepoBaseURL)
        Set Git repo Base URL.
        Parameters:
        gitRepoBaseURL - Git repo ID
      • getGitRepoBaseURL

        public String getGitRepoBaseURL()
        Git repo Base URL
        Returns:
        Git Base URL
      • setReleaseNote

        public void setReleaseNote​(String releaseNote)
        Set release note.
        Parameters:
        releaseNote - Release note
      • getReleaseNote

        public String getReleaseNote()
        Release note
        Returns:
        Release note
      • setHttpUserAgent

        public void setHttpUserAgent​(String httpUserAgent)
        Set HTTP user agent.
        Parameters:
        httpUserAgent - HTTP user agent
      • getHttpUserAgent

        public String getHttpUserAgent()
        HTTP user agent
        Returns:
        HTTP user agent
      • sanitizeName

        public String sanitizeName​(String name)
        Sanitize name (parameter, property, method, etc)
        Parameters:
        name - string to be sanitize
        Returns:
        sanitized string
      • sanitizeTag

        public String sanitizeTag​(String tag)
        Sanitize tag
        Parameters:
        tag - Tag
        Returns:
        Sanitized tag
      • writeOptional

        public void writeOptional​(String outputFolder,
                                  SupportingFile supportingFile)
        Only write if the file doesn't exist
        Parameters:
        outputFolder - Output folder
        supportingFile - Supporting file
      • setParameterBooleanFlagWithCodegenProperty

        public void setParameterBooleanFlagWithCodegenProperty​(CodegenParameter parameter,
                                                               CodegenProperty property)
        Set CodegenParameter boolean flag using CodegenProperty.
        Parameters:
        parameter - Codegen Parameter
        property - Codegen property
      • updateCodegenPropertyEnum

        public void updateCodegenPropertyEnum​(CodegenProperty var)
        Update codegen property's enum by adding "enumVars" (with name and value)
        Parameters:
        var - list of CodegenProperty
      • addRegularExpressionDelimiter

        public String addRegularExpressionDelimiter​(String pattern)
        If the pattern misses the delimiter, add "/" to the beginning and end Otherwise, return the original pattern
        Parameters:
        pattern - the pattern (regular expression)
        Returns:
        the pattern with delimiter
      • convertPropertyToBooleanAndWriteBack

        public boolean convertPropertyToBooleanAndWriteBack​(String propertyKey)
        reads propertyKey from additionalProperties, converts it to a boolean and writes it back to additionalProperties to be usable as a boolean in mustache files.
        Parameters:
        propertyKey - property key
        Returns:
        property value as boolean
      • getIgnoreFilePathOverride

        public String getIgnoreFilePathOverride()
        Provides an override location, if any is specified, for the .swagger-codegen-ignore. This is originally intended for the first generation only.
        Returns:
        a string of the full path to an override ignore file.
      • setIgnoreFilePathOverride

        public void setIgnoreFilePathOverride​(String ignoreFileOverride)
        Sets an override location for the .swagger-codegen.ignore location for the first code generation.
        Parameters:
        ignoreFileOverride - The full path to an ignore file
      • convertPropertyToBoolean

        public boolean convertPropertyToBoolean​(String propertyKey)
      • writePropertyBack

        public void writePropertyBack​(String propertyKey,
                                      boolean value)
      • addOption

        protected void addOption​(String key,
                                 String description)
      • addOption

        protected void addOption​(String key,
                                 String description,
                                 String defaultValue)
      • addSwitch

        protected void addSwitch​(String key,
                                 String description,
                                 Boolean defaultValue)
      • configureDataForTestTemplate

        protected void configureDataForTestTemplate​(CodegenOperation codegenOperation)
      • getIgnoreImportMapping

        public boolean getIgnoreImportMapping()
      • setIgnoreImportMapping

        public void setIgnoreImportMapping​(boolean ignoreImportMapping)
      • defaultIgnoreImportMappingOption

        public boolean defaultIgnoreImportMappingOption()
      • isModelObject

        protected boolean isModelObject​(io.swagger.models.ModelImpl model)
      • isUsingFlattenSpec

        public boolean isUsingFlattenSpec()