Class TypeScriptNodeClientCodegen
- java.lang.Object
-
- org.openapitools.codegen.DefaultCodegen
-
- org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen
-
- org.openapitools.codegen.languages.TypeScriptNodeClientCodegen
-
- All Implemented Interfaces:
CodegenConfig
public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen
AbstractTypeScriptClientCodegen.ParameterExpander
-
-
Field Summary
Fields Modifier and Type Field Description protected StringapiSuffixstatic StringNPM_REPOSITORYprotected StringnpmRepository-
Fields inherited from class org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen
classEnumSeparator, ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR, ENUM_PROPERTY_NAMING_REPLACE_SPECIAL_CHAR_DESC, enumPropertyNaming, enumPropertyNamingReplaceSpecialChar, enumSuffix, languageGenericTypes, MODEL_PROPERTY_NAMING_DESC_WITH_WARNING, modelPropertyNaming, NPM_NAME, NPM_VERSION, npmName, npmVersion, NULL_SAFE_ADDITIONAL_PROPS, NULL_SAFE_ADDITIONAL_PROPS_DESC, nullSafeAdditionalProps, paramNaming, SNAPSHOT, SNAPSHOT_SUFFIX_FORMAT, supportsES6
-
Fields inherited from class org.openapitools.codegen.DefaultCodegen
additionalProperties, addOneOfInterfaceImports, addOneOfInterfaces, addSuffixToDuplicateOperationNicknames, allowUnicodeIdentifiers, apiDocTemplateFiles, apiNamePrefix, apiNameSuffix, apiPackage, apiTemplateFiles, apiTestTemplateFiles, autosetConstants, cliOptions, DefaultFeatureSet, defaultIncludes, 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, 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 TypeScriptNodeClientCodegen()
-
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.StringgetHelp()StringgetName()StringgetSchemaType(io.swagger.v3.oas.models.media.Schema p)returns the OpenAPI type for the property.StringgetTypeDeclaration(io.swagger.v3.oas.models.media.Schema p)Output the language-specific type declaration of the property.protected voidhandleMethodResponse(io.swagger.v3.oas.models.Operation operation, Map<String,io.swagger.v3.oas.models.media.Schema> schemas, CodegenOperation op, io.swagger.v3.oas.models.responses.ApiResponse methodResponse)Set op's returnBaseType, returnType, examples etc.protected voidhandleMethodResponse(io.swagger.v3.oas.models.Operation operation, Map<String,io.swagger.v3.oas.models.media.Schema> schemas, CodegenOperation op, io.swagger.v3.oas.models.responses.ApiResponse methodResponse, Map<String,String> importMappings)Set op's returnBaseType, returnType, examples etc.booleanisDataTypeFile(String dataType)Map<String,ModelsMap>postProcessAllModels(Map<String,ModelsMap> objs)OperationsMappostProcessOperationsWithModels(OperationsMap operations, List<ModelMap> allModels)voidprocessOpts()StringtoApiFilename(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 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 formatStringtoModelFilename(String name)Return the capitalized file name of the modelStringtoModelImport(String name)Return the fully-qualified "Model" name for import-
Methods inherited from class org.openapitools.codegen.languages.AbstractTypeScriptClientCodegen
addImport, addPrefix, addSuffix, apiFileFolder, escapeQuotationMark, escapeReservedWord, escapeText, escapeUnsafeCharacters, generatorLanguage, getEnumPropertyNaming, getParameterDataType, getTag, getTypesFromSchemas, isEnumPropertyNamingReplaceSpecialChar, isReservedWord, modelFileFolder, postProcessFile, postProcessModels, preprocessOpenAPI, setEnumPropertyNaming, setEnumPropertyNamingReplaceSpecialChar, setModelPropertyNaming, setParamNaming, supportModelPropertyNaming, toAllOfName, toAnyOfName, toEnumName, toEnumValue, toEnumVarName, toModelImportMap, toModelName, toOneOfName, toOperationId, toParamName, toTypescriptTypeName, toVarName
-
Methods inherited from class org.openapitools.codegen.DefaultCodegen
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, 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, getCollectionFormat, getCollectionFormat, getConsumesInfo, getContent, getContentType, getDisallowAdditionalPropertiesIfNotPresent, getDocExtension, getEnumDefaultValue, getEnumUnknownDefaultCase, getFeatureSet, getFilesMetadataFilename, getGeneratorMetadata, getGitHost, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getInnerEnumAllowableValues, getInputSpec, getItemsName, getLegacyDiscriminatorBehavior, getLibrary, getModelNameToSchemaCache, getMostInnerItems, getOneOfAnyOfDescendants, getOpenapiGeneratorIgnoreList, getOrGenerateOperationId, getOutputDir, getProducesInfo, getReleaseNote, getSchemaAdditionalProperties, getSchemaFromBooleanOrSchema, getSingleSchemaType, getSupportedVendorExtensions, getSymbolName, getTemplatingEngine, getterAndSetterCapitalize, getTypeDeclaration, getUseInlineModelResolver, getUseOneOfInterfaces, getUseOpenapiNormalizer, getVersionMetadataFilename, handleConstantParams, handleSpecialCharacters, hasBodyParameter, hasFormParameter, importMapping, initializeSpecialCharacterMapping, inlineSchemaNameMapping, inlineSchemaOption, instantiationTypes, isDataTypeBinary, isDataTypeString, isEnableMinimalUpdate, isEnablePostProcessFile, isHideGenerationTimestamp, isJsonMimeType, isJsonVendorMimeType, isLibrary, isParameterNameUnique, isPropertyInnerMostEnum, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isSkipOperationExample, isSkipOverwrite, 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, 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, setGitHost, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setInputSpec, setLibrary, setNonArrayMapProperty, setOpenAPI, setOutputDir, setParameterBooleanFlagWithCodegenProperty, setParameterEncodingValues, setParameterExamples, setParameterExampleValue, setParameterExampleValue, setParameterExampleValue, setParameterNullable, setReleaseNote, setRemoveEnumValuePrefix, setRemoveOperationIdPrefix, setReservedWordsLowerCase, setSkipOperationExample, setSkipOverwrite, setStrictSpecBehavior, setTemplatingEngine, setUseOneOfInterfaces, shouldAddImport, shouldOverwrite, SortModelPropertiesByRequiredFlag, SortParametersByRequiredFlag, specVersionGreaterThanOrEqualTo310, supportedLibraries, supportingFiles, templateDir, templateOutputDirs, testPackage, toApiDocFilename, 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, getHttpUserAgent, getIgnoreFilePathOverride, getInputSpec, getLibrary, getOpenapiGeneratorIgnoreList, getOutputDir, getReleaseNote, getSupportedVendorExtensions, getTemplatingEngine, getTypeDeclaration, getUseInlineModelResolver, getUseOpenapiNormalizer, getVersionMetadataFilename, importMapping, inlineSchemaNameMapping, inlineSchemaOption, instantiationTypes, isEnableMinimalUpdate, isEnablePostProcessFile, isHideGenerationTimestamp, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isSkipOperationExample, isSkipOverwrite, isStrictSpecBehavior, isTypeErasedGenerics, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelFilename, modelFilename, modelNameMapping, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, nameMapping, openapiGeneratorIgnoreList, openapiNormalizer, operationIdNameMapping, outputFolder, parameterNameMapping, postProcess, postProcessModelProperty, 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, setStrictSpecBehavior, setTemplatingEngine, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, templateOutputDirs, testPackage, toApiDocFilename, toApiTestFilename, toApiVarName, toBooleanGetter, toGetter, toModelDocFilename, toModelTestFilename, toSetter, typeMapping, unaliasSchema, updateAllModels, vendorExtensions
-
-
-
-
Field Detail
-
NPM_REPOSITORY
public static final String NPM_REPOSITORY
- See Also:
- Constant Field Values
-
npmRepository
protected String npmRepository
-
apiSuffix
protected String apiSuffix
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getNamein interfaceCodegenConfig- Overrides:
getNamein classDefaultCodegen
-
getHelp
public String getHelp()
- Specified by:
getHelpin interfaceCodegenConfig- Overrides:
getHelpin classDefaultCodegen
-
isDataTypeFile
public boolean isDataTypeFile(String dataType)
- Overrides:
isDataTypeFilein 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 classAbstractTypeScriptClientCodegen- Parameters:
p- property schema- Returns:
- a string presentation of the property type
-
handleMethodResponse
protected void handleMethodResponse(io.swagger.v3.oas.models.Operation operation, Map<String,io.swagger.v3.oas.models.media.Schema> schemas, CodegenOperation op, io.swagger.v3.oas.models.responses.ApiResponse methodResponse)Description copied from class:DefaultCodegenSet op's returnBaseType, returnType, examples etc.- Overrides:
handleMethodResponsein classDefaultCodegen- Parameters:
operation- endpoint Operationschemas- a map of the schemas in the openapi specop- endpoint CodegenOperationmethodResponse- the default ApiResponse for the endpoint
-
handleMethodResponse
protected void handleMethodResponse(io.swagger.v3.oas.models.Operation operation, Map<String,io.swagger.v3.oas.models.media.Schema> schemas, CodegenOperation op, io.swagger.v3.oas.models.responses.ApiResponse methodResponse, Map<String,String> importMappings)Description copied from class:DefaultCodegenSet op's returnBaseType, returnType, examples etc.- Overrides:
handleMethodResponsein classDefaultCodegen- Parameters:
operation- endpoint Operationschemas- a map of the schemas in the openapi specop- endpoint CodegenOperationmethodResponse- the default ApiResponse for the endpointimportMappings- mappings of external types to be omitted by unaliasing
-
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
-
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
-
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
-
toModelFilename
public String toModelFilename(String name)
Description copied from class:DefaultCodegenReturn the capitalized file name of the model- Specified by:
toModelFilenamein interfaceCodegenConfig- Overrides:
toModelFilenamein classAbstractTypeScriptClientCodegen- Parameters:
name- the model name- Returns:
- the file name of the model
-
toModelImport
public String toModelImport(String name)
Description copied from class:DefaultCodegenReturn the fully-qualified "Model" name for import- Specified by:
toModelImportin interfaceCodegenConfig- Overrides:
toModelImportin classAbstractTypeScriptClientCodegen- Parameters:
name- the name of the "Model"- Returns:
- the fully-qualified "Model" name for import
-
postProcessAllModels
public Map<String,ModelsMap> postProcessAllModels(Map<String,ModelsMap> objs)
- Specified by:
postProcessAllModelsin interfaceCodegenConfig- Overrides:
postProcessAllModelsin classAbstractTypeScriptClientCodegen
-
postProcessOperationsWithModels
public OperationsMap postProcessOperationsWithModels(OperationsMap operations, List<ModelMap> allModels)
- Specified by:
postProcessOperationsWithModelsin interfaceCodegenConfig- Overrides:
postProcessOperationsWithModelsin classDefaultCodegen
-
processOpts
public void processOpts()
- Specified by:
processOptsin interfaceCodegenConfig- Overrides:
processOptsin classAbstractTypeScriptClientCodegen
-
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 classAbstractTypeScriptClientCodegen- Parameters:
p- property schema- Returns:
- string presentation of the type
-
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.
-
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 classAbstractTypeScriptClientCodegen- 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 classAbstractTypeScriptClientCodegen- Parameters:
value- enum variable namedatatype- data type- Returns:
- the default value for the enum
-
-