Package io.swagger.codegen.languages
Class AbstractScalaCodegen
- java.lang.Object
-
- io.swagger.codegen.DefaultCodegen
-
- io.swagger.codegen.languages.AbstractScalaCodegen
-
- Direct Known Subclasses:
AkkaScalaClientCodegen
,ScalaClientCodegen
,ScalaLagomServerCodegen
,ScalatraServerCodegen
,ScalazClientCodegen
public abstract class AbstractScalaCodegen extends DefaultCodegen
-
-
Field Summary
Fields Modifier and Type Field Description protected String
invokerPackage
protected String
modelPropertyNaming
protected String
sourceFolder
protected boolean
stripPackageName
-
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 AbstractScalaCodegen()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
apiFileFolder()
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 injectionprotected String
formatIdentifier(String name, boolean capitalized)
String
getSourceFolder()
String
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 propertyString
modelFileFolder()
Map<String,Object>
postProcessModels(Map<String,Object> objs)
com.samskivert.mustache.Mustache.Compiler
processCompiler(com.samskivert.mustache.Mustache.Compiler compiler)
void
processOpts()
void
setSourceFolder(String sourceFolder)
protected String
stripPackageName(String input)
String
toDefaultValue(io.swagger.models.properties.Property p)
Return the default value of the propertyString
toInstantiationType(io.swagger.models.properties.Property p)
Return the instantiation type of the property, especially for map and arrayString
toModelFilename(String name)
Return the capitalized file name of the model-
Methods inherited from class io.swagger.codegen.DefaultCodegen
addAdditionPropertiesToCodeGenModel, addImport, additionalProperties, addOperationToGroup, addOption, addOption, addParentContainer, addProperties, addRegularExpressionDelimiter, addSwitch, apiDocFileFolder, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, buildLibraryCliOption, camelize, camelize, cliOptions, configureDataForTestTemplate, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, dashize, defaultIgnoreImportMappingOption, defaultIncludes, embeddedTemplateDir, ensureUniqueName, escapeText, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fixUpParentAndInterfaces, fromModel, 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, modelFilename, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, needToImport, outputFolder, postProcessAllModels, postProcessModelProperties, postProcessModelProperty, postProcessModelsEnum, postProcessOperations, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessSwagger, 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, toApiDocFilename, toApiFilename, toApiImport, toApiName, toApiTestFilename, toApiVarName, toBooleanGetter, toDefaultValueWithParam, toEnumDefaultValue, toEnumName, toEnumValue, toEnumVarName, toExamples, toExampleValue, toGetter, toModelDocFilename, toModelImport, toModelName, toModelTestFilename, toOperationId, toParamName, toRegularExpression, toSetter, toVarName, typeMapping, underscore, updateCodegenPropertyEnum, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updatePropertyForArray, updatePropertyForMap, vendorExtensions, writeOptional, writePropertyBack
-
-
-
-
Method Detail
-
processOpts
public void processOpts()
- Overrides:
processOpts
in classDefaultCodegen
-
setSourceFolder
public void setSourceFolder(String sourceFolder)
-
getSourceFolder
public String getSourceFolder()
-
escapeReservedWord
public String escapeReservedWord(String name)
Description copied from class:DefaultCodegen
Return the escaped name of the reserved word- 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)
-
processCompiler
public com.samskivert.mustache.Mustache.Compiler processCompiler(com.samskivert.mustache.Mustache.Compiler compiler)
- Overrides:
processCompiler
in classDefaultCodegen
-
apiFileFolder
public String apiFileFolder()
- Overrides:
apiFileFolder
in classDefaultCodegen
-
modelFileFolder
public String modelFileFolder()
- Overrides:
modelFileFolder
in classDefaultCodegen
-
getTypeDeclaration
public String getTypeDeclaration(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegen
Output the type declaration of the property- 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
-
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
-
toDefaultValue
public String toDefaultValue(io.swagger.models.properties.Property p)
Description copied from class:DefaultCodegen
Return the default value of the property- Overrides:
toDefaultValue
in classDefaultCodegen
- Parameters:
p
- Swagger property object- Returns:
- string presentation of the default value of the property
-
postProcessModels
public Map<String,Object> postProcessModels(Map<String,Object> objs)
- Overrides:
postProcessModels
in classDefaultCodegen
-
toModelFilename
public String toModelFilename(String name)
Description copied from class:DefaultCodegen
Return the capitalized file name of the model- Overrides:
toModelFilename
in classDefaultCodegen
- Parameters:
name
- the model name- Returns:
- the file name of the model
-
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- Overrides:
escapeUnsafeCharacters
in classDefaultCodegen
- Parameters:
input
- String to be cleaned up- Returns:
- string with unsafe characters removed or escaped
-
escapeQuotationMark
public String escapeQuotationMark(String input)
Description copied from class:DefaultCodegen
Escape single and/or double quote to avoid code injection- Overrides:
escapeQuotationMark
in classDefaultCodegen
- Parameters:
input
- String to be cleaned up- Returns:
- string with quotation mark removed or escaped
-
-