Class AbstractJuliaCodegen
- java.lang.Object
-
- org.openapitools.codegen.DefaultCodegen
-
- org.openapitools.codegen.languages.AbstractJuliaCodegen
-
- All Implemented Interfaces:
CodegenConfig
- Direct Known Subclasses:
JuliaClientCodegen
,JuliaServerCodegen
public abstract class AbstractJuliaCodegen extends DefaultCodegen
-
-
Field Summary
Fields Modifier and Type Field Description protected String
apiDocPath
protected String
apiSrcPath
protected Boolean
exportModels
protected Boolean
exportOperations
protected org.slf4j.Logger
LOGGER
protected String
modelDocPath
protected String
modelSrcPath
protected String
packageName
protected String
srcPath
-
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, inlineSchemaNameDefault, inlineSchemaNameMapping, inputSpec, instantiationTypes, JSON_MIME_PATTERN, JSON_VENDOR_MIME_PATTERN, languageSpecificPrimitives, legacyDiscriminatorBehavior, library, loadDeepObjectIntoItems, modelDocTemplateFiles, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, openAPI, openapiNormalizer, outputFolder, 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
-
-
Constructor Summary
Constructors Constructor Description AbstractJuliaCodegen()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.google.common.collect.ImmutableMap.Builder<String,com.samskivert.mustache.Mustache.Lambda>
addMustacheLambdas()
Preset map builder with commonly used Mustache lambdas.String
apiDocFileFolder()
String
apiFileFolder()
Location to write api files.protected static String
dropDots(String str)
String
escapeQuotationMark(String input)
Escape single and/or double quote to avoid code injectionprotected String
escapeRegex(String pattern)
String
escapeReservedWord(String name)
Escapes a reserved word as defined in the `reservedWords` array.String
escapeUnsafeCharacters(String input)
override with any special text escaping logic to handle unsafe characters so as to avoid code injectionCodegenOperation
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 objectCodegenParameter
fromParameter(io.swagger.v3.oas.models.parameters.Parameter param, Set<String> imports)
Convert OpenAPI Parameter object to Codegen Parameter objectCodegenProperty
fromProperty(String name, io.swagger.v3.oas.models.media.Schema schema, boolean required)
Convert OAS Property schema to Codegen Property object.GeneratorLanguage
generatorLanguage()
String
getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
Return the type declaration for a given schemaString
getTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema)
Output the language-specific type declaration of the property.String
modelDocFileFolder()
String
modelFileFolder()
Location to write model files.protected boolean
needsVarEscape(String name)
String
sanitizeName(String name)
Sanitize name (parameter, property, method, etc)void
setExportModels(Boolean exportModels)
void
setExportOperations(Boolean exportOperations)
void
setPackageName(String packageName)
String
toApiFilename(String name)
Return the file name of the Api TestString
toApiName(String name)
Output the API (class) name (capitalized) ending with the specified or default suffix Return DefaultApi if name is emptyString
toApiVarName(String name)
Return the variable name in the ApiString
toDefaultValue(io.swagger.v3.oas.models.media.Schema schema)
Return the default value of the propertyString
toModelFilename(String name)
Return the capitalized file name of the modelString
toModelName(String name)
Output the proper Julia model name.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.-
Methods inherited from class org.openapitools.codegen.DefaultCodegen
addAdditionPropertiesToCodeGenModel, addBodyModelSchema, addHeaders, addImport, addImport, addImport, addImports, addImports, addImports, addImportsForPropertyType, addImportsToOneOfInterface, additionalProperties, addOneOfInterfaceModel, addOneOfNameExtension, addOperationToGroup, addOption, addOption, addParentContainer, addProperties, addRegularExpressionDelimiter, addRequiredVarsMap, addSwitch, addVars, addVars, addVarsRequiredVarsAdditionalProps, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFileFolder, apiTestFilename, apiTestTemplateFiles, buildEnumVars, buildLibraryCliOption, cliOptions, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, createDiscriminator, defaultIncludes, defaultTemplatingEngine, embeddedTemplateDir, encodePath, escapeText, escapeTextWhileAllowingNewLines, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fromCallback, fromFormProperty, fromModel, fromProperty, fromProperty, fromRequestBody, fromRequestBodyToFormParameters, fromResponse, fromSecurity, fromServers, fromServerVariables, generateExamplePath, generateJSONSpecFile, generateYAMLSpecFile, generatorLanguageVersion, getAdditionalProperties, getAdditionalPropertiesName, getAddSuffixToDuplicateOperationNicknames, getAlias, getAllModels, getAllOfDescendants, getAllowUnicodeIdentifiers, getApiNamePrefix, getApiNameSuffix, getCollectionFormat, getCollectionFormat, getConsumesInfo, getContent, getContentType, getDisallowAdditionalPropertiesIfNotPresent, getDocExtension, getEnsureUniqueParams, getEnumDefaultValue, getEnumUnknownDefaultCase, getFeatureSet, getFilesMetadataFilename, getGeneratorMetadata, getGitHost, getGitRepoId, getGitUserId, getHelp, 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, getTag, getTemplatingEngine, getterAndSetterCapitalize, getTypeDeclaration, getUseInlineModelResolver, getUseOneOfInterfaces, getUseOpenAPINormalizer, getVersionMetadataFilename, handleMethodResponse, handleMethodResponse, handleSpecialCharacters, hasBodyParameter, hasFormParameter, importMapping, initializeSpecialCharacterMapping, inlineSchemaNameDefault, inlineSchemaNameMapping, instantiationTypes, isAnyTypeSchema, isDataTypeBinary, isDataTypeFile, isDataTypeString, isEnableMinimalUpdate, isEnablePostProcessFile, isFreeFormObject, isHideGenerationTimestamp, isJsonMimeType, isJsonVendorMimeType, isLibrary, isParameterNameUnique, isPropertyInnerMostEnum, isRemoveEnumValuePrefix, isRemoveOperationIdPrefix, isReservedWord, isSkipOperationExample, isSkipOverwrite, isStrictSpecBehavior, languageSpecificPrimitives, lowerCamelCase, modelDocTemplateFiles, modelFilename, modelPackage, modelTemplateFiles, modelTestFileFolder, modelTestTemplateFiles, modifyFeatureSet, needToImport, openapiNormalizer, outputFolder, postProcess, postProcessAllModels, postProcessFile, postProcessModelProperty, postProcessModels, postProcessModelsEnum, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessOpenAPI, processCompiler, processOpenAPI, processOpts, processTemplatingEngine, processTestExampleData, removeImport, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, removeOption, removeSelfReferenceImports, reservedWords, reservedWordsMappings, sanitizeName, sanitizeName, sanitizeTag, 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, setParameterExampleValue, 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, toApiTestFilename, toArrayModelParamName, toBooleanGetter, toDefaultParameterValue, toDefaultParameterValue, toDefaultValue, toDefaultValueWithParam, toEnumDefaultValue, toEnumName, toEnumValue, toEnumVarName, toExamples, toExampleValue, toGetter, toInstantiationType, toMediaTypeSchemaName, toModelDocFilename, toModelImport, toModelImportMap, toModelTestFilename, toOneOfName, toRegularExpression, 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
-
-
-
-
Field Detail
-
LOGGER
protected final org.slf4j.Logger LOGGER
-
srcPath
protected String srcPath
-
apiSrcPath
protected String apiSrcPath
-
modelSrcPath
protected String modelSrcPath
-
apiDocPath
protected String apiDocPath
-
modelDocPath
protected String modelDocPath
-
packageName
protected String packageName
-
exportModels
protected Boolean exportModels
-
exportOperations
protected Boolean exportOperations
-
-
Method Detail
-
generatorLanguage
public GeneratorLanguage generatorLanguage()
- Specified by:
generatorLanguage
in interfaceCodegenConfig
- Overrides:
generatorLanguage
in classDefaultCodegen
-
setPackageName
public void setPackageName(String packageName)
-
setExportModels
public void setExportModels(Boolean exportModels)
-
setExportOperations
public void setExportOperations(Boolean exportOperations)
-
escapeReservedWord
public String escapeReservedWord(String name)
Escapes a reserved word as defined in the `reservedWords` array. Handle escaping those terms here. This logic is only called if a variable matches the reseved words- Specified by:
escapeReservedWord
in interfaceCodegenConfig
- Overrides:
escapeReservedWord
in classDefaultCodegen
- Parameters:
name
- the name to be escaped- Returns:
- the escaped term
-
modelFileFolder
public String modelFileFolder()
Location to write model files.- Specified by:
modelFileFolder
in interfaceCodegenConfig
- Overrides:
modelFileFolder
in classDefaultCodegen
-
apiFileFolder
public String apiFileFolder()
Location to write api files.- Specified by:
apiFileFolder
in interfaceCodegenConfig
- Overrides:
apiFileFolder
in classDefaultCodegen
-
apiDocFileFolder
public String apiDocFileFolder()
- Specified by:
apiDocFileFolder
in interfaceCodegenConfig
- Overrides:
apiDocFileFolder
in classDefaultCodegen
-
modelDocFileFolder
public String modelDocFileFolder()
- Specified by:
modelDocFileFolder
in interfaceCodegenConfig
- Overrides:
modelDocFileFolder
in classDefaultCodegen
-
toModelFilename
public String toModelFilename(String name)
Description copied from class:DefaultCodegen
Return the capitalized file name of the model- Specified by:
toModelFilename
in interfaceCodegenConfig
- Overrides:
toModelFilename
in classDefaultCodegen
- Parameters:
name
- the model name- Returns:
- the file name of the model
-
toApiFilename
public String toApiFilename(String name)
Description copied from class:DefaultCodegen
Return the file name of the Api Test- Specified by:
toApiFilename
in interfaceCodegenConfig
- Overrides:
toApiFilename
in classDefaultCodegen
- Parameters:
name
- the file name of the Api- Returns:
- the file name of the Api
-
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 classDefaultCodegen
- Parameters:
name
- the name of the Api- Returns:
- capitalized Api name
-
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 interfaceCodegenConfig
- Overrides:
toParamName
in classDefaultCodegen
- Parameters:
name
- Codegen property object- Returns:
- the sanitized parameter name
-
toApiVarName
public String toApiVarName(String name)
Description copied from class:DefaultCodegen
Return the variable name in the Api- Specified by:
toApiVarName
in interfaceCodegenConfig
- Overrides:
toApiVarName
in classDefaultCodegen
- Parameters:
name
- the variable name of the Api- Returns:
- the snake-cased variable name
-
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 classDefaultCodegen
- Parameters:
name
- the variable name- Returns:
- the sanitized variable name
-
sanitizeName
public String sanitizeName(String name)
Sanitize name (parameter, property, method, etc)- Specified by:
sanitizeName
in interfaceCodegenConfig
- Overrides:
sanitizeName
in classDefaultCodegen
- Parameters:
name
- string to be sanitize- Returns:
- sanitized string
-
needsVarEscape
protected boolean needsVarEscape(String name)
-
toModelName
public String toModelName(String name)
Output the proper Julia model name.- Specified by:
toModelName
in interfaceCodegenConfig
- Overrides:
toModelName
in classDefaultCodegen
- Parameters:
name
- the name of the model- Returns:
- Julia model name
-
getTypeDeclaration
public String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema)
Description copied from class:DefaultCodegen
Output the language-specific type declaration of the property.- Specified by:
getTypeDeclaration
in interfaceCodegenConfig
- Overrides:
getTypeDeclaration
in classDefaultCodegen
- Parameters:
schema
- property schema- Returns:
- a string presentation of the property type
-
getSchemaType
public String getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
Return the type declaration for a given schema- Overrides:
getSchemaType
in classDefaultCodegen
- Parameters:
schema
- the schema- Returns:
- the type declaration
-
toDefaultValue
public String toDefaultValue(io.swagger.v3.oas.models.media.Schema schema)
Return the default value of the property- Overrides:
toDefaultValue
in classDefaultCodegen
- Parameters:
schema
- OpenAPI property object- Returns:
- string presentation of the default value of the property
-
escapeUnsafeCharacters
public String escapeUnsafeCharacters(String input)
Description copied from class:DefaultCodegen
override with any special text escaping logic to handle unsafe characters so as to avoid code injection- Specified by:
escapeUnsafeCharacters
in interfaceCodegenConfig
- Overrides:
escapeUnsafeCharacters
in classDefaultCodegen
- Parameters:
input
- String to be cleaned up- Returns:
- string with unsafe characters removed or escaped
-
escapeQuotationMark
public String escapeQuotationMark(String input)
Escape single and/or double quote to avoid code injection- Specified by:
escapeQuotationMark
in interfaceCodegenConfig
- Overrides:
escapeQuotationMark
in classDefaultCodegen
- Parameters:
input
- String to be cleaned up- Returns:
- string with quotation mark removed or escaped
-
fromParameter
public CodegenParameter fromParameter(io.swagger.v3.oas.models.parameters.Parameter param, Set<String> imports)
Convert OpenAPI Parameter object to Codegen Parameter object- Overrides:
fromParameter
in classDefaultCodegen
- Parameters:
imports
- set of imports for library/package/moduleparam
- OpenAPI parameter object- Returns:
- Codegen Parameter object
-
fromProperty
public CodegenProperty fromProperty(String name, io.swagger.v3.oas.models.media.Schema schema, boolean required)
Convert OAS Property schema to Codegen Property object.The return value is cached. An internal cache is looked up to determine if the CodegenProperty return value has already been instantiated for the (String name, Schema schema) arguments. Any subsequent processing of the CodegenModel return value must be idempotent for a given (String name, Schema schema).
- Overrides:
fromProperty
in classDefaultCodegen
- Parameters:
name
- name of the propertyschema
- OAS property schemarequired
- true if the property is required in the next higher object schema, false otherwise- Returns:
- Codegen Property object
-
toOperationId
public String toOperationId(String operationId)
Return the operation ID (method name)- Overrides:
toOperationId
in classDefaultCodegen
- Parameters:
operationId
- operation ID- Returns:
- the sanitized method name
-
fromOperation
public 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- Specified by:
fromOperation
in interfaceCodegenConfig
- Overrides:
fromOperation
in classDefaultCodegen
- Parameters:
httpMethod
- HTTP methodoperation
- OAS operation objectpath
- the path of the operationservers
- list of servers- Returns:
- Codegen Operation object
-
addMustacheLambdas
protected com.google.common.collect.ImmutableMap.Builder<String,com.samskivert.mustache.Mustache.Lambda> addMustacheLambdas()
Description copied from class:DefaultCodegen
Preset map builder with commonly used Mustache lambdas. To extend the map, override addMustacheLambdas(), call parent method first and then add additional lambdas to the returned builder. If common lambdas are not desired, override addMustacheLambdas() method and return empty builder.- Overrides:
addMustacheLambdas
in classDefaultCodegen
- Returns:
- preinitialized map with common lambdas
-
-