Class Swift5ClientCodegen
- java.lang.Object
-
- org.openapitools.codegen.DefaultCodegen
-
- org.openapitools.codegen.languages.Swift5ClientCodegen
-
- All Implemented Interfaces:
CodegenConfig
public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
-
-
Field Summary
-
Fields inherited from class org.openapitools.codegen.DefaultCodegen
additionalProperties, addOneOfInterfaceImports, addOneOfInterfaces, addSuffixToDuplicateOperationNicknames, allowUnicodeIdentifiers, apiDocTemplateFiles, apiNamePrefix, apiNameSuffix, apiPackage, apiTemplateFiles, apiTestTemplateFiles, cliOptions, DefaultFeatureSet, defaultIncludes, disallowAdditionalPropertiesIfNotPresent, docExtension, embeddedTemplateDir, enableMinimalUpdate, enablePostProcessFile, ensureUniqueParams, enumUnknownDefaultCase, enumUnknownDefaultCaseName, falseSchema, filesMetadataFilename, fileSuffix, generatorMetadata, gitHost, gitRepoId, gitUserId, hideGenerationTimestamp, httpUserAgent, ignoreFilePathOverride, importBaseType, importContainerType, importMapping, inlineSchemaNameMapping, inlineSchemaOption, inputSpec, instantiationTypes, JSON_MIME_PATTERN, JSON_VENDOR_MIME_PATTERN, languageSpecificPrimitives, legacyDiscriminatorBehavior, library, loadDeepObjectIntoItems, modelDocTemplateFiles, modelNameMapping, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, nameMapping, openAPI, openapiNormalizer, outputFolder, parameterNameMapping, prependFormOrBodyParameters, releaseNote, removeEnumValuePrefix, removeOperationIdPrefix, removeOperationIdPrefixCount, removeOperationIdPrefixDelimiter, reservedWords, reservedWordsMappings, schemaMapping, serverVariables, skipOperationExample, skipOverwrite, sortModelPropertiesByRequiredFlag, sortParamsByRequiredFlag, specialCharReplacements, strictSpecBehavior, supportedLibraries, supportingFiles, supportsAdditionalPropertiesWithComposedSchema, supportsInheritance, supportsMixins, supportsMultipleInheritance, templateDir, testPackage, trueSchema, typeAliases, typeMapping, useOneOfInterfaces, vendorExtensions, versionMetadataFilename, XML_MIME_PATTERN
-
-
Constructor Summary
Constructors Constructor Description Swift5ClientCodegen()Constructor for the swift5 language codegen module.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, io.swagger.v3.oas.models.media.Schema schema)Handle the model for the 'additionalProperties' keyword in the OAS schema.StringapiDocFileFolder()StringapiFileFolder()StringconstructExampleCode(CodegenModel codegenModel, HashMap<String,CodegenModel> modelMaps, Set<String> visitedModels)StringconstructExampleCode(CodegenParameter codegenParameter, HashMap<String,CodegenModel> modelMaps, Set<String> visitedModels)StringconstructExampleCode(CodegenProperty codegenProperty, HashMap<String,CodegenModel> modelMaps, Set<String> visitedModels)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.v3.oas.models.media.Schema model)Convert OAS Model object to Codegen Model object.GeneratorLanguagegeneratorLanguage()StringgetHelp()StringgetName()StringgetSchemaType(io.swagger.v3.oas.models.media.Schema p)returns the OpenAPI type for the property.CodegenTypegetTag()StringgetTypeDeclaration(io.swagger.v3.oas.models.media.Schema p)Output the language-specific type declaration of the property.booleanisDataTypeBinary(String dataType)booleanisDataTypeFile(String dataType)booleanisMapFileBinaryToData()protected booleanisReservedWord(String word)StringmodelDocFileFolder()StringmodelFileFolder()voidpostProcess()voidpostProcessFile(File file, String fileType)Post-process the auto-generated file, e.g.voidpostProcessModelProperty(CodegenModel model, CodegenProperty property)ModelsMappostProcessModels(ModelsMap objs)OperationsMappostProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels)voidprocessOpts()voidsetGenerateModelAdditionalProperties(boolean generateModelAdditionalProperties)voidsetHashableModels(boolean hashableModels)voidsetLenientTypeCast(boolean lenientTypeCast)voidsetMapFileBinaryToData(boolean mapFileBinaryToData)voidsetNonPublicApi(boolean nonPublicApi)voidsetObjcCompatible(boolean objcCompatible)voidsetProjectName(String projectName)voidsetReadonlyProperties(boolean readonlyProperties)voidsetResponseAs(String[] responseAs)voidsetSwiftPackagePath(String swiftPackagePath)voidsetSwiftUseApiNamespace(boolean swiftUseApiNamespace)voidsetUseBacktickEscapes(boolean useBacktickEscapes)voidsetUseClasses(boolean useClasses)voidsetUseCustomDateWithoutTime(boolean useCustomDateWithoutTime)voidsetUseJsonEncodable(boolean useJsonEncodable)voidsetUseSPMFileStructure(boolean useSPMFileStructure)voidsetValidatable(boolean validatable)StringtoApiDocFilename(String name)Return the file name of the Api DocumentationStringtoApiName(String name)Output the API (class) name (capitalized) ending with the specified or default suffix Return DefaultApi if name is emptyStringtoDefaultValue(io.swagger.v3.oas.models.media.Schema p)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.v3.oas.models.media.Schema p)Return the instantiation type of the property, especially for map and arrayStringtoModelDocFilename(String name)Return the capitalized file name of the model documentationStringtoModelFilename(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 org.openapitools.codegen.DefaultCodegen
addBodyModelSchema, addHeaders, addImport, addImport, addImport, addImports, addImports, addImports, addImportsForPropertyType, addImportsToOneOfInterface, additionalProperties, addMustacheLambdas, addOneOfInterfaceModel, addOneOfNameExtension, addOperationToGroup, addOption, addOption, addParentContainer, addProperties, addRegularExpressionDelimiter, addRequiredVarsMap, addSwitch, addVars, addVars, addVarsRequiredVarsAdditionalProps, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, buildEnumVars, buildLibraryCliOption, cliOptions, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, createDiscriminator, defaultIncludes, defaultTemplatingEngine, embeddedTemplateDir, encodePath, escapeText, escapeTextWhileAllowingNewLines, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fromCallback, fromFormProperty, fromOperation, fromParameter, fromProperty, fromProperty, fromProperty, fromRequestBody, fromRequestBodyToFormParameters, fromResponse, fromSecurity, fromServers, fromServerVariables, generateExamplePath, generateJSONSpecFile, generateYAMLSpecFile, generatorLanguageVersion, getAdditionalPropertiesName, getAddSuffixToDuplicateOperationNicknames, getAlias, getAllModels, getAllOfDescendants, getAllowUnicodeIdentifiers, getApiNamePrefix, getApiNameSuffix, getCollectionFormat, getCollectionFormat, getConsumesInfo, getContent, getContentType, getDisallowAdditionalPropertiesIfNotPresent, getDocExtension, getEnsureUniqueParams, getEnumDefaultValue, getEnumUnknownDefaultCase, getFeatureSet, getFilesMetadataFilename, getGeneratorMetadata, getGitHost, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getInnerEnumAllowableValues, getInputSpec, getItemsName, getLegacyDiscriminatorBehavior, getLibrary, getModelNamePrefix, getModelNameSuffix, getModelNameToSchemaCache, getMostInnerItems, getOneOfAnyOfDescendants, getOrGenerateOperationId, getOutputDir, getParameterDataType, getPrependFormOrBodyParameters, getProducesInfo, getReleaseNote, getRemoveOperationIdPrefixCount, getRemoveOperationIdPrefixDelimiter, getSchemaAdditionalProperties, getSchemaFromBooleanOrSchema, getSchemaItems, getSingleSchemaType, getSortModelPropertiesByRequiredFlag, getSortParamsByRequiredFlag, getSupportedVendorExtensions, getSymbolName, getTemplatingEngine, getterAndSetterCapitalize, getTypeDeclaration, getUseInlineModelResolver, getUseOneOfInterfaces, getUseOpenAPINormalizer, getVersionMetadataFilename, handleMethodResponse, handleMethodResponse, handleSpecialCharacters, hasBodyParameter, hasFormParameter, importMapping, initializeSpecialCharacterMapping, inlineSchemaNameMapping, inlineSchemaOption, instantiationTypes, isAnyTypeSchema, isDataTypeString, isEnableMinimalUpdate, isEnablePostProcessFile, isHideGenerationTimestamp, isJsonMimeType, isJsonVendorMimeType, isLibrary, isParameterNameUnique, isPropertyInnerMostEnum, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isSkipOperationExample, isSkipOverwrite, isStrictSpecBehavior, isXmlMimeType, languageSpecificPrimitives, lowerCamelCase, modelDocTemplateFiles, modelFilename, modelNameMapping, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, modifyFeatureSet, nameMapping, needToImport, openapiNormalizer, outputFolder, parameterNameMapping, postProcessAllModels, postProcessModelsEnum, postProcessParameter, postProcessSupportingFileData, preprocessOpenAPI, processCompiler, processOpenAPI, processTemplatingEngine, processTestExampleData, removeImport, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, removeOption, removeSelfReferenceImports, reservedWords, reservedWordsMappings, sanitizeName, sanitizeName, sanitizeName, sanitizeTag, schemaMapping, serverVariableOverrides, setAddProps, setAllowUnicodeIdentifiers, setApiNamePrefix, setApiNameSuffix, setApiPackage, setCircularReferences, setDisallowAdditionalPropertiesIfNotPresent, setDocExtension, setEnableMinimalUpdate, setEnablePostProcessFile, setEnsureUniqueParams, setEnumUnknownDefaultCase, setFilesMetadataFilename, setGitHost, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setInputSpec, setLegacyDiscriminatorBehavior, setLibrary, setModelNamePrefix, setModelNameSuffix, setModelPackage, setNonArrayMapProperty, setOpenAPI, setOutputDir, setParameterBooleanFlagWithCodegenProperty, setParameterEncodingValues, setParameterExamples, setParameterExampleValue, setParameterExampleValue, setParameterExampleValue, setParameterNullable, setPrependFormOrBodyParameters, setReleaseNote, setRemoveEnumValuePrefix, setRemoveOperationIdPrefix, setRemoveOperationIdPrefixCount, setRemoveOperationIdPrefixDelimiter, setReservedWordsLowerCase, setSkipOperationExample, setSkipOverwrite, setSortModelPropertiesByRequiredFlag, setSortParamsByRequiredFlag, setStrictSpecBehavior, setTemplateDir, setTemplatingEngine, setUseOneOfInterfaces, setVersionMetadataFilename, shouldAddImport, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, testPackage, toAllOfName, toAnyOfName, toApiFilename, toApiImport, toApiTestFilename, toApiVarName, toArrayModelParamName, toBooleanGetter, toDefaultParameterValue, toDefaultParameterValue, toDefaultValue, toDefaultValueWithParam, toExamples, toExampleValue, toGetter, toMediaTypeSchemaName, toModelImport, toModelImportMap, toModelTestFilename, toOneOfName, toRegularExpression, toSetter, toTestCaseName, typeMapping, unaliasPropertySchema, unaliasSchema, updateAllModels, updateCodegenPropertyEnum, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updateEnumVarsWithExtensions, updateModelForAnyType, updateModelForComposedSchema, updateModelForInteger, updateModelForNumber, updateModelForObject, updateModelForString, updateOption, updateParameterForString, updatePropertyForAnyType, updatePropertyForArray, updatePropertyForInteger, updatePropertyForMap, updatePropertyForMap, updatePropertyForNumber, updatePropertyForObject, updatePropertyForString, updateRequestBodyForArray, updateRequestBodyForMap, updateRequestBodyForObject, updateRequestBodyForPrimitiveType, updateRequestBodyForString, vendorExtensions, writePropertyBack
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openapitools.codegen.CodegenConfig
additionalProperties, addOperationToGroup, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, cliOptions, defaultIncludes, defaultTemplatingEngine, embeddedTemplateDir, encodePath, escapeText, escapeTextWhileAllowingNewLines, fileSuffix, fromOperation, fromSecurity, fromServers, fromServerVariables, generateExamplePath, generatorLanguageVersion, getAddSuffixToDuplicateOperationNicknames, getDocExtension, getFeatureSet, getFilesMetadataFilename, getGeneratorMetadata, getGitHost, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getInputSpec, getLibrary, getOutputDir, getReleaseNote, getSupportedVendorExtensions, getTemplatingEngine, getTypeDeclaration, getUseInlineModelResolver, getUseOpenAPINormalizer, getVersionMetadataFilename, importMapping, inlineSchemaNameMapping, inlineSchemaOption, instantiationTypes, isEnableMinimalUpdate, isEnablePostProcessFile, isHideGenerationTimestamp, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isSkipOperationExample, isSkipOverwrite, isStrictSpecBehavior, languageSpecificPrimitives, modelDocTemplateFiles, modelFilename, modelNameMapping, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, nameMapping, openapiNormalizer, outputFolder, parameterNameMapping, postProcessAllModels, postProcessParameter, postProcessSupportingFileData, preprocessOpenAPI, processCompiler, processOpenAPI, processTemplatingEngine, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, schemaMapping, serverVariableOverrides, setDocExtension, setEnableMinimalUpdate, setEnablePostProcessFile, setGitHost, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setInputSpec, setLibrary, setOpenAPI, setOutputDir, setReleaseNote, setRemoveEnumValuePrefix, setRemoveOperationIdPrefix, setSkipOperationExample, setSkipOverwrite, setStrictSpecBehavior, setTemplatingEngine, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, testPackage, toApiFilename, toApiImport, toApiTestFilename, toApiVarName, toBooleanGetter, toGetter, toModelImport, toModelImportMap, toModelTestFilename, toSetter, typeMapping, unaliasSchema, updateAllModels, vendorExtensions
-
-
-
-
Field Detail
-
PROJECT_NAME
public static final String PROJECT_NAME
- See Also:
- Constant Field Values
-
RESPONSE_AS
public static final String RESPONSE_AS
- See Also:
- Constant Field Values
-
OBJC_COMPATIBLE
public static final String OBJC_COMPATIBLE
- See Also:
- Constant Field Values
-
POD_SOURCE
public static final String POD_SOURCE
- See Also:
- Constant Field Values
-
POD_AUTHORS
public static final String POD_AUTHORS
- See Also:
- Constant Field Values
-
POD_SOCIAL_MEDIA_URL
public static final String POD_SOCIAL_MEDIA_URL
- See Also:
- Constant Field Values
-
POD_LICENSE
public static final String POD_LICENSE
- See Also:
- Constant Field Values
-
POD_HOMEPAGE
public static final String POD_HOMEPAGE
- See Also:
- Constant Field Values
-
POD_SUMMARY
public static final String POD_SUMMARY
- See Also:
- Constant Field Values
-
POD_DESCRIPTION
public static final String POD_DESCRIPTION
- See Also:
- Constant Field Values
-
POD_SCREENSHOTS
public static final String POD_SCREENSHOTS
- See Also:
- Constant Field Values
-
POD_DOCUMENTATION_URL
public static final String POD_DOCUMENTATION_URL
- See Also:
- Constant Field Values
-
READONLY_PROPERTIES
public static final String READONLY_PROPERTIES
- See Also:
- Constant Field Values
-
SWIFT_USE_API_NAMESPACE
public static final String SWIFT_USE_API_NAMESPACE
- See Also:
- Constant Field Values
-
DEFAULT_POD_AUTHORS
public static final String DEFAULT_POD_AUTHORS
- See Also:
- Constant Field Values
-
LENIENT_TYPE_CAST
public static final String LENIENT_TYPE_CAST
- See Also:
- Constant Field Values
-
USE_SPM_FILE_STRUCTURE
public static final String USE_SPM_FILE_STRUCTURE
- See Also:
- Constant Field Values
-
SWIFT_PACKAGE_PATH
public static final String SWIFT_PACKAGE_PATH
- See Also:
- Constant Field Values
-
USE_CLASSES
public static final String USE_CLASSES
- See Also:
- Constant Field Values
-
USE_BACKTICK_ESCAPES
public static final String USE_BACKTICK_ESCAPES
- See Also:
- Constant Field Values
-
GENERATE_MODEL_ADDITIONAL_PROPERTIES
public static final String GENERATE_MODEL_ADDITIONAL_PROPERTIES
- See Also:
- Constant Field Values
-
HASHABLE_MODELS
public static final String HASHABLE_MODELS
- See Also:
- Constant Field Values
-
USE_JSON_ENCODABLE
public static final String USE_JSON_ENCODABLE
- See Also:
- Constant Field Values
-
MAP_FILE_BINARY_TO_DATA
public static final String MAP_FILE_BINARY_TO_DATA
- See Also:
- Constant Field Values
-
USE_CUSTOM_DATE_WITHOUT_TIME
public static final String USE_CUSTOM_DATE_WITHOUT_TIME
- See Also:
- Constant Field Values
-
VALIDATABLE
public static final String VALIDATABLE
- See Also:
- Constant Field Values
-
LIBRARY_ALAMOFIRE
protected static final String LIBRARY_ALAMOFIRE
- See Also:
- Constant Field Values
-
LIBRARY_URLSESSION
protected static final String LIBRARY_URLSESSION
- See Also:
- Constant Field Values
-
LIBRARY_VAPOR
protected static final String LIBRARY_VAPOR
- See Also:
- Constant Field Values
-
RESPONSE_LIBRARY_PROMISE_KIT
protected static final String RESPONSE_LIBRARY_PROMISE_KIT
- See Also:
- Constant Field Values
-
RESPONSE_LIBRARY_RX_SWIFT
protected static final String RESPONSE_LIBRARY_RX_SWIFT
- See Also:
- Constant Field Values
-
RESPONSE_LIBRARY_RESULT
protected static final String RESPONSE_LIBRARY_RESULT
- See Also:
- Constant Field Values
-
RESPONSE_LIBRARY_COMBINE
protected static final String RESPONSE_LIBRARY_COMBINE
- See Also:
- Constant Field Values
-
RESPONSE_LIBRARY_ASYNC_AWAIT
protected static final String RESPONSE_LIBRARY_ASYNC_AWAIT
- See Also:
- Constant Field Values
-
RESPONSE_LIBRARIES
protected static final String[] RESPONSE_LIBRARIES
-
projectName
protected String projectName
-
nonPublicApi
protected boolean nonPublicApi
-
objcCompatible
protected boolean objcCompatible
-
lenientTypeCast
protected boolean lenientTypeCast
-
readonlyProperties
protected boolean readonlyProperties
-
swiftUseApiNamespace
protected boolean swiftUseApiNamespace
-
useSPMFileStructure
protected boolean useSPMFileStructure
-
swiftPackagePath
protected String swiftPackagePath
-
useClasses
protected boolean useClasses
-
useBacktickEscapes
protected boolean useBacktickEscapes
-
generateModelAdditionalProperties
protected boolean generateModelAdditionalProperties
-
hashableModels
protected boolean hashableModels
-
useJsonEncodable
protected boolean useJsonEncodable
-
mapFileBinaryToData
protected boolean mapFileBinaryToData
-
useCustomDateWithoutTime
protected boolean useCustomDateWithoutTime
-
validatable
protected boolean validatable
-
responseAs
protected String[] responseAs
-
sourceFolder
protected String sourceFolder
-
objcReservedWords
protected HashSet objcReservedWords
-
apiDocPath
protected String apiDocPath
-
modelDocPath
protected String modelDocPath
-
-
Method Detail
-
getTag
public CodegenType getTag()
- Specified by:
getTagin interfaceCodegenConfig- Overrides:
getTagin classDefaultCodegen
-
getName
public String getName()
- Specified by:
getNamein interfaceCodegenConfig- Overrides:
getNamein classDefaultCodegen
-
getHelp
public String getHelp()
- Specified by:
getHelpin interfaceCodegenConfig- Overrides:
getHelpin classDefaultCodegen
-
addAdditionPropertiesToCodeGenModel
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, io.swagger.v3.oas.models.media.Schema schema)
Description copied from class:DefaultCodegenHandle the model for the 'additionalProperties' keyword in the OAS schema.- Overrides:
addAdditionPropertiesToCodeGenModelin classDefaultCodegen- Parameters:
codegenModel- The codegen representation of the schema.schema- The input OAS schema.
-
processOpts
public void processOpts()
- Specified by:
processOptsin interfaceCodegenConfig- Overrides:
processOptsin classDefaultCodegen
-
isMapFileBinaryToData
public boolean isMapFileBinaryToData()
-
setMapFileBinaryToData
public void setMapFileBinaryToData(boolean mapFileBinaryToData)
-
setUseCustomDateWithoutTime
public void setUseCustomDateWithoutTime(boolean useCustomDateWithoutTime)
-
isReservedWord
protected boolean isReservedWord(String word)
- Overrides:
isReservedWordin classDefaultCodegen
-
escapeReservedWord
public String escapeReservedWord(String name)
Description copied from class:DefaultCodegenReturn the escaped name of the reserved word- Specified by:
escapeReservedWordin interfaceCodegenConfig- Overrides:
escapeReservedWordin classDefaultCodegen- Parameters:
name- the name to be escaped- Returns:
- the escaped reserved word
throws Runtime exception as reserved word is not allowed (default behavior)
-
modelFileFolder
public String modelFileFolder()
- Specified by:
modelFileFolderin interfaceCodegenConfig- Overrides:
modelFileFolderin classDefaultCodegen
-
apiFileFolder
public String apiFileFolder()
- Specified by:
apiFileFolderin interfaceCodegenConfig- Overrides:
apiFileFolderin classDefaultCodegen
-
getTypeDeclaration
public String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema p)
Description copied from class:DefaultCodegenOutput the language-specific type declaration of the property.- Specified by:
getTypeDeclarationin interfaceCodegenConfig- Overrides:
getTypeDeclarationin classDefaultCodegen- Parameters:
p- property schema- Returns:
- a string presentation of the property type
-
getSchemaType
public String getSchemaType(io.swagger.v3.oas.models.media.Schema p)
Description copied from class:DefaultCodegenreturns the OpenAPI type for the property. Use getAlias to handle $ref of primitive type- Overrides:
getSchemaTypein classDefaultCodegen- Parameters:
p- property schema- Returns:
- string presentation of the type
-
isDataTypeFile
public boolean isDataTypeFile(String dataType)
- Overrides:
isDataTypeFilein classDefaultCodegen
-
isDataTypeBinary
public boolean isDataTypeBinary(String dataType)
- Overrides:
isDataTypeBinaryin classDefaultCodegen
-
toModelName
public String toModelName(String name)
Output the proper model name (capitalized).- Specified by:
toModelNamein interfaceCodegenConfig- Overrides:
toModelNamein classDefaultCodegen- Parameters:
name- the name of the model- Returns:
- capitalized model name
-
toModelFilename
public String toModelFilename(String name)
Return the capitalized file name of the model.- Specified by:
toModelFilenamein interfaceCodegenConfig- Overrides:
toModelFilenamein classDefaultCodegen- Parameters:
name- the model name- Returns:
- the file name of the model
-
toDefaultValue
public String toDefaultValue(io.swagger.v3.oas.models.media.Schema p)
Description copied from class:DefaultCodegenReturn the default value of the propertyThis method should be overridden in the generator to meet its requirement. Return null if you do NOT want a default value. Any non-null value will cause {{#defaultValue} check to pass.
- Overrides:
toDefaultValuein classDefaultCodegen- Parameters:
p- Property schema- Returns:
- string presentation of the default value of the property
-
toInstantiationType
public String toInstantiationType(io.swagger.v3.oas.models.media.Schema p)
Description copied from class:DefaultCodegenReturn the instantiation type of the property, especially for map and array- Overrides:
toInstantiationTypein classDefaultCodegen- Parameters:
p- property schema- Returns:
- string presentation of the instantiation type of the property
-
toApiName
public String toApiName(String name)
Description copied from class:DefaultCodegenOutput the API (class) name (capitalized) ending with the specified or default suffix Return DefaultApi if name is empty- Specified by:
toApiNamein interfaceCodegenConfig- Overrides:
toApiNamein classDefaultCodegen- Parameters:
name- the name of the Api- Returns:
- capitalized Api name
-
apiDocFileFolder
public String apiDocFileFolder()
- Specified by:
apiDocFileFolderin interfaceCodegenConfig- Overrides:
apiDocFileFolderin classDefaultCodegen
-
modelDocFileFolder
public String modelDocFileFolder()
- Specified by:
modelDocFileFolderin interfaceCodegenConfig- Overrides:
modelDocFileFolderin classDefaultCodegen
-
toModelDocFilename
public String toModelDocFilename(String name)
Description copied from class:DefaultCodegenReturn the capitalized file name of the model documentation- Specified by:
toModelDocFilenamein interfaceCodegenConfig- Overrides:
toModelDocFilenamein classDefaultCodegen- Parameters:
name- the model name- Returns:
- the file name of the model
-
toApiDocFilename
public String toApiDocFilename(String name)
Description copied from class:DefaultCodegenReturn the file name of the Api Documentation- Specified by:
toApiDocFilenamein interfaceCodegenConfig- Overrides:
toApiDocFilenamein classDefaultCodegen- Parameters:
name- the file name of the Api- Returns:
- the file name of the Api
-
toOperationId
public String toOperationId(String operationId)
Description copied from class:DefaultCodegenReturn the operation ID (method name)- Overrides:
toOperationIdin classDefaultCodegen- Parameters:
operationId- operation ID- Returns:
- the sanitized method name
-
toVarName
public 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 classDefaultCodegen- Parameters:
name- the variable name- Returns:
- the sanitized variable name
-
toParamName
public 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 interfaceCodegenConfig- Overrides:
toParamNamein classDefaultCodegen- Parameters:
name- Codegen property object- Returns:
- the sanitized parameter name
-
fromModel
public CodegenModel fromModel(String name, io.swagger.v3.oas.models.media.Schema model)
Description copied from class:DefaultCodegenConvert OAS Model object to Codegen Model object.- Specified by:
fromModelin interfaceCodegenConfig- Overrides:
fromModelin classDefaultCodegen- Parameters:
name- the name of the modelmodel- OAS Model object- Returns:
- Codegen Model object
-
setProjectName
public void setProjectName(String projectName)
-
setNonPublicApi
public void setNonPublicApi(boolean nonPublicApi)
-
setObjcCompatible
public void setObjcCompatible(boolean objcCompatible)
-
setLenientTypeCast
public void setLenientTypeCast(boolean lenientTypeCast)
-
setReadonlyProperties
public void setReadonlyProperties(boolean readonlyProperties)
-
setResponseAs
public void setResponseAs(String[] responseAs)
-
setSwiftUseApiNamespace
public void setSwiftUseApiNamespace(boolean swiftUseApiNamespace)
-
setUseSPMFileStructure
public void setUseSPMFileStructure(boolean useSPMFileStructure)
-
setSwiftPackagePath
public void setSwiftPackagePath(String swiftPackagePath)
-
setUseClasses
public void setUseClasses(boolean useClasses)
-
setUseBacktickEscapes
public void setUseBacktickEscapes(boolean useBacktickEscapes)
-
setGenerateModelAdditionalProperties
public void setGenerateModelAdditionalProperties(boolean generateModelAdditionalProperties)
-
setHashableModels
public void setHashableModels(boolean hashableModels)
-
setUseJsonEncodable
public void setUseJsonEncodable(boolean useJsonEncodable)
-
setValidatable
public void setValidatable(boolean validatable)
-
toEnumValue
public 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 classDefaultCodegen- Parameters:
value- enum variable namedatatype- data type- Returns:
- the sanitized value for enum
-
toEnumDefaultValue
public String toEnumDefaultValue(String value, String datatype)
Description copied from class:DefaultCodegenReturn the enum default value in the language specified format- Overrides:
toEnumDefaultValuein classDefaultCodegen- Parameters:
value- enum variable namedatatype- data type- Returns:
- the default value for the enum
-
toEnumVarName
public String toEnumVarName(String name, String datatype)
Description copied from class:DefaultCodegenReturn the sanitized variable name for enum- Overrides:
toEnumVarNamein classDefaultCodegen- Parameters:
name- enum variable namedatatype- data type- Returns:
- the sanitized variable name for enum
-
toEnumName
public String toEnumName(CodegenProperty property)
Description copied from class:DefaultCodegenReturn the Enum name (e.g. StatusEnum given 'status')- Overrides:
toEnumNamein classDefaultCodegen- Parameters:
property- Codegen property- Returns:
- the Enum name
-
postProcessModels
public ModelsMap postProcessModels(ModelsMap objs)
- Specified by:
postProcessModelsin interfaceCodegenConfig- Overrides:
postProcessModelsin classDefaultCodegen
-
postProcessModelProperty
public void postProcessModelProperty(CodegenModel model, CodegenProperty property)
- Specified by:
postProcessModelPropertyin interfaceCodegenConfig- Overrides:
postProcessModelPropertyin classDefaultCodegen
-
escapeQuotationMark
public String escapeQuotationMark(String input)
Description copied from class:DefaultCodegenEscape single and/or double quote to avoid code injection- Specified by:
escapeQuotationMarkin interfaceCodegenConfig- Overrides:
escapeQuotationMarkin 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:DefaultCodegenoverride with any special text escaping logic to handle unsafe characters so as to avoid code injection- Specified by:
escapeUnsafeCharactersin interfaceCodegenConfig- Overrides:
escapeUnsafeCharactersin classDefaultCodegen- Parameters:
input- String to be cleaned up- Returns:
- string with unsafe characters removed or escaped
-
postProcessFile
public void postProcessFile(File file, String fileType)
Description copied from class:DefaultCodegenPost-process the auto-generated file, e.g. using go-fmt to format the Go code. The file type can be "model-test", "model-doc", "model", "api", "api-test", "api-doc", "supporting-mustache", "supporting-common", "openapi-generator-ignore", "openapi-generator-version"TODO: store these values in enum instead
- Specified by:
postProcessFilein interfaceCodegenConfig- Overrides:
postProcessFilein classDefaultCodegen- Parameters:
file- file to be processedfileType- file type
-
postProcessOperationsWithModels
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels)
- Specified by:
postProcessOperationsWithModelsin interfaceCodegenConfig- Overrides:
postProcessOperationsWithModelsin classDefaultCodegen
-
constructExampleCode
public String constructExampleCode(CodegenParameter codegenParameter, HashMap<String,CodegenModel> modelMaps, Set<String> visitedModels)
-
constructExampleCode
public String constructExampleCode(CodegenProperty codegenProperty, HashMap<String,CodegenModel> modelMaps, Set<String> visitedModels)
-
constructExampleCode
public String constructExampleCode(CodegenModel codegenModel, HashMap<String,CodegenModel> modelMaps, Set<String> visitedModels)
-
postProcess
public void postProcess()
- Specified by:
postProcessin interfaceCodegenConfig- Overrides:
postProcessin classDefaultCodegen
-
generatorLanguage
public GeneratorLanguage generatorLanguage()
- Specified by:
generatorLanguagein interfaceCodegenConfig- Overrides:
generatorLanguagein classDefaultCodegen
-
-