public class SwiftCodegen extends DefaultCodegen implements CodegenConfig
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_POD_AUTHORS |
protected static String |
LIBRARY_PROMISE_KIT |
protected static String |
LIBRARY_RX_SWIFT |
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 |
protected String |
projectName |
static String |
RESPONSE_AS |
protected static String[] |
RESPONSE_LIBRARIES |
protected String[] |
responseAs |
protected String |
sourceFolder |
static String |
SWIFT_USE_API_NAMESPACE |
protected boolean |
swiftUseApiNamespace |
static String |
UNWRAP_REQUIRED |
protected boolean |
unwrapRequired |
additionalProperties, allowUnicodeIdentifiers, apiDocTemplateFiles, apiPackage, apiTemplateFiles, apiTestTemplateFiles, cliOptions, commonTemplateDir, DEFAULT_CONTENT_TYPE, defaultIncludes, embeddedTemplateDir, ensureUniqueParams, fileSuffix, gitRepoId, gitUserId, hideGenerationTimestamp, httpUserAgent, ignoreFilePathOverride, importMapping, inputSpec, instantiationTypes, languageSpecificPrimitives, library, LOGGER, modelDocTemplateFiles, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, outputFolder, releaseNote, removeOperationIdPrefix, REQUEST_BODY_NAME, reservedWords, reservedWordsMappings, skipOverwrite, sortParamsByRequiredFlag, specialCharReplacements, supportedLibraries, supportingFiles, supportsInheritance, supportsMixins, templateDir, testPackage, typeAliases, typeMapping, vendorExtensions| Constructor and Description |
|---|
SwiftCodegen() |
| Modifier and Type | Method and Description |
|---|---|
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
|
CodegenOperation |
fromOperation(String path,
String httpMethod,
io.swagger.v3.oas.models.Operation operation,
Map<String,io.swagger.v3.oas.models.media.Schema> schemas,
io.swagger.v3.oas.models.OpenAPI openAPI)
Convert Swagger Operation object to Codegen Operation object
|
CodegenProperty |
fromProperty(String name,
io.swagger.v3.oas.models.media.Schema propertySchema)
Convert Swagger Property object to Codegen Property object
|
String |
getHelp() |
String |
getName() |
String |
getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
returns the swagger type for the property
|
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() |
Map<String,Object> |
postProcessModels(Map<String,Object> objs) |
void |
processOpts() |
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(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 |
toSwiftyEnumName(String value) |
String |
toVarName(String name)
Return the variable name by removing invalid characters and proper escaping if
it's a reserved word.
|
addAdditionPropertiesToCodeGenModel, 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, findMethodResponse, fromModel, fromModel, fromOperation, fromParameter, fromRequestBody, fromResponse, fromSecurity, generateExamplePath, getAlias, getCollectionFormat, getCommonTemplateDir, getConsumesInfo, getContentType, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getInnerEnumAllowableValues, getInputSpec, getLibrary, getOrGenerateOperationId, getOutputDir, getParameterFromRef, getParentName, getProducesInfo, getReleaseNote, getSchemaFromBody, getSchemaFromResponse, getSimpleRef, getSymbolName, getterAndSetterCapitalize, getTypeDeclaration, hasSchemaProperties, importMapping, initialCaps, instantiationTypes, isPropertyInnerMostEnum, isRemoveOperationIdPrefix, isSkipOverwrite, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, needToImport, outputFolder, postProcessAllModels, postProcessModelProperty, postProcessModelsEnum, postProcessOperations, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessOpenAPI, processCompiler, processOpenAPI, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, setAllowUnicodeIdentifiers, setApiPackage, setCommonTemplateDir, setEnsureUniqueParams, setGitRepoId, setGitUserId, setHttpUserAgent, setIgnoreFilePathOverride, setInputSpec, setLibrary, setModelNamePrefix, setModelNameSuffix, setModelPackage, setNonArrayMapProperty, setOutputDir, setParameterBooleanFlagWithCodegenProperty, setParameterExampleValue, setReleaseNote, setRemoveOperationIdPrefix, setReservedWordsLowerCase, setSkipOverwrite, setSortParamsByRequiredFlag, setTemplateDir, shouldOverwrite, snakeCase, supportedLibraries, supportingFiles, templateDir, testPackage, toApiDocFilename, toApiFilename, toApiImport, toApiTestFilename, toApiVarName, toBooleanGetter, toDefaultValueWithParam, toExamples, toExampleValue, toGetter, toModelDocFilename, toModelImport, toModelTestFilename, toRegularExpression, toSetter, typeMapping, underscore, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updatePropertyForArray, updatePropertyForMap, vendorExtensions, writeOptional, writePropertyBackclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddHandlebarHelpers, additionalProperties, addOperationToGroup, apiDocFileFolder, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, cliOptions, defaultIncludes, embeddedTemplateDir, escapeText, fileSuffix, fromModel, fromModel, fromOperation, fromSecurity, generateExamplePath, getCommonTemplateDir, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getInputSpec, getLibrary, getOutputDir, getReleaseNote, getTypeDeclaration, importMapping, instantiationTypes, isRemoveOperationIdPrefix, isSkipOverwrite, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, outputFolder, postProcessAllModels, postProcessModelProperty, postProcessOperations, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessOpenAPI, processCompiler, processOpenAPI, reservedWords, reservedWordsMappings, sanitizeTag, setGitRepoId, setGitUserId, setHttpUserAgent, setIgnoreFilePathOverride, setInputSpec, setLibrary, setOutputDir, setReleaseNote, setRemoveOperationIdPrefix, setSkipOverwrite, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, testPackage, toApiDocFilename, toApiFilename, toApiImport, toApiTestFilename, toApiVarName, toBooleanGetter, toGetter, toModelDocFilename, toModelImport, toModelTestFilename, toSetter, typeMapping, vendorExtensionspublic static final String PROJECT_NAME
public static final String RESPONSE_AS
public static final String UNWRAP_REQUIRED
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
protected static final String LIBRARY_PROMISE_KIT
protected static final String LIBRARY_RX_SWIFT
protected static final String[] RESPONSE_LIBRARIES
protected String projectName
protected boolean unwrapRequired
protected boolean swiftUseApiNamespace
protected String[] responseAs
protected String sourceFolder
public CodegenType getTag()
getTag in interface CodegenConfiggetTag in class DefaultCodegenpublic String getName()
getName in interface CodegenConfiggetName in class DefaultCodegenpublic String getHelp()
getHelp in interface CodegenConfiggetHelp in class DefaultCodegenpublic void processOpts()
processOpts in interface CodegenConfigprocessOpts in class DefaultCodegenprotected boolean isReservedWord(String word)
isReservedWord in class DefaultCodegenpublic String escapeReservedWord(String name)
DefaultCodegenescapeReservedWord in interface CodegenConfigescapeReservedWord in class DefaultCodegenname - the name to be escapedpublic String modelFileFolder()
modelFileFolder in interface CodegenConfigmodelFileFolder in class DefaultCodegenpublic String apiFileFolder()
apiFileFolder in interface CodegenConfigapiFileFolder in class DefaultCodegenpublic String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema propertySchema)
DefaultCodegengetTypeDeclaration in interface CodegenConfiggetTypeDeclaration in class DefaultCodegenpropertySchema - Schema Property objectpublic String getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
DefaultCodegengetSchemaType in class DefaultCodegenschema - Schema property objectpublic boolean isDataTypeFile(String dataType)
isDataTypeFile in class DefaultCodegenpublic boolean isDataTypeBinary(String dataType)
isDataTypeBinary in class DefaultCodegenpublic String toModelName(String name)
toModelName in interface CodegenConfigtoModelName in class DefaultCodegenname - the name of the modelpublic String toModelFilename(String name)
toModelFilename in interface CodegenConfigtoModelFilename in class DefaultCodegenname - the model namepublic String toDefaultValue(io.swagger.v3.oas.models.media.Schema schema)
DefaultCodegentoDefaultValue in class DefaultCodegenschema - Schema property objectpublic String toInstantiationType(io.swagger.v3.oas.models.media.Schema schema)
DefaultCodegentoInstantiationType in class DefaultCodegenschema - Swagger property objectpublic CodegenProperty fromProperty(String name, io.swagger.v3.oas.models.media.Schema propertySchema)
DefaultCodegenfromProperty in class DefaultCodegenname - name of the propertypropertySchema - Schema objectpublic String toApiName(String name)
DefaultCodegentoApiName in interface CodegenConfigtoApiName in class DefaultCodegenname - the name of the Apipublic String toOperationId(String operationId)
DefaultCodegentoOperationId in class DefaultCodegenoperationId - operation IDpublic String toVarName(String name)
DefaultCodegentoVarName in class DefaultCodegenname - the variable namepublic String toParamName(String name)
DefaultCodegentoParamName in interface CodegenConfigtoParamName in class DefaultCodegenname - Codegen property objectpublic CodegenOperation fromOperation(String path, String httpMethod, io.swagger.v3.oas.models.Operation operation, Map<String,io.swagger.v3.oas.models.media.Schema> schemas, io.swagger.v3.oas.models.OpenAPI openAPI)
DefaultCodegenfromOperation in interface CodegenConfigfromOperation in class DefaultCodegenpath - the path of the operationhttpMethod - HTTP methodoperation - Swagger operation objectschemas - a map of schemasopenAPI - a OpenAPI object representing the specpublic void setProjectName(String projectName)
public void setUnwrapRequired(boolean unwrapRequired)
public void setResponseAs(String[] responseAs)
public void setSwiftUseApiNamespace(boolean swiftUseApiNamespace)
public String toEnumValue(String value, String datatype)
DefaultCodegentoEnumValue in class DefaultCodegenvalue - enum variable namedatatype - data typepublic String toEnumDefaultValue(String value, String datatype)
DefaultCodegentoEnumDefaultValue in class DefaultCodegenvalue - enum variable namedatatype - data typepublic String toEnumVarName(String name, String datatype)
DefaultCodegentoEnumVarName in class DefaultCodegenname - enum variable namedatatype - data typepublic String toEnumName(CodegenProperty property)
DefaultCodegentoEnumName in class DefaultCodegenproperty - Codegen propertypublic Map<String,Object> postProcessModels(Map<String,Object> objs)
postProcessModels in interface CodegenConfigpostProcessModels in class DefaultCodegenpublic String escapeQuotationMark(String input)
DefaultCodegenescapeQuotationMark in interface CodegenConfigescapeQuotationMark in class DefaultCodegeninput - String to be cleaned uppublic String escapeUnsafeCharacters(String input)
DefaultCodegenescapeUnsafeCharacters in interface CodegenConfigescapeUnsafeCharacters in class DefaultCodegeninput - String to be cleaned upCopyright © 2018. All rights reserved.