public class JavaScriptClientCodegen extends DefaultCodegenConfig
Modifier and Type | Field and Description |
---|---|
protected String |
apiDocPath |
protected String |
apiTestPath |
static String |
EMIT_JS_DOC |
static String |
EMIT_MODEL_METHODS |
protected boolean |
emitJSDoc |
protected boolean |
emitModelMethods |
protected String |
invokerPackage |
protected String |
licenseName |
protected String |
localVariablePrefix |
protected String |
modelDocPath |
protected String |
modelTestPath |
static String |
MODULE_NAME |
protected String |
moduleName |
static String |
PROJECT_DESCRIPTION |
static String |
PROJECT_NAME |
static String |
PROJECT_VERSION |
protected String |
projectDescription |
protected String |
projectName |
protected String |
projectVersion |
protected String |
sourceFolder |
static String |
USE_INHERITANCE |
static String |
USE_PROMISES |
protected boolean |
usePromises |
additionalProperties, allowUnicodeIdentifiers, apiDocTemplateFiles, apiPackage, apiTemplateFiles, apiTestTemplateFiles, cliOptions, commonTemplateDir, copyFistAllOfProperties, DEFAULT_CONTENT_TYPE, DEFAULT_TEMPLATE_DIR, defaultIncludes, embeddedTemplateDir, ensureUniqueParams, fileSuffix, gitRepoId, gitUserId, hideGenerationTimestamp, httpUserAgent, ignoreFilePathOverride, importMapping, inputSpec, inputURL, instantiationTypes, languageArguments, languageSpecificPrimitives, library, modelDocTemplateFiles, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, openAPI, outputFolder, releaseNote, removeOperationIdPrefix, REQUEST_BODY_NAME, reservedWords, reservedWordsMappings, schemaHandler, skipOverwrite, sortParamsByRequiredFlag, specialCharReplacements, supportedLibraries, supportingFiles, supportsInheritance, supportsMixins, templateDir, templateEngine, templateVersion, testPackage, typeAliases, typeMapping, unflattenedOpenAPI, useOas2, vendorExtensions
Constructor and Description |
---|
JavaScriptClientCodegen() |
Modifier and Type | Method and Description |
---|---|
String |
apiDocFileFolder() |
String |
apiFileFolder() |
String |
apiTestFileFolder() |
String |
escapeQuotationMark(String input)
Escape single and/or double quote to avoid code injection
|
String |
escapeReservedWord(String name)
Return the escaped name of the reserved word
|
String |
escapeUnsafeCharacters(String input)
override with any special text escaping logic to handle unsafe
characters so as to avoid code injection
|
io.swagger.codegen.v3.CodegenModel |
fromModel(String name,
io.swagger.v3.oas.models.media.Schema schema,
Map<String,io.swagger.v3.oas.models.media.Schema> allSchemas)
Convert Swagger Model object to Codegen Model object
|
io.swagger.codegen.v3.CodegenOperation |
fromOperation(String path,
String httpMethod,
io.swagger.v3.oas.models.Operation operation,
Map<String,io.swagger.v3.oas.models.media.Schema> schemas,
io.swagger.v3.oas.models.OpenAPI openAPI)
Convert Swagger Operation object to Codegen Operation object
|
String |
getDefaultTemplateDir() |
String |
getHelp() |
String |
getInvokerPackage() |
String |
getModelPropertyNaming() |
String |
getName() |
String |
getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
returns the swagger type for the property
|
io.swagger.codegen.v3.CodegenType |
getTag() |
String |
getTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema)
Output the type declaration of the property
|
String |
modelDocFileFolder() |
String |
modelFileFolder() |
String |
modelTestFileFolder() |
protected boolean |
needToImport(String type)
Check the type to see if it needs import the library/module/package
|
String |
normalizeType(String type)
Normalize type by wrapping primitive types with single quotes.
|
Map<String,Object> |
postProcessModels(Map<String,Object> objs) |
Map<String,Object> |
postProcessOperations(Map<String,Object> objs) |
void |
preprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI) |
void |
processOpts() |
void |
setEmitJSDoc(boolean emitJSDoc) |
void |
setEmitModelMethods(boolean emitModelMethods) |
void |
setInvokerPackage(String invokerPackage) |
void |
setLicenseName(String licenseName) |
void |
setLocalVariablePrefix(String localVariablePrefix) |
void |
setModelPropertyNaming(String naming) |
void |
setModuleName(String moduleName) |
void |
setParameterExampleValue(io.swagger.codegen.v3.CodegenParameter p)
Return the example value of the parameter.
|
void |
setProjectDescription(String projectDescription) |
void |
setProjectName(String projectName) |
void |
setProjectVersion(String projectVersion) |
void |
setSourceFolder(String sourceFolder) |
void |
setUseInheritance(boolean useInheritance) |
void |
setUsePromises(boolean usePromises) |
String |
toApiDocFilename(String name)
Return the file name of the Api Documentation
|
String |
toApiImport(String name)
Return the fully-qualified "Api" name for import
|
String |
toApiTestFilename(String name)
Return the file name of the Api Test
|
String |
toDefaultValue(io.swagger.v3.oas.models.media.Schema propertySchema)
Return the default value of the property
|
String |
toDefaultValueWithParam(String name,
io.swagger.v3.oas.models.media.Schema schema)
Return the property initialized from a data object
Useful for initialization with a plain object in Javascript
|
String |
toEnumName(io.swagger.codegen.v3.CodegenProperty property)
Return the Enum name (e.g.
|
String |
toEnumValue(String value,
String datatype)
Return the enum value in the language specified format
e.g.
|
String |
toEnumVarName(String value,
String datatype)
Return the sanitized variable name for enum
|
String |
toModelDocFilename(String name)
Return the capitalized file name of the model documentation
|
String |
toModelFilename(String name)
Return the capitalized file name of the model
|
String |
toModelImport(String name)
Return the fully-qualified "Model" name for import
|
String |
toModelName(String name)
Output the proper model name (capitalized).
|
String |
toModelTestFilename(String name)
Return the capitalized file name of the model test
|
String |
toOperationId(String operationId)
Return the operation ID (method name)
|
String |
toParamName(String name)
Return the parameter name by removing invalid characters and proper escaping if
it's a reserved word.
|
String |
toVarName(String name)
Return the variable name by removing invalid characters and proper escaping if
it's a reserved word.
|
addAdditionPropertiesToCodeGenModel, addConsumesInfo, addHandlebarHelpers, addImport, additionalProperties, addOperationToGroup, addOption, addOption, addProducesInfo, addProperties, addRegularExpressionDelimiter, addSwitch, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFilename, apiTestTemplateFiles, buildLibraryCliOption, camelize, camelize, cliOptions, configureDataForTestTemplate, configuresParameterForMediaType, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, dashize, defaultIncludes, detectParent, embeddedTemplateDir, escapeText, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fromModel, fromOperation, fromParameter, fromProperty, fromRequestBody, fromResponse, fromSecurity, generateExamplePath, getAlias, getArgumentsLocation, getCollectionFormat, getCommonTemplateDir, getConsumesInfo, getContentType, getGitRepoId, getGitUserId, getHideGenerationTimestamp, getHttpUserAgent, getIgnoreFilePathOverride, getInnerEnumAllowableValues, getInputSpec, getInputURL, getLanguageArguments, getLibrary, getOptionValue, getOrGenerateOperationId, getOutputDir, getParameterFromRef, getParentName, getProducesInfo, getReleaseNote, getSchemaFromBody, getSchemaFromResponse, getSortParamsByRequiredFlag, getSymbolName, getTemplateDir, getTemplateEngine, getTemplateVersion, getterAndSetterCapitalize, getTypeDeclaration, hasSchemaProperties, hasTrueAdditionalProperties, importMapping, initialCaps, instantiationTypes, isDataTypeBinary, isDataTypeFile, isObjectSchema, isPropertyInnerMostEnum, isRemoveOperationIdPrefix, isReservedWord, isSkipOverwrite, languageSpecificPrimitives, modelDocTemplateFiles, modelPackage, modelTemplateFiles, modelTestTemplateFiles, needsUnflattenedSpec, outputFolder, postProcessAllModels, postProcessModelProperty, postProcessModelsEnum, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, processCompiler, processModelEnums, processOpenAPI, readLanguageArguments, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, setAllowUnicodeIdentifiers, setApiPackage, setCommonTemplateDir, setEnsureUniqueParams, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setInputSpec, setInputURL, setLanguageArguments, setLibrary, setModelNamePrefix, setModelNameSuffix, setModelPackage, setNonArrayMapProperty, setOutputDir, setParameterBooleanFlagWithCodegenProperty, setParameterNullable, setReleaseNote, setRemoveOperationIdPrefix, setReservedWordsLowerCase, setSkipOverwrite, setSortParamsByRequiredFlag, setTemplateDir, setTemplateEngine, setTemplateVersion, setUnflattenedOpenAPI, setUseOas2, shouldOverwrite, snakeCase, supportedLibraries, supportingFiles, templateDir, testPackage, toApiFilename, toApiName, toApiVarName, toBooleanGetter, toEnumDefaultValue, toExamples, toExampleValue, toGetter, toInstantiationType, toRegularExpression, toSetter, typeMapping, underscore, updateCodegenPropertyEnum, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updatePropertyForArray, updatePropertyForMap, vendorExtensions, writeOptional, writePropertyBack
public static final String PROJECT_NAME
public static final String MODULE_NAME
public static final String PROJECT_DESCRIPTION
public static final String PROJECT_VERSION
public static final String USE_PROMISES
public static final String USE_INHERITANCE
public static final String EMIT_MODEL_METHODS
public static final String EMIT_JS_DOC
protected String projectName
protected String moduleName
protected String projectDescription
protected String projectVersion
protected String licenseName
protected String invokerPackage
protected String sourceFolder
protected String localVariablePrefix
protected boolean usePromises
protected boolean emitModelMethods
protected boolean emitJSDoc
protected String apiDocPath
protected String modelDocPath
protected String apiTestPath
protected String modelTestPath
public io.swagger.codegen.v3.CodegenType getTag()
public String getName()
public String getHelp()
public void processOpts()
processOpts
in interface io.swagger.codegen.v3.CodegenConfig
processOpts
in class DefaultCodegenConfig
public void preprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI)
preprocessOpenAPI
in interface io.swagger.codegen.v3.CodegenConfig
preprocessOpenAPI
in class DefaultCodegenConfig
public String escapeReservedWord(String name)
DefaultCodegenConfig
escapeReservedWord
in interface io.swagger.codegen.v3.CodegenConfig
escapeReservedWord
in class DefaultCodegenConfig
name
- the name to be escapedpublic String apiTestFileFolder()
apiTestFileFolder
in interface io.swagger.codegen.v3.CodegenConfig
apiTestFileFolder
in class DefaultCodegenConfig
public String modelTestFileFolder()
modelTestFileFolder
in interface io.swagger.codegen.v3.CodegenConfig
modelTestFileFolder
in class DefaultCodegenConfig
public String apiFileFolder()
apiFileFolder
in interface io.swagger.codegen.v3.CodegenConfig
apiFileFolder
in class DefaultCodegenConfig
public String modelFileFolder()
modelFileFolder
in interface io.swagger.codegen.v3.CodegenConfig
modelFileFolder
in class DefaultCodegenConfig
public String getInvokerPackage()
public void setInvokerPackage(String invokerPackage)
public void setSourceFolder(String sourceFolder)
public void setProjectName(String projectName)
public void setLocalVariablePrefix(String localVariablePrefix)
public void setModuleName(String moduleName)
public void setProjectDescription(String projectDescription)
public void setProjectVersion(String projectVersion)
public void setLicenseName(String licenseName)
public void setUsePromises(boolean usePromises)
public void setUseInheritance(boolean useInheritance)
public void setEmitModelMethods(boolean emitModelMethods)
public void setEmitJSDoc(boolean emitJSDoc)
public String apiDocFileFolder()
apiDocFileFolder
in interface io.swagger.codegen.v3.CodegenConfig
apiDocFileFolder
in class DefaultCodegenConfig
public String modelDocFileFolder()
modelDocFileFolder
in interface io.swagger.codegen.v3.CodegenConfig
modelDocFileFolder
in class DefaultCodegenConfig
public String toApiDocFilename(String name)
DefaultCodegenConfig
toApiDocFilename
in interface io.swagger.codegen.v3.CodegenConfig
toApiDocFilename
in class DefaultCodegenConfig
name
- the file name of the Apipublic String toModelDocFilename(String name)
DefaultCodegenConfig
toModelDocFilename
in interface io.swagger.codegen.v3.CodegenConfig
toModelDocFilename
in class DefaultCodegenConfig
name
- the model namepublic String toApiTestFilename(String name)
DefaultCodegenConfig
toApiTestFilename
in interface io.swagger.codegen.v3.CodegenConfig
toApiTestFilename
in class DefaultCodegenConfig
name
- the file name of the Apipublic String toModelTestFilename(String name)
DefaultCodegenConfig
toModelTestFilename
in interface io.swagger.codegen.v3.CodegenConfig
toModelTestFilename
in class DefaultCodegenConfig
name
- the model namepublic String getModelPropertyNaming()
public String toVarName(String name)
DefaultCodegenConfig
toVarName
in class DefaultCodegenConfig
name
- the variable namepublic String toParamName(String name)
DefaultCodegenConfig
toParamName
in interface io.swagger.codegen.v3.CodegenConfig
toParamName
in class DefaultCodegenConfig
name
- Codegen property objectpublic String toModelName(String name)
DefaultCodegenConfig
toModelName
in interface io.swagger.codegen.v3.CodegenConfig
toModelName
in class DefaultCodegenConfig
name
- the name of the modelpublic String toModelFilename(String name)
DefaultCodegenConfig
toModelFilename
in interface io.swagger.codegen.v3.CodegenConfig
toModelFilename
in class DefaultCodegenConfig
name
- the model namepublic String toModelImport(String name)
DefaultCodegenConfig
toModelImport
in interface io.swagger.codegen.v3.CodegenConfig
toModelImport
in class DefaultCodegenConfig
name
- the name of the "Model"public String toApiImport(String name)
DefaultCodegenConfig
toApiImport
in interface io.swagger.codegen.v3.CodegenConfig
toApiImport
in class DefaultCodegenConfig
name
- the name of the "Api"public String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema)
DefaultCodegenConfig
getTypeDeclaration
in interface io.swagger.codegen.v3.CodegenConfig
getTypeDeclaration
in class DefaultCodegenConfig
schema
- Schema Property objectpublic String toDefaultValue(io.swagger.v3.oas.models.media.Schema propertySchema)
DefaultCodegenConfig
toDefaultValue
in class DefaultCodegenConfig
propertySchema
- Schema property objectpublic void setModelPropertyNaming(String naming)
public String toDefaultValueWithParam(String name, io.swagger.v3.oas.models.media.Schema schema)
DefaultCodegenConfig
toDefaultValueWithParam
in class DefaultCodegenConfig
name
- Name of the property objectschema
- openAPI schema objectpublic void setParameterExampleValue(io.swagger.codegen.v3.CodegenParameter p)
DefaultCodegenConfig
setParameterExampleValue
in class DefaultCodegenConfig
p
- Swagger property objectpublic String normalizeType(String type)
type
- Primitive typepublic String getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
DefaultCodegenConfig
getSchemaType
in class DefaultCodegenConfig
schema
- Schema property objectpublic String toOperationId(String operationId)
DefaultCodegenConfig
toOperationId
in class DefaultCodegenConfig
operationId
- operation IDpublic io.swagger.codegen.v3.CodegenOperation fromOperation(String path, String httpMethod, io.swagger.v3.oas.models.Operation operation, Map<String,io.swagger.v3.oas.models.media.Schema> schemas, io.swagger.v3.oas.models.OpenAPI openAPI)
DefaultCodegenConfig
fromOperation
in interface io.swagger.codegen.v3.CodegenConfig
fromOperation
in class DefaultCodegenConfig
path
- the path of the operationhttpMethod
- HTTP methodoperation
- Swagger operation objectschemas
- a map of schemasopenAPI
- a OpenAPI object representing the specpublic io.swagger.codegen.v3.CodegenModel fromModel(String name, io.swagger.v3.oas.models.media.Schema schema, Map<String,io.swagger.v3.oas.models.media.Schema> allSchemas)
DefaultCodegenConfig
fromModel
in interface io.swagger.codegen.v3.CodegenConfig
fromModel
in class DefaultCodegenConfig
name
- the name of the modelschema
- Swagger Model objectallSchemas
- a map of all Swagger models from the specpublic String getDefaultTemplateDir()
getDefaultTemplateDir
in class DefaultCodegenConfig
public Map<String,Object> postProcessOperations(Map<String,Object> objs)
postProcessOperations
in interface io.swagger.codegen.v3.CodegenConfig
postProcessOperations
in class DefaultCodegenConfig
public Map<String,Object> postProcessModels(Map<String,Object> objs)
postProcessModels
in interface io.swagger.codegen.v3.CodegenConfig
postProcessModels
in class DefaultCodegenConfig
protected boolean needToImport(String type)
DefaultCodegenConfig
needToImport
in class DefaultCodegenConfig
type
- name of the typepublic String toEnumName(io.swagger.codegen.v3.CodegenProperty property)
DefaultCodegenConfig
toEnumName
in class DefaultCodegenConfig
property
- Codegen propertypublic String toEnumVarName(String value, String datatype)
DefaultCodegenConfig
toEnumVarName
in class DefaultCodegenConfig
value
- enum variable namedatatype
- data typepublic String toEnumValue(String value, String datatype)
DefaultCodegenConfig
toEnumValue
in class DefaultCodegenConfig
value
- enum variable namedatatype
- data typepublic String escapeQuotationMark(String input)
DefaultCodegenConfig
escapeQuotationMark
in interface io.swagger.codegen.v3.CodegenConfig
escapeQuotationMark
in class DefaultCodegenConfig
input
- String to be cleaned uppublic String escapeUnsafeCharacters(String input)
DefaultCodegenConfig
escapeUnsafeCharacters
in interface io.swagger.codegen.v3.CodegenConfig
escapeUnsafeCharacters
in class DefaultCodegenConfig
input
- String to be cleaned upCopyright © 2019. All rights reserved.