Class AbstractTypeScriptClientCodegen
- java.lang.Object
-
- org.openapitools.codegen.DefaultCodegen
-
- org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen
-
- All Implemented Interfaces:
CodegenConfig
- Direct Known Subclasses:
JavascriptFlowtypedClientCodegen,TypeScriptAngularClientCodegen,TypeScriptAureliaClientCodegen,TypeScriptAxiosClientCodegen,TypeScriptClientCodegen,TypeScriptFetchClientCodegen,TypeScriptInversifyClientCodegen,TypeScriptJqueryClientCodegen,TypeScriptNestjsClientCodegen,TypeScriptNodeClientCodegen,TypeScriptReduxQueryClientCodegen,TypeScriptRxjsClientCodegen
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractTypeScriptClientCodegen.ParameterExpanderHelp generating code for any kind of URL parameters (path, matrix, query).
-
Field Summary
-
Fields inherited from class org.openapitools.codegen.DefaultCodegen
additionalProperties, addOneOfInterfaceImports, addOneOfInterfaces, addSuffixToDuplicateOperationNicknames, allowUnicodeIdentifiers, apiDocTemplateFiles, apiNamePrefix, apiNameSuffix, apiPackage, apiTemplateFiles, apiTestTemplateFiles, autosetConstants, cliOptions, DefaultFeatureSet, defaultIncludes, defaultToEmptyContainer, disallowAdditionalPropertiesIfNotPresent, docExtension, embeddedTemplateDir, enableMinimalUpdate, enablePostProcessFile, ensureUniqueParams, enumNameMapping, 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, openapiGeneratorIgnoreList, openapiNormalizer, operationIdNameMapping, outputFolder, parameterNameMapping, prependFormOrBodyParameters, releaseNote, removeEnumValuePrefix, removeOperationIdPrefix, removeOperationIdPrefixCount, removeOperationIdPrefixDelimiter, reservedWords, reservedWordsMappings, schemaMapping, serverVariables, skipOperationExample, skipOverwrite, skipSortingOperations, sortModelPropertiesByRequiredFlag, sortParamsByRequiredFlag, specialCharReplacements, strictSpecBehavior, supportedLibraries, supportingFiles, supportsAdditionalPropertiesWithComposedSchema, supportsInheritance, supportsMixins, supportsMultipleInheritance, templateDir, templateOutputDirs, testPackage, trueSchema, typeAliases, typeMapping, useOneOfInterfaces, vendorExtensions, versionMetadataFilename, XML_MIME_PATTERN
-
-
Constructor Summary
Constructors Constructor Description AbstractTypeScriptClientCodegen()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddImport(CodegenModel m, String type)protected StringaddPrefix(String name, String prefix)protected StringaddSuffix(String name, String suffix)StringapiFileFolder()StringescapeQuotationMark(String input)Escape single and/or double quote to avoid code injectionStringescapeReservedWord(String name)Return the escaped name of the reserved wordStringescapeText(String input)StringescapeUnsafeCharacters(String input)override with any special text escaping logic to handle unsafe characters so as to avoid code injectionGeneratorLanguagegeneratorLanguage()protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPEgetEnumPropertyNaming()protected StringgetLicenseNameDefaultValue()protected StringgetParameterDataType(io.swagger.v3.oas.models.parameters.Parameter parameter, io.swagger.v3.oas.models.media.Schema p)Returns the data type of parameter.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.protected List<String>getTypesFromSchemas(List<io.swagger.v3.oas.models.media.Schema> schemas)Extracts the list of type names from a list of schemas.protected booleanisEnumPropertyNamingReplaceSpecialChar()protected booleanisReservedWord(String word)StringmodelFileFolder()Map<String,ModelsMap>postProcessAllModels(Map<String,ModelsMap> objs)voidpostProcessFile(File file, String fileType)Post-process the auto-generated file, e.g. using go-fmt to format the Go code.ModelsMappostProcessModels(ModelsMap objs)voidpreprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI)voidprocessOpts()protected voidsetEnumPropertyNaming(String naming)protected voidsetEnumPropertyNamingReplaceSpecialChar(boolean replaceSpecialChars)voidsetModelPropertyNaming(String naming)voidsetParamNaming(String naming)protected voidsupportModelPropertyNaming(CodegenConstants.MODEL_PROPERTY_NAMING_TYPE defaultModelPropertyNaming)StringtoAllOfName(List<String> names, io.swagger.v3.oas.models.media.Schema composedSchema)Return the name of the 'allOf' composed schema.StringtoAnyOfName(List<String> names, io.swagger.v3.oas.models.media.Schema composedSchema)Return the name of the anyOf schemaStringtoDefaultValue(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. status becomes "status"StringtoEnumVarName(String name, String datatype)Return the sanitized variable name for enumStringtoModelFilename(String name)Return the capitalized file name of the modelStringtoModelImport(String name)Return the fully-qualified "Model" name for importMap<String,String>toModelImportMap(String name)Maps the fully qualified model import to the initial given name.StringtoModelName(String name)Converts the OpenAPI schema name to a model name suitable for the current code generator.StringtoOneOfName(List<String> names, io.swagger.v3.oas.models.media.Schema composedSchema)Return the name of the oneOf schema.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.protected StringtoTypescriptTypeName(String name, String safePrefix)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
addAdditionPropertiesToCodeGenModel, addBodyModelSchema, addHeaders, addImport, addImport, addImports, addImports, addImports, addImportsForPropertyType, addImportsToOneOfInterface, additionalProperties, addMustacheLambdas, addOneOfInterfaceModel, addOneOfNameExtension, addOperationToGroup, addOption, addOption, addParentContainer, addParentFromContainer, addProperties, addRegularExpressionDelimiter, addRequiredVarsMap, addSwitch, addVars, addVars, addVarsRequiredVarsAdditionalProps, apiDocFileFolder, apiDocFilename, apiDocTemplateFiles, apiFilename, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, buildEnumVars, buildLibraryCliOption, cliOptions, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, convertPropertyToBooleanAndWriteBack, convertPropertyToStringAndWriteBack, convertPropertyToTypeAndWriteBack, createDiscriminator, defaultIncludes, defaultTemplatingEngine, embeddedTemplateDir, encodePath, enumNameMapping, escapeTextInSingleQuotes, escapeTextWhileAllowingNewLines, executePostProcessor, 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, getCollectionFormat, getCollectionFormat, getConsumesInfo, getContent, getContentType, getDisallowAdditionalPropertiesIfNotPresent, getDocExtension, getEnumDefaultValue, getEnumUnknownDefaultCase, getEnumValueForProperty, getFeatureSet, getFilesMetadataFilename, getGeneratorMetadata, getGitHost, getGitRepoId, getGitUserId, getHelp, getHttpUserAgent, getIgnoreFilePathOverride, getInnerEnumAllowableValues, getInputSpec, getItemsName, getLegacyDiscriminatorBehavior, getLibrary, getModelNameToSchemaCache, getMostInnerItems, getName, getOneOfAnyOfDescendants, getOpenapiGeneratorIgnoreList, getOrGenerateOperationId, getOutputDir, getProducesInfo, getReleaseNote, getSchemaAdditionalProperties, getSchemaFromBooleanOrSchema, getSingleSchemaType, getSupportedVendorExtensions, getSymbolName, getTemplatingEngine, getterAndSetterCapitalize, getTypeDeclaration, getUseInlineModelResolver, getUseOneOfInterfaces, getUseOpenapiNormalizer, getVersionMetadataFilename, handleConstantParams, handleMethodResponse, handleMethodResponse, handleSpecialCharacters, hasBodyParameter, hasFormParameter, importMapping, initializeSpecialCharacterMapping, inlineSchemaNameMapping, inlineSchemaOption, instantiationTypes, isDataTypeBinary, isDataTypeFile, isDataTypeString, isEnableMinimalUpdate, isEnablePostProcessFile, isHideGenerationTimestamp, isJsonMimeType, isJsonVendorMimeType, isLibrary, isParameterNameUnique, isPropertyInnerMostEnum, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isSkipOperationExample, isSkipOverwrite, isSkipSortingOperations, isStrictSpecBehavior, isTypeErasedGenerics, isXmlMimeType, languageSpecificPrimitives, lowerCamelCase, modelDocFileFolder, modelDocTemplateFiles, modelFilename, modelFilename, modelNameMapping, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, modifyFeatureSet, nameMapping, needToImport, openapiGeneratorIgnoreList, openapiNormalizer, operationIdNameMapping, outputFolder, parameterNameMapping, postProcess, postProcessEnumVars, postProcessModelProperty, postProcessModelsEnum, postProcessOperationsWithModels, postProcessParameter, postProcessResponseWithProperty, postProcessSupportingFileData, postProcessWebhooksWithModels, processCompiler, processOpenAPI, processTemplatingEngine, processTestExampleData, removeImport, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, removeOption, removeSelfReferenceImports, reservedWords, reservedWordsMappings, sanitizeName, sanitizeName, sanitizeName, sanitizeTag, schemaMapping, serverVariableOverrides, setAddProps, setCircularReferences, setDocExtension, setEnableMinimalUpdate, setEnablePostProcessFile, setEnumDiscriminatorDefaultValue, setGitHost, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setInputSpec, setLibrary, setNonArrayMapProperty, setOpenAPI, setOutputDir, setParameterBooleanFlagWithCodegenProperty, setParameterEncodingValues, setParameterExamples, setParameterExampleValue, setParameterExampleValue, setParameterExampleValue, setParameterNullable, setReleaseNote, setRemoveEnumValuePrefix, setRemoveOperationIdPrefix, setReservedWordsLowerCase, setSkipOperationExample, setSkipOverwrite, setSkipSortingOperations, setStrictSpecBehavior, setTemplatingEngine, setUseOneOfInterfaces, shouldAddImport, shouldOverwrite, SortModelPropertiesByRequiredFlag, SortParametersByRequiredFlag, specVersionGreaterThanOrEqualTo310, supportedLibraries, supportingFiles, templateDir, templateOutputDirs, testPackage, toApiDocFilename, toApiFilename, toApiImport, toApiName, toApiTestFilename, toApiVarName, toArrayModelParamName, toBooleanGetter, toDefaultParameterValue, toDefaultParameterValue, toDefaultValue, toDefaultValueWithParam, toEnumDefaultValue, toExamples, toExampleValue, toGetter, toInstantiationType, toMediaTypeSchemaName, toModelDocFilename, toModelTestFilename, 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, useCodegenAsMustacheParentContext, 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, apiDocFileFolder, apiDocFilename, apiDocTemplateFiles, apiFilename, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, cliOptions, defaultIncludes, defaultTemplatingEngine, embeddedTemplateDir, encodePath, enumNameMapping, escapeTextWhileAllowingNewLines, fileSuffix, fromModel, fromOperation, fromSecurity, fromServers, fromServerVariables, generateExamplePath, generatorLanguageVersion, getAddSuffixToDuplicateOperationNicknames, getDocExtension, getFeatureSet, getFilesMetadataFilename, getGeneratorMetadata, getGitHost, getGitRepoId, getGitUserId, getHelp, getHttpUserAgent, getIgnoreFilePathOverride, getInputSpec, getLibrary, getName, getOpenapiGeneratorIgnoreList, getOutputDir, getReleaseNote, getSupportedVendorExtensions, getTemplatingEngine, getTypeDeclaration, getUseInlineModelResolver, getUseOpenapiNormalizer, getVersionMetadataFilename, importMapping, inlineSchemaNameMapping, inlineSchemaOption, instantiationTypes, isEnableMinimalUpdate, isEnablePostProcessFile, isHideGenerationTimestamp, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isSkipOperationExample, isSkipOverwrite, isSkipSortingOperations, isStrictSpecBehavior, isTypeErasedGenerics, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelFilename, modelFilename, modelNameMapping, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, nameMapping, openapiGeneratorIgnoreList, openapiNormalizer, operationIdNameMapping, outputFolder, parameterNameMapping, postProcess, postProcessModelProperty, postProcessOperationsWithModels, postProcessParameter, postProcessResponseWithProperty, postProcessSupportingFileData, postProcessWebhooksWithModels, 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, setSkipSortingOperations, setStrictSpecBehavior, setTemplatingEngine, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, templateOutputDirs, testPackage, toApiDocFilename, toApiFilename, toApiImport, toApiName, toApiTestFilename, toApiVarName, toBooleanGetter, toGetter, toModelDocFilename, toModelTestFilename, toSetter, typeMapping, unaliasSchema, updateAllModels, vendorExtensions
-
-
-
-
Field Detail
-
NPM_NAME
public static final String NPM_NAME
- See Also:
- Constant Field Values
-
NPM_VERSION
public static final String NPM_VERSION
- See Also:
- Constant Field Values
-
SNAPSHOT
public static final String SNAPSHOT
- See Also:
- Constant Field Values
-
MODEL_PROPERTY_NAMING_DESC_WITH_WARNING
public static final String MODEL_PROPERTY_NAMING_DESC_WITH_WARNING
- See Also:
- Constant Field Values
-
ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR
public static final String ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR
- See Also:
- Constant Field Values
-
ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR_DESC
public static final String ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR_DESC
- See Also:
- Constant Field Values
-
NULL_SAFE_ADDITIONAL_PROPS
public static final String NULL_SAFE_ADDITIONAL_PROPS
- See Also:
- Constant Field Values
-
NULL_SAFE_ADDITIONAL_PROPS_DESC
public static final String NULL_SAFE_ADDITIONAL_PROPS_DESC
- See Also:
- Constant Field Values
-
LICENSE_NAME_DEFAULT_VALUE
public static final String LICENSE_NAME_DEFAULT_VALUE
- See Also:
- Constant Field Values
-
SNAPSHOT_SUFFIX_FORMAT
protected static final ThreadLocal<SimpleDateFormat> SNAPSHOT_SUFFIX_FORMAT
-
modelPropertyNaming
protected CodegenConstants.MODEL_PROPERTY_NAMING_TYPE modelPropertyNaming
-
enumPropertyNaming
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming
-
paramNaming
protected CodegenConstants.PARAM_NAMING_TYPE paramNaming
-
enumPropertyNamingReplaceSpecialChar
protected boolean enumPropertyNamingReplaceSpecialChar
-
supportsES6
protected Boolean supportsES6
-
nullSafeAdditionalProps
protected Boolean nullSafeAdditionalProps
-
npmName
protected String npmName
-
npmVersion
protected String npmVersion
-
enumSuffix
protected String enumSuffix
-
classEnumSeparator
protected String classEnumSeparator
-
licenseName
protected String licenseName
-
-
Method Detail
-
supportModelPropertyNaming
protected void supportModelPropertyNaming(CodegenConstants.MODEL_PROPERTY_NAMING_TYPE defaultModelPropertyNaming)
-
processOpts
public void processOpts()
- Specified by:
processOptsin interfaceCodegenConfig- Overrides:
processOptsin classDefaultCodegen
-
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
-
toModelImportMap
public Map<String,String> toModelImportMap(String name)
Maps the fully qualified model import to the initial given name. In case of union types the map will have multiple entries. For example for "classA | classB" the map will two entries have ["model.classA","classA"] and ["model.classB","classB"].- Specified by:
toModelImportMapin interfaceCodegenConfig- Overrides:
toModelImportMapin classDefaultCodegen- Parameters:
name- the name of the "Model"- Returns:
- Map between the fully qualified model import and the initial given name.
-
preprocessOpenAPI
public void preprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI)
- Specified by:
preprocessOpenAPIin interfaceCodegenConfig- Overrides:
preprocessOpenAPIin classDefaultCodegen
-
getTag
public CodegenType getTag()
- Specified by:
getTagin interfaceCodegenConfig- Overrides:
getTagin 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)
-
apiFileFolder
public String apiFileFolder()
- Specified by:
apiFileFolderin interfaceCodegenConfig- Overrides:
apiFileFolderin classDefaultCodegen
-
modelFileFolder
public String modelFileFolder()
- Specified by:
modelFileFolderin interfaceCodegenConfig- Overrides:
modelFileFolderin classDefaultCodegen
-
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
-
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
-
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
-
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
-
getParameterDataType
protected String getParameterDataType(io.swagger.v3.oas.models.parameters.Parameter parameter, io.swagger.v3.oas.models.media.Schema p)
Description copied from class:DefaultCodegenReturns the data type of parameter. Returns null by default to use the CodegenProperty.datatype value- Overrides:
getParameterDataTypein classDefaultCodegen- Parameters:
parameter- Parameterp- Schema- Returns:
- data type
-
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
-
isReservedWord
protected boolean isReservedWord(String word)
- Overrides:
isReservedWordin classDefaultCodegen
-
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
-
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
-
setModelPropertyNaming
public void setModelPropertyNaming(String naming)
-
setParamNaming
public void setParamNaming(String naming)
-
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
-
setEnumPropertyNaming
protected void setEnumPropertyNaming(String naming)
-
getEnumPropertyNaming
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE getEnumPropertyNaming()
-
setEnumPropertyNamingReplaceSpecialChar
protected void setEnumPropertyNamingReplaceSpecialChar(boolean replaceSpecialChars)
-
isEnumPropertyNamingReplaceSpecialChar
protected boolean isEnumPropertyNamingReplaceSpecialChar()
-
addImport
protected void addImport(CodegenModel m, String type)
- Overrides:
addImportin classDefaultCodegen
-
postProcessModels
public ModelsMap postProcessModels(ModelsMap objs)
- Specified by:
postProcessModelsin interfaceCodegenConfig- Overrides:
postProcessModelsin classDefaultCodegen
-
postProcessAllModels
public Map<String,ModelsMap> postProcessAllModels(Map<String,ModelsMap> objs)
- Specified by:
postProcessAllModelsin interfaceCodegenConfig- Overrides:
postProcessAllModelsin 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
-
escapeText
public String escapeText(String input)
- Specified by:
escapeTextin interfaceCodegenConfig- Overrides:
escapeTextin classDefaultCodegen
-
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-file", "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
-
toAnyOfName
public String toAnyOfName(List<String> names, io.swagger.v3.oas.models.media.Schema composedSchema)
Description copied from class:DefaultCodegenReturn the name of the anyOf schema- Overrides:
toAnyOfNamein classDefaultCodegen- Parameters:
names- List of namescomposedSchema- composed schema- Returns:
- name of the anyOf schema
-
toOneOfName
public String toOneOfName(List<String> names, io.swagger.v3.oas.models.media.Schema composedSchema)
Description copied from class:DefaultCodegenReturn the name of the oneOf schema.This name is used to set the value of CodegenProperty.openApiType.
If the 'x-one-of-name' extension is specified in the OAS document, return that value. Otherwise, a name is constructed by creating a comma-separated list of all the names of the oneOf schemas.
- Overrides:
toOneOfNamein classDefaultCodegen- Parameters:
names- List of namescomposedSchema- composed schema- Returns:
- name of the oneOf schema
-
toAllOfName
public String toAllOfName(List<String> names, io.swagger.v3.oas.models.media.Schema composedSchema)
Description copied from class:DefaultCodegenReturn the name of the 'allOf' composed schema.- Overrides:
toAllOfNamein classDefaultCodegen- Parameters:
names- List of namescomposedSchema- composed schema- Returns:
- name of the allOf schema
-
getTypesFromSchemas
protected List<String> getTypesFromSchemas(List<io.swagger.v3.oas.models.media.Schema> schemas)
Extracts the list of type names from a list of schemas. Excludes `AnyType` if there are other valid types extracted.- Parameters:
schemas- list of schemas- Returns:
- list of types
-
generatorLanguage
public GeneratorLanguage generatorLanguage()
- Specified by:
generatorLanguagein interfaceCodegenConfig- Overrides:
generatorLanguagein classDefaultCodegen
-
getLicenseNameDefaultValue
protected String getLicenseNameDefaultValue()
-
-