public abstract class AbstractDartCodegen extends DefaultCodegen
| Modifier and Type | Field and Description |
|---|---|
protected String |
apiDocPath |
protected String |
apiTestPath |
protected static List<String> |
DEFAULT_SUPPORTED_CONTENT_TYPES |
protected Map<String,String> |
imports |
protected String |
modelDocPath |
protected String |
modelTestPath |
static String |
PUB_AUTHOR |
static String |
PUB_AUTHOR_EMAIL |
static String |
PUB_DESCRIPTION |
static String |
PUB_HOMEPAGE |
static String |
PUB_LIBRARY |
static String |
PUB_NAME |
static String |
PUB_VERSION |
protected String |
pubAuthor |
protected String |
pubAuthorEmail |
protected String |
pubDescription |
protected String |
pubHomepage |
protected String |
pubLibrary |
protected String |
pubName |
protected String |
pubVersion |
protected String |
sourceFolder |
static String |
USE_ENUM_EXTENSION |
protected boolean |
useEnumExtension |
additionalProperties, addOneOfInterfaceImports, addOneOfInterfaces, allowUnicodeIdentifiers, apiDocTemplateFiles, apiNamePrefix, apiNameSuffix, apiPackage, apiTemplateFiles, apiTestTemplateFiles, cliOptions, DefaultFeatureSet, defaultIncludes, disallowAdditionalPropertiesIfNotPresent, docExtension, embeddedTemplateDir, enableMinimalUpdate, enablePostProcessFile, ensureUniqueParams, enumUnknownDefaultCase, enumUnknownDefaultCaseName, filesMetadataFilename, fileSuffix, generatorMetadata, gitHost, gitRepoId, gitUserId, hideGenerationTimestamp, httpUserAgent, ignoreFilePathOverride, importMapping, inputSpec, instantiationTypes, JSON_MIME_PATTERN, JSON_VENDOR_MIME_PATTERN, languageSpecificPrimitives, legacyDiscriminatorBehavior, library, modelDocTemplateFiles, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, openAPI, outputFolder, prependFormOrBodyParameters, releaseNote, removeEnumValuePrefix, removeOperationIdPrefix, removeOperationIdPrefixCount, removeOperationIdPrefixDelimiter, reservedWords, reservedWordsMappings, serverVariables, skipOperationExample, skipOverwrite, sortModelPropertiesByRequiredFlag, sortParamsByRequiredFlag, specialCharReplacements, strictSpecBehavior, supportedLibraries, supportingFiles, supportsAdditionalPropertiesWithComposedSchema, supportsInheritance, supportsMixins, supportsMultipleInheritance, templateDir, testPackage, typeAliases, typeMapping, useOneOfInterfaces, vendorExtensions, versionMetadataFilename| Constructor and Description |
|---|
AbstractDartCodegen() |
| 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
|
CodegenOperation |
fromOperation(String path,
String httpMethod,
io.swagger.v3.oas.models.Operation operation,
List<io.swagger.v3.oas.models.servers.Server> servers)
Convert OAS Operation object to Codegen Operation object
|
String |
getHelp() |
String |
getName() |
String |
getSchemaType(io.swagger.v3.oas.models.media.Schema p)
returns the OpenAPI type for the property.
|
CodegenType |
getTag() |
String |
getTypeDeclaration(io.swagger.v3.oas.models.media.Schema p)
Output the language-specific type declaration of the property.
|
protected boolean |
isReservedWord(String word) |
String |
modelDocFileFolder() |
String |
modelFileFolder() |
String |
modelTestFileFolder() |
protected boolean |
needToImport(String type)
Check the type to see if it needs import the library/module/package
|
void |
postProcessFile(File file,
String fileType)
Post-process the auto-generated file, e.g.
|
void |
postProcessModelProperty(CodegenModel model,
CodegenProperty property) |
Map<String,Object> |
postProcessModels(Map<String,Object> objs) |
Map<String,Object> |
postProcessOperationsWithModels(Map<String,Object> objs,
List<Object> allModels) |
void |
processOpts() |
void |
setPubAuthor(String pubAuthor) |
void |
setPubAuthorEmail(String pubAuthorEmail) |
void |
setPubDescription(String pubDescription) |
void |
setPubHomepage(String pubHomepage) |
void |
setPubLibrary(String pubLibrary) |
void |
setPubName(String pubName) |
void |
setPubVersion(String pubVersion) |
void |
setSourceFolder(String sourceFolder) |
void |
setUseEnumExtension(boolean useEnumExtension) |
String |
toApiFilename(String name)
Return the file name of the Api Test
|
String |
toApiTestFilename(String name)
Return the file name of the Api Test
|
String |
toDefaultValue(io.swagger.v3.oas.models.media.Schema schema)
Return the default value of the property
Return null if you do NOT want a default value.
|
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 |
toModelName(String name)
Converts the OpenAPI schema name to a model name suitable for the current code generator.
|
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.
|
protected void |
updateEnumVarsWithExtensions(List<Map<String,Object>> enumVars,
Map<String,Object> vendorExtensions,
String dataType) |
addAdditionPropertiesToCodeGenModel, addBodyModelSchema, addHeaders, addImport, addImportsForPropertyType, addImportsToOneOfInterface, additionalProperties, addMustacheLambdas, addOneOfInterfaceModel, addOneOfNameExtension, addOperationToGroup, addOption, addParentContainer, addProperties, addRegularExpressionDelimiter, addSwitch, addVars, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFilename, apiTestTemplateFiles, buildEnumVars, buildLibraryCliOption, cliOptions, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, createDiscriminator, defaultIncludes, embeddedTemplateDir, encodePath, escapeText, escapeTextWhileAllowingNewLines, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fromCallback, fromFormProperty, fromModel, fromParameter, fromProperty, fromRequestBody, fromRequestBodyToFormParameters, fromResponse, fromSecurity, fromServers, fromServerVariables, generateExamplePath, generateJSONSpecFile, generateYAMLSpecFile, getAdditionalProperties, 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, getLegacyDiscriminatorBehavior, getLibrary, getModelNamePrefix, getModelNameSuffix, getModelNameToSchemaCache, getMostInnerItems, getOneOfAnyOfDescendants, getOrGenerateOperationId, getOutputDir, getParameterDataType, getPrependFormOrBodyParameters, getProducesInfo, getReleaseNote, getRemoveOperationIdPrefixCount, getRemoveOperationIdPrefixDelimiter, getSchemaAdditionalProperties, getSchemaItems, getSingleSchemaType, getSortModelPropertiesByRequiredFlag, getSortParamsByRequiredFlag, getSymbolName, getTemplatingEngine, getterAndSetterCapitalize, getTypeDeclaration, getUseOneOfInterfaces, getVersionMetadataFilename, handleMethodResponse, handleMethodResponse, hasBodyParameter, hasFormParameter, importMapping, initializeSpecialCharacterMapping, instantiationTypes, isAnyTypeSchema, isDataTypeBinary, isDataTypeFile, isDataTypeString, isEnableMinimalUpdate, isEnablePostProcessFile, isFreeFormObject, isHideGenerationTimestamp, isJsonMimeType, isJsonVendorMimeType, isLibrary, isParameterNameUnique, isPropertyInnerMostEnum, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isSkipOperationExample, isSkipOverwrite, isStrictSpecBehavior, languageSpecificPrimitives, lowerCamelCase, modelDocTemplateFiles, modelFilename, modelPackage, modelTemplateFiles, modelTestTemplateFiles, modifyFeatureSet, outputFolder, postProcess, postProcessAllModels, postProcessModelsEnum, postProcessParameter, postProcessSupportingFileData, preprocessOpenAPI, processCompiler, processOpenAPI, processTemplatingEngine, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, removeOption, removeSelfReferenceImports, reservedWords, reservedWordsMappings, sanitizeName, sanitizeName, sanitizeName, sanitizeTag, 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, setParameterContentType, setParameterExampleValue, setParameterExampleValue, setParameterExampleValue, setParameterNullable, setPrependFormOrBodyParameters, setReleaseNote, setRemoveEnumValuePrefix, setRemoveOperationIdPrefix, setRemoveOperationIdPrefixCount, setRemoveOperationIdPrefixDelimiter, setReservedWordsLowerCase, setSkipOperationExample, setSkipOverwrite, setSortModelPropertiesByRequiredFlag, setSortParamsByRequiredFlag, setStrictSpecBehavior, setTemplateDir, setTemplatingEngine, setUseOneOfInterfaces, setVersionMetadataFilename, shouldOverwrite, supportedLibraries, supportingFiles, templateDir, testPackage, toAllOfName, toAnyOfName, toApiDocFilename, toApiImport, toApiName, toApiVarName, toArrayModelParamName, toBooleanGetter, toDefaultParameterValue, toDefaultValueWithParam, toEnumDefaultValue, toEnumName, toExamples, toExampleValue, toGetter, toInstantiationType, toMediaTypeSchemaName, toModelImport, toModelImportMap, toOneOfName, toRegularExpression, toSetter, typeMapping, unaliasPropertySchema, unaliasSchema, updateAllModels, updateCodegenPropertyEnum, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updateModelForAnyType, updateModelForComposedSchema, updateModelForObject, updateOption, updateParameterForString, updatePropertyForAnyType, updatePropertyForArray, updatePropertyForMap, updatePropertyForMap, updatePropertyForObject, updatePropertyForString, updateRequestBodyForArray, updateRequestBodyForMap, updateRequestBodyForObject, updateRequestBodyForPrimitiveType, updateRequestBodyForString, vendorExtensions, writePropertyBackpublic static final String PUB_LIBRARY
public static final String PUB_NAME
public static final String PUB_VERSION
public static final String PUB_DESCRIPTION
public static final String PUB_AUTHOR
public static final String PUB_AUTHOR_EMAIL
public static final String PUB_HOMEPAGE
public static final String USE_ENUM_EXTENSION
protected String pubLibrary
protected String pubName
protected String pubVersion
protected String pubDescription
protected String pubAuthor
protected String pubAuthorEmail
protected String pubHomepage
protected boolean useEnumExtension
protected String sourceFolder
protected String apiDocPath
protected String modelDocPath
protected String apiTestPath
protected String modelTestPath
public CodegenType getTag()
getTag in interface CodegenConfiggetTag in class DefaultCodegenpublic String getName()
getName in interface CodegenConfiggetName in class DefaultCodegenpublic String getHelp()
getHelp in interface CodegenConfiggetHelp in class DefaultCodegenpublic void processOpts()
processOpts in interface CodegenConfigprocessOpts in class DefaultCodegenprotected boolean needToImport(String type)
DefaultCodegenneedToImport in class DefaultCodegentype - name of the typeprotected boolean isReservedWord(String word)
isReservedWord in class DefaultCodegenpublic String escapeReservedWord(String name)
DefaultCodegenescapeReservedWord in interface CodegenConfigescapeReservedWord in class DefaultCodegenname - the name to be escapedthrows Runtime exception as reserved word is not allowed (default behavior)
public String apiFileFolder()
apiFileFolder in interface CodegenConfigapiFileFolder in class DefaultCodegenpublic String modelFileFolder()
modelFileFolder in interface CodegenConfigmodelFileFolder in class DefaultCodegenpublic String apiTestFileFolder()
apiTestFileFolder in interface CodegenConfigapiTestFileFolder in class DefaultCodegenpublic String modelTestFileFolder()
modelTestFileFolder in interface CodegenConfigmodelTestFileFolder in class DefaultCodegenpublic String apiDocFileFolder()
apiDocFileFolder in interface CodegenConfigapiDocFileFolder in class DefaultCodegenpublic String modelDocFileFolder()
modelDocFileFolder in interface CodegenConfigmodelDocFileFolder in class DefaultCodegenpublic String toVarName(String name)
DefaultCodegentoVarName in class DefaultCodegenname - the variable namepublic String toParamName(String name)
DefaultCodegentoParamName in interface CodegenConfigtoParamName in class DefaultCodegenname - Codegen property objectpublic String toModelName(String name)
DefaultCodegentoModelName in interface CodegenConfigtoModelName in class DefaultCodegenname - the name of the modelpublic String toModelFilename(String name)
DefaultCodegentoModelFilename in interface CodegenConfigtoModelFilename in class DefaultCodegenname - the model namepublic String toModelDocFilename(String name)
DefaultCodegentoModelDocFilename in interface CodegenConfigtoModelDocFilename in class DefaultCodegenname - the model namepublic String toApiFilename(String name)
DefaultCodegentoApiFilename in interface CodegenConfigtoApiFilename in class DefaultCodegenname - the file name of the Apipublic String toApiTestFilename(String name)
DefaultCodegentoApiTestFilename in interface CodegenConfigtoApiTestFilename in class DefaultCodegenname - the file name of the Apipublic String toModelTestFilename(String name)
DefaultCodegentoModelTestFilename in interface CodegenConfigtoModelTestFilename in class DefaultCodegenname - the model namepublic String toDefaultValue(io.swagger.v3.oas.models.media.Schema schema)
DefaultCodegentoDefaultValue in class DefaultCodegenschema - Property schemapublic String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema p)
DefaultCodegengetTypeDeclaration in interface CodegenConfiggetTypeDeclaration in class DefaultCodegenp - property schemapublic String getSchemaType(io.swagger.v3.oas.models.media.Schema p)
DefaultCodegengetSchemaType in class DefaultCodegenp - property schemapublic Map<String,Object> postProcessModels(Map<String,Object> objs)
postProcessModels in interface CodegenConfigpostProcessModels in class DefaultCodegenpublic void postProcessModelProperty(CodegenModel model, CodegenProperty property)
postProcessModelProperty in interface CodegenConfigpostProcessModelProperty in class DefaultCodegenpublic CodegenOperation fromOperation(String path, String httpMethod, io.swagger.v3.oas.models.Operation operation, List<io.swagger.v3.oas.models.servers.Server> servers)
DefaultCodegenfromOperation in interface CodegenConfigfromOperation in class DefaultCodegenpath - the path of the operationhttpMethod - HTTP methodoperation - OAS operation objectservers - list of serverspublic Map<String,Object> postProcessOperationsWithModels(Map<String,Object> objs, List<Object> allModels)
postProcessOperationsWithModels in interface CodegenConfigpostProcessOperationsWithModels in class DefaultCodegenprotected void updateEnumVarsWithExtensions(List<Map<String,Object>> enumVars, Map<String,Object> vendorExtensions, String dataType)
updateEnumVarsWithExtensions in class DefaultCodegenpublic String toEnumVarName(String value, String datatype)
DefaultCodegentoEnumVarName in class DefaultCodegenvalue - enum variable namedatatype - data typepublic String toEnumValue(String value, String datatype)
DefaultCodegentoEnumValue in class DefaultCodegenvalue - enum variable namedatatype - data typepublic String toOperationId(String operationId)
DefaultCodegentoOperationId in class DefaultCodegenoperationId - operation IDpublic void setPubLibrary(String pubLibrary)
public void setPubName(String pubName)
public void setPubVersion(String pubVersion)
public void setPubDescription(String pubDescription)
public void setPubAuthor(String pubAuthor)
public void setPubAuthorEmail(String pubAuthorEmail)
public void setPubHomepage(String pubHomepage)
public void setUseEnumExtension(boolean useEnumExtension)
public void setSourceFolder(String sourceFolder)
public String escapeQuotationMark(String input)
DefaultCodegenescapeQuotationMark in interface CodegenConfigescapeQuotationMark in class DefaultCodegeninput - String to be cleaned uppublic String escapeUnsafeCharacters(String input)
DefaultCodegenescapeUnsafeCharacters in interface CodegenConfigescapeUnsafeCharacters in class DefaultCodegeninput - String to be cleaned uppublic void postProcessFile(File file, String fileType)
DefaultCodegenTODO: store these values in enum instead
postProcessFile in interface CodegenConfigpostProcessFile in class DefaultCodegenfile - file to be processedfileType - file typeCopyright © 2021. All rights reserved.