Class CrystalClientCodegen
- java.lang.Object
-
- org.openapitools.codegen.DefaultCodegen
-
- org.openapitools.codegen.languages.CrystalClientCodegen
-
- All Implemented Interfaces:
CodegenConfig
public class CrystalClientCodegen extends DefaultCodegen
-
-
Field Summary
Fields Modifier and Type Field Description protected StringapiDocPathprotected static intemptyMethodNameCounterprotected StringmodelDocPathstatic StringMODULE_NAMEprotected StringmoduleNameprotected List<String>primitiveTypesstatic StringSHARD_AUTHORstatic StringSHARD_AUTHOR_EMAILstatic StringSHARD_DESCRIPTIONstatic StringSHARD_HOMEPAGEstatic StringSHARD_LICENSEstatic StringSHARD_NAMEstatic StringSHARD_SUMMARYstatic StringSHARD_VERSIONprotected StringshardAuthorprotected StringshardAuthorEmailprotected StringshardDescriptionprotected StringshardHomepageprotected StringshardLicenseprotected StringshardNameprotected StringshardSummaryprotected StringshardVersionprotected StringspecFolderprotected StringsrcFolder-
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 CrystalClientCodegen()
-
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()StringapiTestFileFolder()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 injectionGeneratorLanguagegeneratorLanguage()StringgetHelp()StringgetName()StringgetSchemaType(io.swagger.v3.oas.models.media.Schema schema)returns the OpenAPI type for the property.CodegenTypegetTag()StringgetTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema)Output the language-specific type declaration of the property.StringmodelDocFileFolder()StringmodelFileFolder()StringmodelTestFileFolder()voidpostProcessFile(File file, String fileType)Post-process the auto-generated file, e.g.ModelsMappostProcessModels(ModelsMap objs)OperationsMappostProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels)voidprocessOpts()StringsanitizeModelName(String modelName)voidsetModuleName(String moduleName)voidsetShardAuthor(String shardAuthor)voidsetShardAuthorEmail(String shardAuthorEmail)voidsetShardDescription(String shardDescription)voidsetShardHomepage(String shardHomepage)voidsetShardLicense(String shardLicense)voidsetShardName(String shardName)voidsetShardSummary(String shardSummary)voidsetShardVersion(String shardVersion)StringtoApiDocFilename(String name)Return the file name of the Api DocumentationStringtoApiFilename(String name)Return the file name of the Api TestStringtoApiImport(String name)Return the fully-qualified "Api" name for importStringtoApiName(String name)Output the API (class) name (capitalized) ending with the specified or default suffix Return DefaultApi if name is emptyStringtoApiTestFilename(String name)Return the file name of the Api TestStringtoDefaultValue(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 schema)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 modelStringtoModelImport(String name)Return the fully-qualified "Model" name for importStringtoModelName(String name)Converts the OpenAPI schema name to a model name suitable for the current code generator.StringtoModelTestFilename(String name)Return the capitalized file name of the model testStringtoOperationId(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.StringtoRegularExpression(String pattern)Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)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, apiTestFilename, apiTestTemplateFiles, buildEnumVars, buildLibraryCliOption, cliOptions, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, createDiscriminator, defaultIncludes, defaultTemplatingEngine, embeddedTemplateDir, encodePath, escapeText, escapeTextWhileAllowingNewLines, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fromCallback, fromFormProperty, fromModel, 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, isDataTypeBinary, isDataTypeFile, isDataTypeString, isEnableMinimalUpdate, isEnablePostProcessFile, isHideGenerationTimestamp, isJsonMimeType, isJsonVendorMimeType, isLibrary, isParameterNameUnique, isPropertyInnerMostEnum, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isReservedWord, isSkipOperationExample, isSkipOverwrite, isStrictSpecBehavior, isXmlMimeType, languageSpecificPrimitives, lowerCamelCase, modelDocTemplateFiles, modelFilename, modelNameMapping, modelPackage, modelTemplateFiles, modelTestTemplateFiles, modifyFeatureSet, nameMapping, needToImport, openapiNormalizer, outputFolder, parameterNameMapping, postProcess, postProcessAllModels, postProcessModelProperty, 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, toApiVarName, toArrayModelParamName, toBooleanGetter, toDefaultParameterValue, toDefaultParameterValue, toDefaultValue, toDefaultValueWithParam, toExamples, toExampleValue, toGetter, toMediaTypeSchemaName, toModelImportMap, toOneOfName, 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
-
-
-
-
Field Detail
-
emptyMethodNameCounter
protected static int emptyMethodNameCounter
-
shardName
protected String shardName
-
moduleName
protected String moduleName
-
shardVersion
protected String shardVersion
-
specFolder
protected String specFolder
-
srcFolder
protected String srcFolder
-
shardLicense
protected String shardLicense
-
shardHomepage
protected String shardHomepage
-
shardSummary
protected String shardSummary
-
shardDescription
protected String shardDescription
-
shardAuthor
protected String shardAuthor
-
shardAuthorEmail
protected String shardAuthorEmail
-
apiDocPath
protected String apiDocPath
-
modelDocPath
protected String modelDocPath
-
SHARD_NAME
public static final String SHARD_NAME
- See Also:
- Constant Field Values
-
MODULE_NAME
public static final String MODULE_NAME
- See Also:
- Constant Field Values
-
SHARD_VERSION
public static final String SHARD_VERSION
- See Also:
- Constant Field Values
-
SHARD_LICENSE
public static final String SHARD_LICENSE
- See Also:
- Constant Field Values
-
SHARD_HOMEPAGE
public static final String SHARD_HOMEPAGE
- See Also:
- Constant Field Values
-
SHARD_SUMMARY
public static final String SHARD_SUMMARY
- See Also:
- Constant Field Values
-
SHARD_DESCRIPTION
public static final String SHARD_DESCRIPTION
- See Also:
- Constant Field Values
-
SHARD_AUTHOR
public static final String SHARD_AUTHOR
- See Also:
- Constant Field Values
-
SHARD_AUTHOR_EMAIL
public static final String SHARD_AUTHOR_EMAIL
- See Also:
- Constant Field Values
-
-
Method Detail
-
processOpts
public void processOpts()
- Specified by:
processOptsin interfaceCodegenConfig- Overrides:
processOptsin classDefaultCodegen
-
getHelp
public String getHelp()
- Specified by:
getHelpin interfaceCodegenConfig- Overrides:
getHelpin classDefaultCodegen
-
getTag
public CodegenType getTag()
- Specified by:
getTagin interfaceCodegenConfig- Overrides:
getTagin classDefaultCodegen
-
getName
public String getName()
- Specified by:
getNamein interfaceCodegenConfig- Overrides:
getNamein classDefaultCodegen
-
apiFileFolder
public String apiFileFolder()
- Specified by:
apiFileFolderin interfaceCodegenConfig- Overrides:
apiFileFolderin classDefaultCodegen
-
modelFileFolder
public String modelFileFolder()
- Specified by:
modelFileFolderin interfaceCodegenConfig- Overrides:
modelFileFolderin classDefaultCodegen
-
apiTestFileFolder
public String apiTestFileFolder()
- Specified by:
apiTestFileFolderin interfaceCodegenConfig- Overrides:
apiTestFileFolderin classDefaultCodegen
-
modelTestFileFolder
public String modelTestFileFolder()
- Specified by:
modelTestFileFolderin interfaceCodegenConfig- Overrides:
modelTestFileFolderin classDefaultCodegen
-
apiDocFileFolder
public String apiDocFileFolder()
- Specified by:
apiDocFileFolderin interfaceCodegenConfig- Overrides:
apiDocFileFolderin classDefaultCodegen
-
modelDocFileFolder
public String modelDocFileFolder()
- Specified by:
modelDocFileFolderin interfaceCodegenConfig- Overrides:
modelDocFileFolderin classDefaultCodegen
-
getSchemaType
public String getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
Description copied from class:DefaultCodegenreturns the OpenAPI type for the property. Use getAlias to handle $ref of primitive type- Overrides:
getSchemaTypein classDefaultCodegen- Parameters:
schema- property schema- Returns:
- string presentation of the type
-
toModelImport
public String toModelImport(String name)
Description copied from class:DefaultCodegenReturn the fully-qualified "Model" name for import- Specified by:
toModelImportin interfaceCodegenConfig- Overrides:
toModelImportin classDefaultCodegen- Parameters:
name- the name of the "Model"- Returns:
- the fully-qualified "Model" name for import
-
toModelName
public String toModelName(String name)
Description copied from class:DefaultCodegenConverts the OpenAPI schema name to a model name suitable for the current code generator. May be overridden for each programming language. In case the name belongs to the TypeSystem it won't be renamed.- Specified by:
toModelNamein interfaceCodegenConfig- Overrides:
toModelNamein classDefaultCodegen- Parameters:
name- the name of the model- Returns:
- capitalized model name
-
toModelFilename
public String toModelFilename(String name)
Description copied from class:DefaultCodegenReturn 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
-
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
-
toApiFilename
public String toApiFilename(String name)
Description copied from class:DefaultCodegenReturn the file name of the Api Test- Specified by:
toApiFilenamein interfaceCodegenConfig- Overrides:
toApiFilenamein classDefaultCodegen- Parameters:
name- the file name of the Api- Returns:
- the file name of the Api
-
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
-
toApiTestFilename
public String toApiTestFilename(String name)
Description copied from class:DefaultCodegenReturn the file name of the Api Test- Specified by:
toApiTestFilenamein interfaceCodegenConfig- Overrides:
toApiTestFilenamein classDefaultCodegen- Parameters:
name- the file name of the Api- Returns:
- the file name of the Api
-
toModelTestFilename
public String toModelTestFilename(String name)
Description copied from class:DefaultCodegenReturn the capitalized file name of the model test- Specified by:
toModelTestFilenamein interfaceCodegenConfig- Overrides:
toModelTestFilenamein classDefaultCodegen- Parameters:
name- the model name- Returns:
- the file name of the model
-
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
-
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
-
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
-
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
-
toApiImport
public String toApiImport(String name)
Description copied from class:DefaultCodegenReturn the fully-qualified "Api" name for import- Specified by:
toApiImportin interfaceCodegenConfig- Overrides:
toApiImportin classDefaultCodegen- Parameters:
name- the name of the "Api"- Returns:
- the fully-qualified "Api" name for import
-
setShardName
public void setShardName(String shardName)
-
setModuleName
public void setModuleName(String moduleName)
-
setShardVersion
public void setShardVersion(String shardVersion)
-
setShardDescription
public void setShardDescription(String shardDescription)
-
setShardSummary
public void setShardSummary(String shardSummary)
-
setShardLicense
public void setShardLicense(String shardLicense)
-
setShardHomepage
public void setShardHomepage(String shardHomepage)
-
setShardAuthor
public void setShardAuthor(String shardAuthor)
-
setShardAuthorEmail
public void setShardAuthorEmail(String shardAuthorEmail)
-
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.
-
postProcessOperationsWithModels
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels)
- Specified by:
postProcessOperationsWithModelsin interfaceCodegenConfig- Overrides:
postProcessOperationsWithModelsin 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)
-
getTypeDeclaration
public String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema)
Description copied from class:DefaultCodegenOutput the language-specific type declaration of the property.- Specified by:
getTypeDeclarationin interfaceCodegenConfig- Overrides:
getTypeDeclarationin classDefaultCodegen- Parameters:
schema- property schema- Returns:
- a string presentation of the property type
-
toInstantiationType
public String toInstantiationType(io.swagger.v3.oas.models.media.Schema schema)
Description copied from class:DefaultCodegenReturn the instantiation type of the property, especially for map and array- Overrides:
toInstantiationTypein classDefaultCodegen- Parameters:
schema- property schema- Returns:
- string presentation of the instantiation type of the property
-
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
-
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
-
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
-
toRegularExpression
public String toRegularExpression(String pattern)
Description copied from class:DefaultCodegenReturn the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)- Overrides:
toRegularExpressionin classDefaultCodegen- Parameters:
pattern- the pattern (regular expression)- Returns:
- properly-escaped pattern
-
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
-
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
-
generatorLanguage
public GeneratorLanguage generatorLanguage()
- Specified by:
generatorLanguagein interfaceCodegenConfig- Overrides:
generatorLanguagein classDefaultCodegen
-
-