Package io.swagger.codegen.languages
Class AbstractEiffelCodegen
- java.lang.Object
-
- io.swagger.codegen.DefaultCodegen
-
- io.swagger.codegen.languages.AbstractEiffelCodegen
-
- All Implemented Interfaces:
CodegenConfig
- Direct Known Subclasses:
EiffelClientCodegen
public abstract class AbstractEiffelCodegen extends DefaultCodegen implements CodegenConfig
-
-
Field Summary
-
Fields inherited from class io.swagger.codegen.DefaultCodegen
additionalProperties, allowUnicodeIdentifiers, apiDocTemplateFiles, apiPackage, apiTemplateFiles, apiTestTemplateFiles, cliOptions, commonTemplateDir, defaultIncludes, embeddedTemplateDir, ensureUniqueParams, fileSuffix, gitRepoBaseURL, gitRepoId, gitUserId, hideGenerationTimestamp, httpUserAgent, ignoreFilePathOverride, ignoreImportMapping, importMapping, inputSpec, instantiationTypes, languageSpecificPrimitives, library, LOGGER, modelDocTemplateFiles, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, outputFolder, releaseNote, removeOperationIdPrefix, reservedWords, reservedWordsMappings, skipAliasGeneration, skipOverwrite, sortParamsByRequiredFlag, specialCharReplacements, supportedLibraries, supportingFiles, supportsInheritance, supportsMixins, templateDir, testPackage, typeAliases, typeMapping, vendorExtensions
-
-
Constructor Summary
Constructors Constructor Description AbstractEiffelCodegen()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
createMapping(String key, String value)
String
escapeQuotationMark(String input)
Escape single and/or double quote to avoid code injectionString
escapeReservedWord(String name)
Return the escaped name of the reserved wordString
escapeUnsafeCharacters(String input)
override with any special text escaping logic to handle unsafe characters so as to avoid code injectionCodegenModel
fromModel(String name, io.swagger.models.Model model, Map<String,io.swagger.models.Model> allDefinitions)
Convert Swagger Model object to Codegen Model objectString
getSwaggerType(io.swagger.models.properties.Property p)
returns the swagger type for the propertyString
getTypeDeclaration(io.swagger.models.properties.Property p)
Output the type declaration of the propertyprotected boolean
needToImport(String type)
Check the type to see if it needs import the library/module/packageMap<String,Object>
postProcessAllModels(Map<String,Object> models)
void
postProcessModelProperty(CodegenModel model, CodegenProperty property)
Map<String,Object>
postProcessModels(Map<String,Object> objs)
Map<String,Object>
postProcessOperations(Map<String,Object> objs)
void
postProcessParameter(CodegenParameter parameter)
Overrides postProcessParameter to add a vendor extension "x-exportParamName".String
toApiDocFilename(String name)
Return the file name of the Api DocumentationString
toApiFilename(String name)
Return the file name of the Api TestString
toApiName(String name)
Output the API (class) name (capitalized) ending with "Api" Return DefaultApi if name is emptyString
toApiTestFilename(String name)
Return the file name of the Api TestString
toEiffelFeatureStyle(String operationId)
String
toInstantiationType(io.swagger.models.properties.Property p)
Return the instantiation type of the property, especially for map and arrayString
toModelDocFilename(String name)
Return the capitalized file name of the model documentationString
toModelFilename(String name)
Return the capitalized file name of the modelString
toModelName(String name)
Output the proper model name (capitalized).String
toOperationId(String operationId)
Return the operation ID (method name)String
toParamName(String name)
Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.String
toVarName(String name)
Return the variable name by removing invalid characters and proper escaping if it's a reserved word.String
unCamelize(String name)
protected void
updatePropertyForArray(CodegenProperty property, CodegenProperty innerProperty)
Update property for array(list) container-
Methods inherited from class io.swagger.codegen.DefaultCodegen
addAdditionPropertiesToCodeGenModel, addImport, additionalProperties, addOperationToGroup, addOption, addOption, addParentContainer, addProperties, addRegularExpressionDelimiter, addSwitch, apiDocFileFolder, apiDocFilename, apiDocTemplateFiles, apiFileFolder, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, buildLibraryCliOption, camelize, camelize, cliOptions, configureDataForTestTemplate, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, dashize, defaultIgnoreImportMappingOption, defaultIncludes, embeddedTemplateDir, ensureUniqueName, escapeText, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fixUpParentAndInterfaces, fromModel, fromOperation, fromOperation, fromParameter, fromProperty, fromResponse, fromSecurity, generateExamplePath, getAlias, getAllAliases, getCommonTemplateDir, getExamples, getGitRepoBaseURL, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getIgnoreImportMapping, getInnerEnumAllowableValues, getInputSpec, getLibrary, getOrGenerateOperationId, getOutputDir, getParameterDataType, getReleaseNote, getSkipAliasGeneration, getSymbolName, getterAndSetterCapitalize, getTypeDeclaration, importMapping, initalizeSpecialCharacterMapping, initialCaps, instantiationTypes, isDataTypeBinary, isDataTypeFile, isHideGenerationTimestamp, isModelObject, isPrimivite, isPropertyInnerMostEnum, isRemoveOperationIdPrefix, isReservedWord, isSkipOverwrite, isUsingFlattenSpec, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelFileFolder, modelFilename, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, outputFolder, postProcessModelProperties, postProcessModelsEnum, postProcessOperationsWithModels, postProcessSupportingFileData, preprocessSwagger, processCompiler, processOpts, processSwagger, readRefModelParameter, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, setAllowUnicodeIdentifiers, setApiPackage, setCommonTemplateDir, setEnsureUniqueParams, setGitRepoBaseURL, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setIgnoreImportMapping, setInputSpec, setLibrary, setModelNamePrefix, setModelNameSuffix, setModelPackage, setNonArrayMapProperty, setOutputDir, setParameterBooleanFlagWithCodegenProperty, setParameterExampleValue, setReleaseNote, setRemoveOperationIdPrefix, setReservedWordsLowerCase, setSkipAliasGeneration, setSkipOverwrite, setSortParamsByRequiredFlag, setTemplateDir, shouldOverwrite, snakeCase, supportedLibraries, supportingFiles, templateDir, testPackage, titleCase, toApiImport, toApiVarName, toBooleanGetter, toDefaultValue, toDefaultValueWithParam, toEnumDefaultValue, toEnumName, toEnumValue, toEnumVarName, toExamples, toExampleValue, toGetter, toModelImport, toModelTestFilename, toRegularExpression, toSetter, typeMapping, underscore, updateCodegenPropertyEnum, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updatePropertyForMap, vendorExtensions, writeOptional, writePropertyBack
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.swagger.codegen.CodegenConfig
additionalProperties, addOperationToGroup, apiDocFileFolder, apiDocFilename, apiDocTemplateFiles, apiFileFolder, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, cliOptions, defaultIgnoreImportMappingOption, defaultIncludes, embeddedTemplateDir, escapeText, fileSuffix, fromModel, fromOperation, fromOperation, fromSecurity, generateExamplePath, getCommonTemplateDir, getGitRepoBaseURL, getGitRepoId, getGitUserId, getHelp, getHttpUserAgent, getIgnoreFilePathOverride, getIgnoreImportMapping, getInputSpec, getLibrary, getName, getOutputDir, getReleaseNote, getSkipAliasGeneration, getTag, getTypeDeclaration, importMapping, instantiationTypes, isHideGenerationTimestamp, isRemoveOperationIdPrefix, isSkipOverwrite, isUsingFlattenSpec, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelFileFolder, modelFilename, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, outputFolder, postProcessOperationsWithModels, postProcessSupportingFileData, preprocessSwagger, processCompiler, processOpts, processSwagger, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, setGitRepoBaseURL, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setIgnoreImportMapping, setInputSpec, setLibrary, setOutputDir, setReleaseNote, setRemoveOperationIdPrefix, setSkipAliasGeneration, setSkipOverwrite, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, testPackage, toApiImport, toApiVarName, toBooleanGetter, toGetter, toModelImport, toModelTestFilename, toSetter, typeMapping, vendorExtensions
-
-
-
-
Method Detail
-
escapeReservedWord
public String escapeReservedWord(String name)
Description copied from class:DefaultCodegen
Return the escaped name of the reserved word- Specified by:
escapeReservedWord
in interfaceCodegenConfig
- Overrides:
escapeReservedWord
in classDefaultCodegen
- Parameters:
name
- the name to be escaped- Returns:
- the escaped reserved word throws Runtime exception as reserved word is not allowed (default behavior)
-
toVarName
public String toVarName(String name)
Description copied from class:DefaultCodegen
Return the variable name by removing invalid characters and proper escaping if it's a reserved word.- Overrides:
toVarName
in classDefaultCodegen
- Parameters:
name
- the variable name- Returns:
- the sanitized variable name
-
toParamName
public String toParamName(String name)
Description copied from class:DefaultCodegen
Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.- Specified by:
toParamName
in interfaceCodegenConfig
- Overrides:
toParamName
in classDefaultCodegen
- Parameters:
name
- Codegen property object- Returns:
- the sanitized parameter name
-
toModelName
public String toModelName(String name)
Description copied from class:DefaultCodegen
Output the proper model name (capitalized). In case the name belongs to the TypeSystem it won't be renamed.- Specified by:
toModelName
in interfaceCodegenConfig
- Overrides:
toModelName
in classDefaultCodegen
- Parameters:
name
- the name of the model- Returns:
- capitalized model name
-
toModelFilename
public String toModelFilename(String name)
Description copied from class:DefaultCodegen
Return the capitalized file name of the model- Specified by:
toModelFilename
in interfaceCodegenConfig
- Overrides:
toModelFilename
in classDefaultCodegen
- Parameters:
name
- the model name- Returns:
- the file name of the model
-
toApiFilename
public String toApiFilename(String name)
Description copied from class:DefaultCodegen
Return the file name of the Api Test- Specified by:
toApiFilename
in interfaceCodegenConfig
- Overrides:
toApiFilename
in classDefaultCodegen
- Parameters:
name
- the file name of the Api- Returns:
- the file name of the Api
-
toApiTestFilename
public String toApiTestFilename(String name)
Description copied from class:DefaultCodegen
Return the file name of the Api Test- Specified by:
toApiTestFilename
in interfaceCodegenConfig
- Overrides:
toApiTestFilename
in classDefaultCodegen
- Parameters:
name
- the file name of the Api- Returns:
- the file name of the Api
-
toApiName
public String toApiName(String name)
Description copied from class:DefaultCodegen
Output the API (class) name (capitalized) ending with "Api" Return DefaultApi if name is empty- Specified by:
toApiName
in interfaceCodegenConfig
- Overrides:
toApiName
in classDefaultCodegen
- Parameters:
name
- the name of the Api- Returns:
- capitalized Api name ending with "Api"
-
postProcessParameter
public void postProcessParameter(CodegenParameter parameter)
Overrides postProcessParameter to add a vendor extension "x-exportParamName". This is useful when paramName starts with a lowercase letter, but we need that param to be exportable (starts with an Uppercase letter).- Specified by:
postProcessParameter
in interfaceCodegenConfig
- Overrides:
postProcessParameter
in classDefaultCodegen
- Parameters:
parameter
- CodegenParameter object to be processed.
-
postProcessModelProperty
public void postProcessModelProperty(CodegenModel model, CodegenProperty property)
- Specified by:
postProcessModelProperty
in interfaceCodegenConfig
- Overrides:
postProcessModelProperty
in classDefaultCodegen
-
toModelDocFilename
public String toModelDocFilename(String name)
Description copied from class:DefaultCodegen
Return the capitalized file name of the model documentation- Specified by:
toModelDocFilename
in interfaceCodegenConfig
- Overrides:
toModelDocFilename
in classDefaultCodegen
- Parameters:
name
- the model name- Returns:
- the file name of the model
-
toApiDocFilename
public String toApiDocFilename(String name)
Description copied from class:DefaultCodegen
Return the file name of the Api Documentation- Specified by:
toApiDocFilename
in interfaceCodegenConfig
- Overrides:
toApiDocFilename
in classDefaultCodegen
- Parameters:
name
- the file name of the Api- Returns:
- the file name of the Api
-
getTypeDeclaration
public String getTypeDeclaration(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegen
Output the type declaration of the property- Specified by:
getTypeDeclaration
in interfaceCodegenConfig
- Overrides:
getTypeDeclaration
in classDefaultCodegen
- Parameters:
p
- Swagger Property object- Returns:
- a string presentation of the property type
-
getSwaggerType
public String getSwaggerType(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegen
returns the swagger type for the property- Overrides:
getSwaggerType
in classDefaultCodegen
- Parameters:
p
- Swagger property object- Returns:
- string presentation of the type
-
toOperationId
public String toOperationId(String operationId)
Description copied from class:DefaultCodegen
Return the operation ID (method name)- Overrides:
toOperationId
in classDefaultCodegen
- Parameters:
operationId
- operation ID- Returns:
- the sanitized method name
-
postProcessOperations
public Map<String,Object> postProcessOperations(Map<String,Object> objs)
- Specified by:
postProcessOperations
in interfaceCodegenConfig
- Overrides:
postProcessOperations
in classDefaultCodegen
-
postProcessModels
public Map<String,Object> postProcessModels(Map<String,Object> objs)
- Specified by:
postProcessModels
in interfaceCodegenConfig
- Overrides:
postProcessModels
in classDefaultCodegen
-
postProcessAllModels
public Map<String,Object> postProcessAllModels(Map<String,Object> models)
- Specified by:
postProcessAllModels
in interfaceCodegenConfig
- Overrides:
postProcessAllModels
in classDefaultCodegen
-
fromModel
public CodegenModel fromModel(String name, io.swagger.models.Model model, Map<String,io.swagger.models.Model> allDefinitions)
Description copied from class:DefaultCodegen
Convert Swagger Model object to Codegen Model object- Specified by:
fromModel
in interfaceCodegenConfig
- Overrides:
fromModel
in classDefaultCodegen
- Parameters:
name
- the name of the modelmodel
- Swagger Model objectallDefinitions
- a map of all Swagger models from the spec- Returns:
- Codegen Model object
-
needToImport
protected boolean needToImport(String type)
Description copied from class:DefaultCodegen
Check the type to see if it needs import the library/module/package- Overrides:
needToImport
in classDefaultCodegen
- Parameters:
type
- name of the type- Returns:
- true if the library/module/package of the corresponding type needs to be imported
-
escapeQuotationMark
public String escapeQuotationMark(String input)
Description copied from class:DefaultCodegen
Escape single and/or double quote to avoid code injection- Specified by:
escapeQuotationMark
in interfaceCodegenConfig
- Overrides:
escapeQuotationMark
in classDefaultCodegen
- Parameters:
input
- String to be cleaned up- Returns:
- string with quotation mark removed or escaped
-
escapeUnsafeCharacters
public String escapeUnsafeCharacters(String input)
Description copied from class:DefaultCodegen
override with any special text escaping logic to handle unsafe characters so as to avoid code injection- Specified by:
escapeUnsafeCharacters
in interfaceCodegenConfig
- Overrides:
escapeUnsafeCharacters
in classDefaultCodegen
- Parameters:
input
- String to be cleaned up- Returns:
- string with unsafe characters removed or escaped
-
toInstantiationType
public String toInstantiationType(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegen
Return the instantiation type of the property, especially for map and array- Overrides:
toInstantiationType
in classDefaultCodegen
- Parameters:
p
- Swagger property object- Returns:
- string presentation of the instantiation type of the property
-
updatePropertyForArray
protected void updatePropertyForArray(CodegenProperty property, CodegenProperty innerProperty)
Update property for array(list) container- Overrides:
updatePropertyForArray
in classDefaultCodegen
- Parameters:
property
- Codegen propertyinnerProperty
- Codegen inner property of map or list
-
-