Class AbstractPythonCodegen

    • Field Detail

      • packageName

        protected String packageName
      • packageVersion

        protected String packageVersion
      • projectName

        protected String projectName
    • Constructor Detail

      • AbstractPythonCodegen

        public AbstractPythonCodegen()
    • Method Detail

      • toDefaultValue

        public String toDefaultValue​(io.swagger.v3.oas.models.media.Schema p)
        Return the default value of the property
        Overrides:
        toDefaultValue in class DefaultCodegen
        Parameters:
        p - OpenAPI property object
        Returns:
        string presentation of the default value of the property
      • toVarName

        public String toVarName​(String name)
        Description copied from class: DefaultCodegen
        Return the variable name by removing invalid characters and proper escaping if it's a reserved word.
        Overrides:
        toVarName in class DefaultCodegen
        Parameters:
        name - the variable name
        Returns:
        the sanitized variable name
      • toRegularExpression

        public String toRegularExpression​(String pattern)
        Description copied from class: DefaultCodegen
        Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)
        Overrides:
        toRegularExpression in class DefaultCodegen
        Parameters:
        pattern - the pattern (regular expression)
        Returns:
        properly-escaped pattern
      • toParamName

        public String toParamName​(String name)
        Description copied from class: DefaultCodegen
        Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.
        Specified by:
        toParamName in interface CodegenConfig
        Overrides:
        toParamName in class DefaultCodegen
        Parameters:
        name - Codegen property object
        Returns:
        the sanitized parameter name
      • toOperationId

        public String toOperationId​(String operationId)
        Description copied from class: DefaultCodegen
        Return the operation ID (method name)
        Overrides:
        toOperationId in class DefaultCodegen
        Parameters:
        operationId - operation ID
        Returns:
        the sanitized method name
      • postProcessFile

        public void postProcessFile​(File file,
                                    String fileType)
        Description copied from class: DefaultCodegen
        Post-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-mustache", "supporting-common", "openapi-generator-ignore", "openapi-generator-version"

        TODO: store these values in enum instead

        Specified by:
        postProcessFile in interface CodegenConfig
        Overrides:
        postProcessFile in class DefaultCodegen
        Parameters:
        file - file to be processed
        fileType - file type
      • toExampleValue

        public String toExampleValue​(io.swagger.v3.oas.models.media.Schema schema)
        Description copied from class: DefaultCodegen
        Return the example value of the property

        This method should be overridden in the generator to meet its requirement.

        Overrides:
        toExampleValue in class DefaultCodegen
        Parameters:
        schema - Property schema
        Returns:
        string presentation of the example value of the property
      • setParameterExampleValue

        public void setParameterExampleValue​(CodegenParameter codegenParameter,
                                             io.swagger.v3.oas.models.parameters.Parameter parameter)
        Description copied from class: DefaultCodegen
        Return the example value of the parameter.
        Overrides:
        setParameterExampleValue in class DefaultCodegen
        Parameters:
        codegenParameter - Codegen parameter
        parameter - Parameter
      • patternCorrection

        public String patternCorrection​(String pattern)
      • setPackageName

        public void setPackageName​(String packageName)
      • setProjectName

        public void setProjectName​(String projectName)
      • setPackageVersion

        public void setPackageVersion​(String packageVersion)
      • getSchemaType

        public String getSchemaType​(io.swagger.v3.oas.models.media.Schema p)
        Description copied from class: DefaultCodegen
        returns the OpenAPI type for the property. Use getAlias to handle $ref of primitive type
        Overrides:
        getSchemaType in class DefaultCodegen
        Parameters:
        p - property schema
        Returns:
        string presentation of the type
      • toModelName

        public String toModelName​(String name)
        Description copied from class: DefaultCodegen
        Converts 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:
        toModelName in interface CodegenConfig
        Overrides:
        toModelName in class DefaultCodegen
        Parameters:
        name - the name of the model
        Returns:
        capitalized model name
      • 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 interface CodegenConfig
        Overrides:
        toApiName in class DefaultCodegen
        Parameters:
        name - the name of the Api
        Returns:
        capitalized Api name
      • dropDots

        protected static String dropDots​(String str)