public abstract class AbstractSwiftCodegen extends DefaultCodegenConfig
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_POD_AUTHORS |
static String |
LENIENT_TYPE_CAST |
static String |
OBJC_COMPATIBLE |
static String |
POD_AUTHORS |
static String |
POD_DESCRIPTION |
static String |
POD_DOCSET_URL |
static String |
POD_DOCUMENTATION_URL |
static String |
POD_HOMEPAGE |
static String |
POD_LICENSE |
static String |
POD_SCREENSHOTS |
static String |
POD_SOCIAL_MEDIA_URL |
static String |
POD_SOURCE |
static String |
POD_SUMMARY |
static String |
PROJECT_NAME |
static String |
RESPONSE_AS |
protected static String[] |
RESPONSE_LIBRARIES |
protected String |
sourceFolder |
static String |
SWIFT_USE_API_NAMESPACE |
static String |
UNWRAP_REQUIRED |
additionalProperties, allowUnicodeIdentifiers, apiDocTemplateFiles, apiPackage, apiTemplateFiles, apiTestTemplateFiles, cliOptions, commonTemplateDir, DEFAULT_CONTENT_TYPE, DEFAULT_TEMPLATE_VERSION, defaultIncludes, embeddedTemplateDir, ensureUniqueParams, fileSuffix, gitRepoId, gitUserId, hideGenerationTimestamp, httpUserAgent, ignoreFilePathOverride, importMapping, inputSpec, instantiationTypes, languageArguments, languageSpecificPrimitives, library, modelDocTemplateFiles, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, outputFolder, releaseNote, removeOperationIdPrefix, REQUEST_BODY_NAME, reservedWords, reservedWordsMappings, skipOverwrite, sortParamsByRequiredFlag, specialCharReplacements, supportedLibraries, supportingFiles, supportsInheritance, supportsMixins, templateDir, templateVersion, testPackage, typeAliases, typeMapping, vendorExtensions
Constructor and Description |
---|
AbstractSwiftCodegen() |
Modifier and Type | Method and Description |
---|---|
protected void |
addAdditionPropertiesToCodeGenModel(io.swagger.codegen.CodegenModel codegenModel,
io.swagger.v3.oas.models.media.Schema schema) |
String |
apiFileFolder() |
String |
escapeQuotationMark(String input)
Escape single and/or double quote to avoid code injection
|
String |
escapeReservedWord(String name)
Return the escaped name of the reserved word
|
String |
escapeUnsafeCharacters(String input)
override with any special text escaping logic to handle unsafe
characters so as to avoid code injection
|
io.swagger.codegen.CodegenModel |
fromModel(String name,
io.swagger.v3.oas.models.media.Schema schema,
Map<String,io.swagger.v3.oas.models.media.Schema> allDefinitions)
Convert Swagger Model object to Codegen Model object
|
String |
getArgumentsLocation() |
String |
getHelp() |
String |
getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
returns the swagger type for the property
|
io.swagger.codegen.CodegenType |
getTag() |
String |
getTypeDeclaration(io.swagger.v3.oas.models.media.Schema propertySchema)
Output the type declaration of the property
|
boolean |
isDataTypeBinary(String dataType) |
boolean |
isDataTypeFile(String dataType) |
protected boolean |
isReservedWord(String word) |
String |
modelFileFolder() |
void |
postProcessModelProperty(io.swagger.codegen.CodegenModel model,
io.swagger.codegen.CodegenProperty property) |
void |
processOpts() |
void |
setLenientTypeCast(boolean lenientTypeCast) |
void |
setObjcCompatible(boolean objcCompatible) |
void |
setProjectName(String projectName) |
void |
setResponseAs(String[] responseAs) |
void |
setSwiftUseApiNamespace(boolean swiftUseApiNamespace) |
void |
setUnwrapRequired(boolean unwrapRequired) |
String |
toApiName(String name)
Output the API (class) name (capitalized) ending with "Api"
Return DefaultApi if name is empty
|
String |
toDefaultValue(io.swagger.v3.oas.models.media.Schema schema)
Return the default value of the property
|
String |
toEnumDefaultValue(String value,
String datatype)
Return the enum default value in the language specified format
|
String |
toEnumName(io.swagger.codegen.CodegenProperty property)
Return the Enum name (e.g.
|
String |
toEnumValue(String value,
String datatype)
Return the enum value in the language specified format
e.g.
|
String |
toEnumVarName(String name,
String datatype)
Return the sanitized variable name for enum
|
String |
toInstantiationType(io.swagger.v3.oas.models.media.Schema schema)
Return the instantiation type of the property, especially for map and array
|
String |
toModelFilename(String name)
Return the capitalized file name of the model.
|
String |
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.
|
addConsumesInfo, addHandlebarHelpers, addImport, additionalProperties, addOperationToGroup, addProducesInfo, addProperties, addRegularExpressionDelimiter, apiDocFileFolder, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, buildLibraryCliOption, camelize, camelize, cliOptions, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, dashize, defaultIncludes, detectParent, embeddedTemplateDir, escapeText, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fromModel, fromOperation, fromOperation, fromParameter, fromProperty, fromRequestBody, fromResponse, fromSecurity, generateExamplePath, getAlias, getCollectionFormat, getCommonTemplateDir, getConsumesInfo, getContentType, getGitRepoId, getGitUserId, getHideGenerationTimestamp, getHttpUserAgent, getIgnoreFilePathOverride, getInnerEnumAllowableValues, getInputSpec, getLanguageArguments, getLibrary, getOrGenerateOperationId, getOutputDir, getParameterFromRef, getParentName, getProducesInfo, getReleaseNote, getSchemaFromBody, getSchemaFromResponse, getSimpleRef, getSortParamsByRequiredFlag, getSymbolName, getTemplateVersion, getterAndSetterCapitalize, getTypeDeclaration, importMapping, initialCaps, instantiationTypes, isPropertyInnerMostEnum, isRemoveOperationIdPrefix, isSkipOverwrite, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, needToImport, outputFolder, postProcessAllModels, postProcessModels, postProcessModelsEnum, postProcessOperations, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessOpenAPI, processModelEnums, processOpenAPI, readLanguageArguments, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, setAllowUnicodeIdentifiers, setApiPackage, setCommonTemplateDir, setEnsureUniqueParams, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setInputSpec, setLanguageArguments, setLibrary, setModelNamePrefix, setModelNameSuffix, setModelPackage, setNonArrayMapProperty, setOutputDir, setParameterBooleanFlagWithCodegenProperty, setParameterExampleValue, setReleaseNote, setRemoveOperationIdPrefix, setReservedWordsLowerCase, setSkipOverwrite, setSortParamsByRequiredFlag, setTemplateDir, setTemplateVersion, shouldOverwrite, snakeCase, supportedLibraries, supportingFiles, templateDir, testPackage, 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
public static final String PROJECT_NAME
public static final String RESPONSE_AS
public static final String UNWRAP_REQUIRED
public static final String OBJC_COMPATIBLE
public static final String POD_SOURCE
public static final String POD_AUTHORS
public static final String POD_SOCIAL_MEDIA_URL
public static final String POD_DOCSET_URL
public static final String POD_LICENSE
public static final String POD_HOMEPAGE
public static final String POD_SUMMARY
public static final String POD_DESCRIPTION
public static final String POD_SCREENSHOTS
public static final String POD_DOCUMENTATION_URL
public static final String SWIFT_USE_API_NAMESPACE
public static final String DEFAULT_POD_AUTHORS
public static final String LENIENT_TYPE_CAST
protected static final String[] RESPONSE_LIBRARIES
protected String sourceFolder
public String getArgumentsLocation()
getArgumentsLocation
in class DefaultCodegenConfig
public io.swagger.codegen.CodegenType getTag()
public String getHelp()
protected void addAdditionPropertiesToCodeGenModel(io.swagger.codegen.CodegenModel codegenModel, io.swagger.v3.oas.models.media.Schema schema)
addAdditionPropertiesToCodeGenModel
in class DefaultCodegenConfig
public void processOpts()
processOpts
in interface io.swagger.codegen.CodegenConfig
processOpts
in class DefaultCodegenConfig
protected boolean isReservedWord(String word)
isReservedWord
in class DefaultCodegenConfig
public String escapeReservedWord(String name)
DefaultCodegenConfig
escapeReservedWord
in interface io.swagger.codegen.CodegenConfig
escapeReservedWord
in class DefaultCodegenConfig
name
- the name to be escapedpublic String modelFileFolder()
modelFileFolder
in interface io.swagger.codegen.CodegenConfig
modelFileFolder
in class DefaultCodegenConfig
public String apiFileFolder()
apiFileFolder
in interface io.swagger.codegen.CodegenConfig
apiFileFolder
in class DefaultCodegenConfig
public String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema propertySchema)
DefaultCodegenConfig
getTypeDeclaration
in interface io.swagger.codegen.CodegenConfig
getTypeDeclaration
in class DefaultCodegenConfig
propertySchema
- Schema Property objectpublic String getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
DefaultCodegenConfig
getSchemaType
in class DefaultCodegenConfig
schema
- Schema property objectpublic boolean isDataTypeFile(String dataType)
isDataTypeFile
in class DefaultCodegenConfig
public boolean isDataTypeBinary(String dataType)
isDataTypeBinary
in class DefaultCodegenConfig
public String toModelName(String name)
toModelName
in interface io.swagger.codegen.CodegenConfig
toModelName
in class DefaultCodegenConfig
name
- the name of the modelpublic String toModelFilename(String name)
toModelFilename
in interface io.swagger.codegen.CodegenConfig
toModelFilename
in class DefaultCodegenConfig
name
- the model namepublic String toDefaultValue(io.swagger.v3.oas.models.media.Schema schema)
DefaultCodegenConfig
toDefaultValue
in class DefaultCodegenConfig
schema
- Schema property objectpublic String toInstantiationType(io.swagger.v3.oas.models.media.Schema schema)
DefaultCodegenConfig
toInstantiationType
in class DefaultCodegenConfig
schema
- Swagger property objectpublic String toApiName(String name)
DefaultCodegenConfig
toApiName
in interface io.swagger.codegen.CodegenConfig
toApiName
in class DefaultCodegenConfig
name
- the name of the Apipublic String toOperationId(String operationId)
DefaultCodegenConfig
toOperationId
in class DefaultCodegenConfig
operationId
- operation IDpublic String toVarName(String name)
DefaultCodegenConfig
toVarName
in class DefaultCodegenConfig
name
- the variable namepublic String toParamName(String name)
DefaultCodegenConfig
toParamName
in interface io.swagger.codegen.CodegenConfig
toParamName
in class DefaultCodegenConfig
name
- Codegen property objectpublic io.swagger.codegen.CodegenModel fromModel(String name, io.swagger.v3.oas.models.media.Schema schema, Map<String,io.swagger.v3.oas.models.media.Schema> allDefinitions)
DefaultCodegenConfig
fromModel
in interface io.swagger.codegen.CodegenConfig
fromModel
in class DefaultCodegenConfig
name
- the name of the modelschema
- Swagger Model objectallDefinitions
- a map of all Swagger models from the specpublic void setProjectName(String projectName)
public void setUnwrapRequired(boolean unwrapRequired)
public void setObjcCompatible(boolean objcCompatible)
public void setLenientTypeCast(boolean lenientTypeCast)
public void setResponseAs(String[] responseAs)
public void setSwiftUseApiNamespace(boolean swiftUseApiNamespace)
public String toEnumValue(String value, String datatype)
DefaultCodegenConfig
toEnumValue
in class DefaultCodegenConfig
value
- enum variable namedatatype
- data typepublic String toEnumDefaultValue(String value, String datatype)
DefaultCodegenConfig
toEnumDefaultValue
in class DefaultCodegenConfig
value
- enum variable namedatatype
- data typepublic String toEnumVarName(String name, String datatype)
DefaultCodegenConfig
toEnumVarName
in class DefaultCodegenConfig
name
- enum variable namedatatype
- data typepublic String toEnumName(io.swagger.codegen.CodegenProperty property)
DefaultCodegenConfig
toEnumName
in class DefaultCodegenConfig
property
- Codegen propertypublic void postProcessModelProperty(io.swagger.codegen.CodegenModel model, io.swagger.codegen.CodegenProperty property)
postProcessModelProperty
in interface io.swagger.codegen.CodegenConfig
postProcessModelProperty
in class DefaultCodegenConfig
public String escapeQuotationMark(String input)
DefaultCodegenConfig
escapeQuotationMark
in interface io.swagger.codegen.CodegenConfig
escapeQuotationMark
in class DefaultCodegenConfig
input
- String to be cleaned uppublic String escapeUnsafeCharacters(String input)
DefaultCodegenConfig
escapeUnsafeCharacters
in interface io.swagger.codegen.CodegenConfig
escapeUnsafeCharacters
in class DefaultCodegenConfig
input
- String to be cleaned upCopyright © 2018. All rights reserved.