Class AbstractPythonConnexionServerCodegen
- java.lang.Object
-
- org.openapitools.codegen.DefaultCodegen
-
- org.openapitools.codegen.languages.AbstractPythonCodegen
-
- org.openapitools.codegen.languages.AbstractPythonConnexionServerCodegen
-
- All Implemented Interfaces:
CodegenConfig
- Direct Known Subclasses:
PythonAiohttpConnexionServerCodegen
,PythonBluePlanetServerCodegen
,PythonFlaskConnexionServerCodegen
public abstract class AbstractPythonConnexionServerCodegen extends AbstractPythonCodegen implements CodegenConfig
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTROLLER_PACKAGE
protected String
controllerPackage
static String
DEFAULT_CONTROLLER
protected String
defaultController
static String
FEATURE_CORS
protected boolean
featureCORS
protected boolean
fixBodyName
static String
MOVE_TESTS_UNDER_PYTHON_SRC_ROOT
protected boolean
moveTestsUnderPythonSrcRoot
static String
PYTHON_SRC_ROOT
protected String
pythonSrcRoot
protected Map<Character,String>
regexModifiers
protected int
serverPort
static String
USE_NOSE
static String
USE_PYTHON_SRC_ROOT_IN_IMPORTS
protected boolean
useNose
protected boolean
usePythonSrcRootInImports
-
Fields inherited from class org.openapitools.codegen.languages.AbstractPythonCodegen
hasModelsToImport, MAP_NUMBER_TO, mapNumberTo, packageName, packageVersion, projectName
-
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 AbstractPythonConnexionServerCodegen(String templateDirectory, boolean fixBodyNameValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addSupportingFiles()
String
apiFileFolder()
Location to write api files.String
apiPackage()
String
getHelp()
Returns human-friendly help for the generator.CodegenType
getTag()
Configures the type of generator.String
getTypeDeclaration(io.swagger.v3.oas.models.media.Schema p)
Output the language-specific type declaration of the property.String
modelFileFolder()
String
packagePath()
Map<String,ModelsMap>
postProcessAllModels(Map<String,ModelsMap> objs)
void
postProcessModelProperty(CodegenModel model, CodegenProperty property)
ModelsMap
postProcessModels(ModelsMap objs)
OperationsMap
postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels)
void
postProcessParameter(CodegenParameter parameter)
void
postProcessPattern(String pattern, Map<String,Object> vendorExtensions)
Map<String,Object>
postProcessSupportingFileData(Map<String,Object> objs)
void
preprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI)
void
processOpts()
String
pythonSrcOutputFolder()
void
setFeatureCORS(String val)
void
setMoveTestsUnderPythonSrcRoot(String val)
void
setPythonSrcRoot(String val)
void
setUseNose(String val)
void
setUsePythonSrcRootInImports(String val)
String
toApiName(String name)
Output the API (class) name (capitalized) ending with the specified or default suffix Return DefaultApi if name is emptyString
toApiTestFilename(String name)
Return the file name of the Api TestString
toModelImport(String name)
Return the fully-qualified "Model" name for import-
Methods inherited from class org.openapitools.codegen.languages.AbstractPythonCodegen
addRegularExpressionDelimiter, dropDots, escapeQuotationMark, escapeReservedWord, escapeUnsafeCharacters, generatorLanguage, getSchemaType, patternCorrection, postProcessFile, sanitizeTag, setMapNumberTo, setPackageName, setPackageVersion, setParameterExampleValue, setParameterExampleValue, setProjectName, toApiFilename, toApiVarName, toDefaultValue, toEnumDefaultValue, toEnumValue, toEnumVariableName, toEnumVarName, toExampleValue, toModelFilename, toModelName, toModelTestFilename, toOperationId, toParamName, toRegularExpression, toVarName, updateImportsFromCodegenModel
-
Methods inherited from class org.openapitools.codegen.DefaultCodegen
addAdditionPropertiesToCodeGenModel, addBodyModelSchema, addHeaders, addImport, addImport, addImport, addImports, addImports, addImports, addImportsForPropertyType, addImportsToOneOfInterface, additionalProperties, addMustacheLambdas, addOneOfInterfaceModel, addOneOfNameExtension, addOperationToGroup, addOption, addOption, addParentContainer, addProperties, addRequiredVarsMap, addSwitch, addVars, addVars, addVarsRequiredVarsAdditionalProps, apiDocFileFolder, apiDocFilename, apiDocTemplateFiles, apiFilename, apiTemplateFiles, apiTestFileFolder, 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, getName, 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, modelDocFileFolder, modelDocTemplateFiles, modelFilename, modelNameMapping, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, modifyFeatureSet, nameMapping, needToImport, openapiNormalizer, outputFolder, parameterNameMapping, postProcess, postProcessModelsEnum, processCompiler, processOpenAPI, processTemplatingEngine, processTestExampleData, removeImport, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, removeOption, removeSelfReferenceImports, reservedWords, reservedWordsMappings, sanitizeName, sanitizeName, sanitizeName, 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, 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, toApiDocFilename, toApiImport, toArrayModelParamName, toBooleanGetter, toDefaultParameterValue, toDefaultParameterValue, toDefaultValue, toDefaultValueWithParam, toEnumName, toExamples, toGetter, toInstantiationType, toMediaTypeSchemaName, toModelDocFilename, 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
-
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, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, cliOptions, defaultIncludes, defaultTemplatingEngine, embeddedTemplateDir, encodePath, escapeQuotationMark, escapeReservedWord, escapeText, escapeTextWhileAllowingNewLines, escapeUnsafeCharacters, fileSuffix, fromModel, fromOperation, fromSecurity, fromServers, fromServerVariables, generateExamplePath, generatorLanguage, generatorLanguageVersion, getAddSuffixToDuplicateOperationNicknames, getDocExtension, getFeatureSet, getFilesMetadataFilename, getGeneratorMetadata, getGitHost, getGitRepoId, getGitUserId, getHttpUserAgent, getIgnoreFilePathOverride, getInputSpec, getLibrary, getName, getOutputDir, getReleaseNote, getSupportedVendorExtensions, getTemplatingEngine, getTypeDeclaration, getUseInlineModelResolver, getUseOpenAPINormalizer, getVersionMetadataFilename, importMapping, inlineSchemaNameMapping, inlineSchemaOption, instantiationTypes, isEnableMinimalUpdate, isEnablePostProcessFile, isHideGenerationTimestamp, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isSkipOperationExample, isSkipOverwrite, isStrictSpecBehavior, languageSpecificPrimitives, modelDocFileFolder, modelDocTemplateFiles, modelFilename, modelNameMapping, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, nameMapping, openapiNormalizer, outputFolder, parameterNameMapping, postProcess, postProcessFile, 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, testPackage, toApiDocFilename, toApiFilename, toApiImport, toApiVarName, toBooleanGetter, toGetter, toModelDocFilename, toModelFilename, toModelImportMap, toModelName, toModelTestFilename, toParamName, toSetter, typeMapping, unaliasSchema, updateAllModels, vendorExtensions
-
-
-
-
Field Detail
-
CONTROLLER_PACKAGE
public static final String CONTROLLER_PACKAGE
- See Also:
- Constant Field Values
-
DEFAULT_CONTROLLER
public static final String DEFAULT_CONTROLLER
- See Also:
- Constant Field Values
-
FEATURE_CORS
public static final String FEATURE_CORS
- See Also:
- Constant Field Values
-
USE_NOSE
public static final String USE_NOSE
- See Also:
- Constant Field Values
-
PYTHON_SRC_ROOT
public static final String PYTHON_SRC_ROOT
- See Also:
- Constant Field Values
-
USE_PYTHON_SRC_ROOT_IN_IMPORTS
public static final String USE_PYTHON_SRC_ROOT_IN_IMPORTS
- See Also:
- Constant Field Values
-
MOVE_TESTS_UNDER_PYTHON_SRC_ROOT
public static final String MOVE_TESTS_UNDER_PYTHON_SRC_ROOT
- See Also:
- Constant Field Values
-
serverPort
protected int serverPort
-
controllerPackage
protected String controllerPackage
-
defaultController
protected String defaultController
-
fixBodyName
protected boolean fixBodyName
-
featureCORS
protected boolean featureCORS
-
useNose
protected boolean useNose
-
pythonSrcRoot
protected String pythonSrcRoot
-
usePythonSrcRootInImports
protected boolean usePythonSrcRootInImports
-
moveTestsUnderPythonSrcRoot
protected boolean moveTestsUnderPythonSrcRoot
-
-
Constructor Detail
-
AbstractPythonConnexionServerCodegen
public AbstractPythonConnexionServerCodegen(String templateDirectory, boolean fixBodyNameValue)
-
-
Method Detail
-
addSupportingFiles
protected void addSupportingFiles()
-
processOpts
public void processOpts()
- Specified by:
processOpts
in interfaceCodegenConfig
- Overrides:
processOpts
in classAbstractPythonCodegen
-
setFeatureCORS
public void setFeatureCORS(String val)
-
setUseNose
public void setUseNose(String val)
-
setPythonSrcRoot
public void setPythonSrcRoot(String val)
-
setUsePythonSrcRootInImports
public void setUsePythonSrcRootInImports(String val)
-
setMoveTestsUnderPythonSrcRoot
public void setMoveTestsUnderPythonSrcRoot(String val)
-
pythonSrcOutputFolder
public String pythonSrcOutputFolder()
-
apiPackage
public String apiPackage()
- Specified by:
apiPackage
in interfaceCodegenConfig
- Overrides:
apiPackage
in classDefaultCodegen
-
getTag
public CodegenType getTag()
Configures the type of generator.- Specified by:
getTag
in interfaceCodegenConfig
- Overrides:
getTag
in classDefaultCodegen
- Returns:
- the CodegenType for this generator
- See Also:
CodegenType
-
getHelp
public String getHelp()
Returns human-friendly help for the generator. Provide the consumer with help tips, parameters here- Specified by:
getHelp
in interfaceCodegenConfig
- Overrides:
getHelp
in classDefaultCodegen
- Returns:
- A string value for the help message
-
toApiName
public String toApiName(String name)
Description copied from class:DefaultCodegen
Output the API (class) name (capitalized) ending with the specified or default suffix Return DefaultApi if name is empty- Specified by:
toApiName
in interfaceCodegenConfig
- Overrides:
toApiName
in classAbstractPythonCodegen
- Parameters:
name
- the name of the Api- Returns:
- capitalized Api name
-
toApiTestFilename
public String toApiTestFilename(String name)
Description copied from class:DefaultCodegen
Return the file name of the Api Test- Specified by:
toApiTestFilename
in interfaceCodegenConfig
- Overrides:
toApiTestFilename
in classAbstractPythonCodegen
- Parameters:
name
- the file name of the Api- Returns:
- the file name of the Api
-
apiFileFolder
public String apiFileFolder()
Location to write api files. You can use the apiPackage() as defined when the class is instantiated- Specified by:
apiFileFolder
in interfaceCodegenConfig
- Overrides:
apiFileFolder
in classDefaultCodegen
-
modelFileFolder
public String modelFileFolder()
- Specified by:
modelFileFolder
in interfaceCodegenConfig
- Overrides:
modelFileFolder
in classDefaultCodegen
-
getTypeDeclaration
public String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema p)
Description copied from class:DefaultCodegen
Output the language-specific type declaration of the property.- Specified by:
getTypeDeclaration
in interfaceCodegenConfig
- Overrides:
getTypeDeclaration
in classAbstractPythonCodegen
- Parameters:
p
- property schema- Returns:
- a string presentation of the property type
-
preprocessOpenAPI
public void preprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI)
- Specified by:
preprocessOpenAPI
in interfaceCodegenConfig
- Overrides:
preprocessOpenAPI
in classDefaultCodegen
-
postProcessSupportingFileData
public Map<String,Object> postProcessSupportingFileData(Map<String,Object> objs)
- Specified by:
postProcessSupportingFileData
in interfaceCodegenConfig
- Overrides:
postProcessSupportingFileData
in classDefaultCodegen
-
packagePath
public String packagePath()
-
toModelImport
public String toModelImport(String name)
Description copied from class:DefaultCodegen
Return the fully-qualified "Model" name for import- Specified by:
toModelImport
in interfaceCodegenConfig
- Overrides:
toModelImport
in classDefaultCodegen
- Parameters:
name
- the name of the "Model"- Returns:
- the fully-qualified "Model" name for import
-
postProcessModelProperty
public void postProcessModelProperty(CodegenModel model, CodegenProperty property)
- Specified by:
postProcessModelProperty
in interfaceCodegenConfig
- Overrides:
postProcessModelProperty
in classAbstractPythonCodegen
-
postProcessModels
public ModelsMap postProcessModels(ModelsMap objs)
- Specified by:
postProcessModels
in interfaceCodegenConfig
- Overrides:
postProcessModels
in classAbstractPythonCodegen
-
postProcessAllModels
public Map<String,ModelsMap> postProcessAllModels(Map<String,ModelsMap> objs)
- Specified by:
postProcessAllModels
in interfaceCodegenConfig
- Overrides:
postProcessAllModels
in classAbstractPythonCodegen
-
postProcessParameter
public void postProcessParameter(CodegenParameter parameter)
- Specified by:
postProcessParameter
in interfaceCodegenConfig
- Overrides:
postProcessParameter
in classAbstractPythonCodegen
-
postProcessOperationsWithModels
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels)
- Specified by:
postProcessOperationsWithModels
in interfaceCodegenConfig
- Overrides:
postProcessOperationsWithModels
in classAbstractPythonCodegen
-
postProcessPattern
public void postProcessPattern(String pattern, Map<String,Object> vendorExtensions)
- Overrides:
postProcessPattern
in classAbstractPythonCodegen
-
-