Class AbstractScalaCodegen

    • Field Detail

      • modelPropertyNaming

        protected String modelPropertyNaming
      • invokerPackage

        protected String invokerPackage
      • sourceFolder

        protected String sourceFolder
      • appName

        protected String appName
      • appDescription

        protected String appDescription
      • infoUrl

        protected String infoUrl
      • infoEmail

        protected String infoEmail
      • licenseInfo

        protected String licenseInfo
      • licenseUrl

        protected String licenseUrl
      • apiVersion

        protected String apiVersion
      • stripPackageName

        protected boolean stripPackageName
      • dateLibrary

        protected String dateLibrary
    • Constructor Detail

      • AbstractScalaCodegen

        public AbstractScalaCodegen()
    • Method Detail

      • setDateLibrary

        public void setDateLibrary​(String dateLibrary,
                                   boolean withLegacy)
      • getDateLibrary

        public String getDateLibrary()
      • setModelPropertyNaming

        public void setModelPropertyNaming​(String naming)
      • getModelPropertyNaming

        public String getModelPropertyNaming()
      • 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
      • getNameUsingModelPropertyNaming

        public String getNameUsingModelPropertyNaming​(String name)
      • getSourceFolder

        public String getSourceFolder()
      • setSourceFolder

        public void setSourceFolder​(String sourceFolder)
      • 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
      • toInstantiationType

        public String toInstantiationType​(io.swagger.v3.oas.models.media.Schema p)
        Description copied from class: DefaultCodegen
        Return the instantiation type of the property, especially for map and array
        Overrides:
        toInstantiationType in class DefaultCodegen
        Parameters:
        p - property schema
        Returns:
        string presentation of the instantiation type of the property
      • toDefaultValue

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

        This 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:
        toDefaultValue in class DefaultCodegen
        Parameters:
        p - Property schema
        Returns:
        string presentation of the default value of the property
      • fromProperty

        public CodegenProperty fromProperty​(String name,
                                            io.swagger.v3.oas.models.media.Schema p,
                                            boolean required)
        Convert OAS Property object to Codegen Property object
        Overrides:
        fromProperty in class DefaultCodegen
        Parameters:
        name - name of the property
        p - OAS property object
        required - true if the property is required in the next higher object schema, false otherwise
        Returns:
        Codegen Property object
      • 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
      • formatIdentifier

        protected String formatIdentifier​(String name,
                                          boolean capitalized)
      • stripPackageName

        protected String stripPackageName​(String input)
      • 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
      • 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
      • setInvokerPackage

        public void setInvokerPackage​(String invokerPackage)