Package io.swagger.codegen.languages
Class Swift5Codegen
- java.lang.Object
- 
- io.swagger.codegen.DefaultCodegen
- 
- io.swagger.codegen.languages.Swift5Codegen
 
 
- 
- All Implemented Interfaces:
- CodegenConfig
 
 public class Swift5Codegen extends DefaultCodegen implements CodegenConfig 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringDEFAULT_POD_AUTHORSstatic StringLENIENT_TYPE_CASTprotected static StringMODEL_CLASSESstatic StringOBJC_COMPATIBLEstatic StringPOD_AUTHORSstatic StringPOD_DESCRIPTIONstatic StringPOD_DOCSET_URLstatic StringPOD_DOCUMENTATION_URLstatic StringPOD_HOMEPAGEstatic StringPOD_LICENSEstatic StringPOD_SCREENSHOTSstatic StringPOD_SOCIAL_MEDIA_URLstatic StringPOD_SOURCEstatic StringPOD_SUMMARYstatic StringPROJECT_NAMEprotected StringprojectNamestatic StringRESPONSE_ASprotected StringsourceFolderstatic StringSWIFT_USE_API_NAMESPACEprotected booleanswiftUseApiNamespacestatic StringUNWRAP_REQUIRED- 
Fields inherited from class io.swagger.codegen.DefaultCodegenadditionalProperties, 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 SummaryConstructors Constructor Description Swift5Codegen()Constructor for the swift5 language codegen module.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, io.swagger.models.ModelImpl swaggerModel)StringapiFileFolder()StringescapeQuotationMark(String input)Escape single and/or double quote to avoid code injectionStringescapeReservedWord(String name)Return the escaped name of the reserved wordStringescapeUnsafeCharacters(String input)override with any special text escaping logic to handle unsafe characters so as to avoid code injectionCodegenModelfromModel(String name, io.swagger.models.Model model, Map<String,io.swagger.models.Model> allDefinitions)Convert Swagger Model object to Codegen Model objectCodegenOperationfromOperation(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 objectStringgetHelp()StringgetName()StringgetSwaggerType(io.swagger.models.properties.Property prop)returns the swagger type for the propertyCodegenTypegetTag()StringgetTypeDeclaration(io.swagger.models.properties.Property prop)Output the type declaration of the propertybooleanisDataTypeBinary(String dataType)booleanisDataTypeFile(String dataType)protected booleanisReservedWord(String word)StringmodelFileFolder()voidpostProcessModelProperty(CodegenModel model, CodegenProperty property)Map<String,Object>postProcessModels(Map<String,Object> objs)voidprocessOpts()voidsetLenientTypeCast(boolean lenientTypeCast)voidsetObjcCompatible(boolean objcCompatible)voidsetProjectName(String projectName)voidsetResponseAs(String[] responseAs)voidsetSwiftUseApiNamespace(boolean swiftUseApiNamespace)voidsetUnwrapRequired(boolean unwrapRequired)StringtoApiName(String name)Output the API (class) name (capitalized) ending with "Api" Return DefaultApi if name is emptyStringtoDefaultValue(io.swagger.models.properties.Property prop)Return the default value of the propertyStringtoEnumDefaultValue(String value, String datatype)Return the enum default value in the language specified formatStringtoEnumName(CodegenProperty property)Return the Enum name (e.g.StringtoEnumValue(String value, String datatype)Return the enum value in the language specified format e.g.StringtoEnumVarName(String name, String datatype)Return the sanitized variable name for enumStringtoInstantiationType(io.swagger.models.properties.Property prop)Return the instantiation type of the property, especially for map and arrayStringtoModelFilename(String name)Return the capitalized file name of the model.StringtoModelName(String name)Output the proper model name (capitalized).StringtoOperationId(String operationId)Return the operation ID (method name)StringtoParamName(String name)Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.StringtoVarName(String name)Return the variable name by removing invalid characters and proper escaping if it's a reserved word.- 
Methods inherited from class io.swagger.codegen.DefaultCodegenaddImport, 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, 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, isHideGenerationTimestamp, isModelObject, isPrimivite, isPropertyInnerMostEnum, isRemoveOperationIdPrefix, isSkipOverwrite, isUsingFlattenSpec, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelFilename, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, needToImport, outputFolder, postProcessAllModels, postProcessModelProperties, postProcessModelsEnum, postProcessOperations, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessSwagger, processCompiler, 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, toApiTestFilename, toApiVarName, toBooleanGetter, toDefaultValueWithParam, toExamples, toExampleValue, toGetter, toModelDocFilename, toModelImport, toModelTestFilename, toRegularExpression, toSetter, typeMapping, underscore, updateCodegenPropertyEnum, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updatePropertyForArray, updatePropertyForMap, vendorExtensions, writeOptional, writePropertyBack
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface io.swagger.codegen.CodegenConfigadditionalProperties, addOperationToGroup, apiDocFileFolder, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, cliOptions, defaultIgnoreImportMappingOption, defaultIncludes, embeddedTemplateDir, escapeText, fileSuffix, fromModel, fromOperation, fromSecurity, generateExamplePath, getCodeName, getCommonTemplateDir, getGitRepoBaseURL, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getIgnoreImportMapping, getInputSpec, getLibrary, getOutputDir, getPriority, getReleaseNote, getSkipAliasGeneration, getTypeDeclaration, importMapping, instantiationTypes, isHideGenerationTimestamp, isPrivileged, isRemoveOperationIdPrefix, isSkipOverwrite, isUsingFlattenSpec, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelFilename, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, outputFolder, postProcessAllModels, postProcessOperations, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessSwagger, processCompiler, processSwagger, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, setGitRepoBaseURL, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setIgnoreImportMapping, setInputSpec, setLibrary, setOutputDir, setReleaseNote, setRemoveOperationIdPrefix, setSkipAliasGeneration, setSkipOverwrite, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, testPackage, toApiDocFilename, toApiFilename, toApiImport, toApiTestFilename, toApiVarName, toBooleanGetter, toGetter, toModelDocFilename, toModelImport, toModelTestFilename, toSetter, typeMapping, vendorExtensions
 
- 
 
- 
- 
- 
Field Detail- 
PROJECT_NAMEpublic static final String PROJECT_NAME - See Also:
- Constant Field Values
 
 - 
RESPONSE_ASpublic static final String RESPONSE_AS - See Also:
- Constant Field Values
 
 - 
UNWRAP_REQUIREDpublic static final String UNWRAP_REQUIRED - See Also:
- Constant Field Values
 
 - 
OBJC_COMPATIBLEpublic static final String OBJC_COMPATIBLE - See Also:
- Constant Field Values
 
 - 
POD_SOURCEpublic static final String POD_SOURCE - See Also:
- Constant Field Values
 
 - 
POD_AUTHORSpublic static final String POD_AUTHORS - See Also:
- Constant Field Values
 
 - 
POD_SOCIAL_MEDIA_URLpublic static final String POD_SOCIAL_MEDIA_URL - See Also:
- Constant Field Values
 
 - 
POD_DOCSET_URLpublic static final String POD_DOCSET_URL - See Also:
- Constant Field Values
 
 - 
POD_LICENSEpublic static final String POD_LICENSE - See Also:
- Constant Field Values
 
 - 
POD_HOMEPAGEpublic static final String POD_HOMEPAGE - See Also:
- Constant Field Values
 
 - 
POD_SUMMARYpublic static final String POD_SUMMARY - See Also:
- Constant Field Values
 
 - 
POD_DESCRIPTIONpublic static final String POD_DESCRIPTION - See Also:
- Constant Field Values
 
 - 
POD_SCREENSHOTSpublic static final String POD_SCREENSHOTS - See Also:
- Constant Field Values
 
 - 
POD_DOCUMENTATION_URLpublic static final String POD_DOCUMENTATION_URL - See Also:
- Constant Field Values
 
 - 
SWIFT_USE_API_NAMESPACEpublic static final String SWIFT_USE_API_NAMESPACE - See Also:
- Constant Field Values
 
 - 
DEFAULT_POD_AUTHORSpublic static final String DEFAULT_POD_AUTHORS - See Also:
- Constant Field Values
 
 - 
LENIENT_TYPE_CASTpublic static final String LENIENT_TYPE_CAST - See Also:
- Constant Field Values
 
 - 
MODEL_CLASSESprotected static final String MODEL_CLASSES - See Also:
- Constant Field Values
 
 - 
projectNameprotected String projectName 
 - 
swiftUseApiNamespaceprotected boolean swiftUseApiNamespace 
 - 
sourceFolderprotected String sourceFolder 
 
- 
 - 
Method Detail- 
getTagpublic CodegenType getTag() - Specified by:
- getTagin interface- CodegenConfig
 
 - 
getNamepublic String getName() - Specified by:
- getNamein interface- CodegenConfig
 
 - 
getHelppublic String getHelp() - Specified by:
- getHelpin interface- CodegenConfig
 
 - 
addAdditionPropertiesToCodeGenModelprotected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, io.swagger.models.ModelImpl swaggerModel) - Overrides:
- addAdditionPropertiesToCodeGenModelin class- DefaultCodegen
 
 - 
processOptspublic void processOpts() - Specified by:
- processOptsin interface- CodegenConfig
- Overrides:
- processOptsin class- DefaultCodegen
 
 - 
isReservedWordprotected boolean isReservedWord(String word) - Overrides:
- isReservedWordin class- DefaultCodegen
 
 - 
escapeReservedWordpublic String escapeReservedWord(String name) Description copied from class:DefaultCodegenReturn the escaped name of the reserved word- Specified by:
- escapeReservedWordin interface- CodegenConfig
- Overrides:
- escapeReservedWordin class- DefaultCodegen
- Parameters:
- name- the name to be escaped
- Returns:
- the escaped reserved word throws Runtime exception as reserved word is not allowed (default behavior)
 
 - 
modelFileFolderpublic String modelFileFolder() - Specified by:
- modelFileFolderin interface- CodegenConfig
- Overrides:
- modelFileFolderin class- DefaultCodegen
 
 - 
apiFileFolderpublic String apiFileFolder() - Specified by:
- apiFileFolderin interface- CodegenConfig
- Overrides:
- apiFileFolderin class- DefaultCodegen
 
 - 
getTypeDeclarationpublic String getTypeDeclaration(io.swagger.models.properties.Property prop) Description copied from class:DefaultCodegenOutput the type declaration of the property- Specified by:
- getTypeDeclarationin interface- CodegenConfig
- Overrides:
- getTypeDeclarationin class- DefaultCodegen
- Parameters:
- prop- Swagger Property object
- Returns:
- a string presentation of the property type
 
 - 
getSwaggerTypepublic String getSwaggerType(io.swagger.models.properties.Property prop) Description copied from class:DefaultCodegenreturns the swagger type for the property- Overrides:
- getSwaggerTypein class- DefaultCodegen
- Parameters:
- prop- Swagger property object
- Returns:
- string presentation of the type
 
 - 
isDataTypeFilepublic boolean isDataTypeFile(String dataType) - Overrides:
- isDataTypeFilein class- DefaultCodegen
 
 - 
isDataTypeBinarypublic boolean isDataTypeBinary(String dataType) - Overrides:
- isDataTypeBinaryin class- DefaultCodegen
 
 - 
toModelNamepublic String toModelName(String name) Output the proper model name (capitalized).- Specified by:
- toModelNamein interface- CodegenConfig
- Overrides:
- toModelNamein class- DefaultCodegen
- Parameters:
- name- the name of the model
- Returns:
- capitalized model name
 
 - 
toModelFilenamepublic String toModelFilename(String name) Return the capitalized file name of the model.- Specified by:
- toModelFilenamein interface- CodegenConfig
- Overrides:
- toModelFilenamein class- DefaultCodegen
- Parameters:
- name- the model name
- Returns:
- the file name of the model
 
 - 
toDefaultValuepublic String toDefaultValue(io.swagger.models.properties.Property prop) Description copied from class:DefaultCodegenReturn the default value of the property- Overrides:
- toDefaultValuein class- DefaultCodegen
- Parameters:
- prop- Swagger property object
- Returns:
- string presentation of the default value of the property
 
 - 
toInstantiationTypepublic String toInstantiationType(io.swagger.models.properties.Property prop) Description copied from class:DefaultCodegenReturn the instantiation type of the property, especially for map and array- Overrides:
- toInstantiationTypein class- DefaultCodegen
- Parameters:
- prop- Swagger property object
- Returns:
- string presentation of the instantiation type of the property
 
 - 
toApiNamepublic String toApiName(String name) Description copied from class:DefaultCodegenOutput the API (class) name (capitalized) ending with "Api" Return DefaultApi if name is empty- Specified by:
- toApiNamein interface- CodegenConfig
- Overrides:
- toApiNamein class- DefaultCodegen
- Parameters:
- name- the name of the Api
- Returns:
- capitalized Api name ending with "Api"
 
 - 
toOperationIdpublic String toOperationId(String operationId) Description copied from class:DefaultCodegenReturn the operation ID (method name)- Overrides:
- toOperationIdin class- DefaultCodegen
- Parameters:
- operationId- operation ID
- Returns:
- the sanitized method name
 
 - 
toVarNamepublic String toVarName(String name) Description copied from class:DefaultCodegenReturn the variable name by removing invalid characters and proper escaping if it's a reserved word.- Overrides:
- toVarNamein class- DefaultCodegen
- Parameters:
- name- the variable name
- Returns:
- the sanitized variable name
 
 - 
toParamNamepublic String toParamName(String name) Description copied from class:DefaultCodegenReturn the parameter name by removing invalid characters and proper escaping if it's a reserved word.- Specified by:
- toParamNamein interface- CodegenConfig
- Overrides:
- toParamNamein class- DefaultCodegen
- Parameters:
- name- Codegen property object
- Returns:
- the sanitized parameter name
 
 - 
fromModelpublic CodegenModel fromModel(String name, io.swagger.models.Model model, Map<String,io.swagger.models.Model> allDefinitions) Description copied from class:DefaultCodegenConvert Swagger Model object to Codegen Model object- Specified by:
- fromModelin interface- CodegenConfig
- Overrides:
- fromModelin class- DefaultCodegen
- 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
 
 - 
fromOperationpublic CodegenOperation fromOperation(String path, String httpMethod, io.swagger.models.Operation operation, Map<String,io.swagger.models.Model> definitions, io.swagger.models.Swagger swagger) Description copied from class:DefaultCodegenConvert Swagger Operation object to Codegen Operation object- Specified by:
- fromOperationin interface- CodegenConfig
- Overrides:
- fromOperationin class- DefaultCodegen
- 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
 
 - 
setProjectNamepublic void setProjectName(String projectName) 
 - 
setUnwrapRequiredpublic void setUnwrapRequired(boolean unwrapRequired) 
 - 
setObjcCompatiblepublic void setObjcCompatible(boolean objcCompatible) 
 - 
setLenientTypeCastpublic void setLenientTypeCast(boolean lenientTypeCast) 
 - 
setResponseAspublic void setResponseAs(String[] responseAs) 
 - 
setSwiftUseApiNamespacepublic void setSwiftUseApiNamespace(boolean swiftUseApiNamespace) 
 - 
toEnumValuepublic String toEnumValue(String value, String datatype) Description copied from class:DefaultCodegenReturn the enum value in the language specified format e.g. status becomes "status"- Overrides:
- toEnumValuein class- DefaultCodegen
- Parameters:
- value- enum variable name
- datatype- data type
- Returns:
- the sanitized value for enum
 
 - 
toEnumDefaultValuepublic String toEnumDefaultValue(String value, String datatype) Description copied from class:DefaultCodegenReturn the enum default value in the language specified format- Overrides:
- toEnumDefaultValuein class- DefaultCodegen
- Parameters:
- value- enum variable name
- datatype- data type
- Returns:
- the default value for the enum
 
 - 
toEnumVarNamepublic String toEnumVarName(String name, String datatype) Description copied from class:DefaultCodegenReturn the sanitized variable name for enum- Overrides:
- toEnumVarNamein class- DefaultCodegen
- Parameters:
- name- enum variable name
- datatype- data type
- Returns:
- the sanitized variable name for enum
 
 - 
toEnumNamepublic String toEnumName(CodegenProperty property) Description copied from class:DefaultCodegenReturn the Enum name (e.g. StatusEnum given 'status')- Overrides:
- toEnumNamein class- DefaultCodegen
- Parameters:
- property- Codegen property
- Returns:
- the Enum name
 
 - 
postProcessModelspublic Map<String,Object> postProcessModels(Map<String,Object> objs) - Specified by:
- postProcessModelsin interface- CodegenConfig
- Overrides:
- postProcessModelsin class- DefaultCodegen
 
 - 
postProcessModelPropertypublic void postProcessModelProperty(CodegenModel model, CodegenProperty property) - Specified by:
- postProcessModelPropertyin interface- CodegenConfig
- Overrides:
- postProcessModelPropertyin class- DefaultCodegen
 
 - 
escapeQuotationMarkpublic String escapeQuotationMark(String input) Description copied from class:DefaultCodegenEscape single and/or double quote to avoid code injection- Specified by:
- escapeQuotationMarkin interface- CodegenConfig
- Overrides:
- escapeQuotationMarkin class- DefaultCodegen
- Parameters:
- input- String to be cleaned up
- Returns:
- string with quotation mark removed or escaped
 
 - 
escapeUnsafeCharacterspublic String escapeUnsafeCharacters(String input) Description copied from class:DefaultCodegenoverride with any special text escaping logic to handle unsafe characters so as to avoid code injection- Specified by:
- escapeUnsafeCharactersin interface- CodegenConfig
- Overrides:
- escapeUnsafeCharactersin class- DefaultCodegen
- Parameters:
- input- String to be cleaned up
- Returns:
- string with unsafe characters removed or escaped
 
 
- 
 
-