public class DefaultCodegen extends Object implements CodegenConfig
| Constructor and Description |
|---|
DefaultCodegen()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel,
io.swagger.v3.oas.models.media.Schema schema)
Handle the model for the 'additionalProperties' keyword in the OAS schema.
|
protected void |
addBodyModelSchema(CodegenParameter codegenParameter,
String name,
io.swagger.v3.oas.models.media.Schema schema,
Set<String> imports,
String bodyParameterName,
boolean forceSimpleRef) |
protected void |
addHeaders(io.swagger.v3.oas.models.responses.ApiResponse response,
List<CodegenProperty> properties)
Add headers to codegen property
|
protected void |
addImport(CodegenModel m,
String type) |
void |
addImportsToOneOfInterface(List<Map<String,String>> imports) |
Map<String,Object> |
additionalProperties() |
protected com.google.common.collect.ImmutableMap.Builder<String,com.samskivert.mustache.Mustache.Lambda> |
addMustacheLambdas()
Preset map builder with commonly used Mustache lambdas.
|
void |
addOneOfInterfaceModel(io.swagger.v3.oas.models.media.ComposedSchema cs,
String type,
io.swagger.v3.oas.models.OpenAPI openAPI)
Add a given ComposedSchema as an interface model to be generated, assuming it has `oneOf` defined
|
void |
addOneOfNameExtension(io.swagger.v3.oas.models.media.ComposedSchema s,
String name)
Add "x-one-of-name" extension to a given oneOf schema (assuming it has at least 1 oneOf elements)
|
void |
addOperationToGroup(String tag,
String resourcePath,
io.swagger.v3.oas.models.Operation operation,
CodegenOperation co,
Map<String,List<CodegenOperation>> operations)
Add operation to group
|
protected void |
addOption(String key,
String description,
String defaultValue) |
protected void |
addParentContainer(CodegenModel model,
String name,
io.swagger.v3.oas.models.media.Schema schema)
Sets the value of the 'model.parent' property in CodegenModel, based on the value
of the 'additionalProperties' keyword.
|
protected void |
addProperties(Map<String,io.swagger.v3.oas.models.media.Schema> properties,
List<String> required,
io.swagger.v3.oas.models.media.Schema schema)
Add schema's properties to "properties" and "required" list
|
String |
addRegularExpressionDelimiter(String pattern)
If the pattern misses the delimiter, add "/" to the beginning and end
Otherwise, return the original pattern
|
protected void |
addSwitch(String key,
String description,
Boolean defaultValue) |
String |
apiDocFileFolder() |
String |
apiDocFilename(String templateName,
String tag)
Return the full path and API documentation file
|
Map<String,String> |
apiDocTemplateFiles() |
String |
apiFileFolder() |
String |
apiFilename(String templateName,
String tag) |
String |
apiPackage() |
Map<String,String> |
apiTemplateFiles() |
String |
apiTestFileFolder() |
String |
apiTestFilename(String templateName,
String tag)
Return the full path and API test file
|
Map<String,String> |
apiTestTemplateFiles() |
protected List<Map<String,Object>> |
buildEnumVars(List<Object> values,
String dataType) |
protected CliOption |
buildLibraryCliOption(Map<String,String> supportedLibraries) |
List<CliOption> |
cliOptions() |
boolean |
convertPropertyToBoolean(String propertyKey) |
boolean |
convertPropertyToBooleanAndWriteBack(String propertyKey)
reads propertyKey from additionalProperties, converts it to a boolean and
writes it back to additionalProperties to be usable as a boolean in
mustache files.
|
protected CodegenDiscriminator |
createDiscriminator(String schemaName,
io.swagger.v3.oas.models.media.Schema schema,
io.swagger.v3.oas.models.OpenAPI openAPI) |
Set<String> |
defaultIncludes() |
String |
embeddedTemplateDir() |
String |
encodePath(String input) |
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 |
escapeText(String input) |
String |
escapeTextWhileAllowingNewLines(String input)
Escape characters while allowing new lines
|
String |
escapeUnsafeCharacters(String input)
override with any special text escaping logic to handle unsafe
characters so as to avoid code injection
|
String |
fileSuffix() |
String |
findCommonPrefixOfVars(List<Object> vars)
Returns the common prefix of variables for enum naming if
two or more variables are present
|
protected io.swagger.v3.oas.models.responses.ApiResponse |
findMethodResponse(io.swagger.v3.oas.models.responses.ApiResponses responses)
Override with any special handling of response codes
|
CodegenCallback |
fromCallback(String name,
io.swagger.v3.oas.models.callbacks.Callback callback,
List<io.swagger.v3.oas.models.servers.Server> servers)
Convert OAS Callback object to Codegen Callback object
|
CodegenParameter |
fromFormProperty(String name,
io.swagger.v3.oas.models.media.Schema propertySchema,
Set<String> imports) |
CodegenModel |
fromModel(String name,
io.swagger.v3.oas.models.media.Schema schema)
Convert OAS Model object to Codegen Model object.
|
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
|
CodegenParameter |
fromParameter(io.swagger.v3.oas.models.parameters.Parameter parameter,
Set<String> imports)
Convert OAS Parameter object to Codegen Parameter object
|
CodegenProperty |
fromProperty(String name,
io.swagger.v3.oas.models.media.Schema p)
Convert OAS Property object to Codegen Property object.
|
CodegenParameter |
fromRequestBody(io.swagger.v3.oas.models.parameters.RequestBody body,
Set<String> imports,
String bodyParameterName) |
List<CodegenParameter> |
fromRequestBodyToFormParameters(io.swagger.v3.oas.models.parameters.RequestBody body,
Set<String> imports) |
CodegenResponse |
fromResponse(String responseCode,
io.swagger.v3.oas.models.responses.ApiResponse response)
Convert OAS Response object to Codegen Response object
|
List<CodegenSecurity> |
fromSecurity(Map<String,io.swagger.v3.oas.models.security.SecurityScheme> securitySchemeMap)
Convert map of OAS SecurityScheme objects to a list of Codegen Security objects
|
List<CodegenServer> |
fromServers(List<io.swagger.v3.oas.models.servers.Server> servers) |
List<CodegenServerVariable> |
fromServerVariables(Map<String,io.swagger.v3.oas.models.servers.ServerVariable> variables) |
String |
generateExamplePath(String path,
io.swagger.v3.oas.models.Operation operation)
Return the example path
|
protected void |
generateJSONSpecFile(Map<String,Object> objs)
generates OpenAPI specification file in JSON format
|
void |
generateYAMLSpecFile(Map<String,Object> objs)
generates OpenAPI specification file in YAML format
|
protected io.swagger.v3.oas.models.media.Schema |
getAdditionalProperties(io.swagger.v3.oas.models.media.Schema schema)
Returns the additionalProperties Schema for the specified input schema.
|
String |
getAlias(String name)
Determine the type alias for the given type if it exists.
|
Map<String,CodegenModel> |
getAllModels(Map<String,Object> objs)
Index all CodegenModels by model name.
|
protected List<CodegenDiscriminator.MappedModel> |
getAllOfDescendants(String thisSchemaName,
io.swagger.v3.oas.models.OpenAPI openAPI) |
Boolean |
getAllowUnicodeIdentifiers() |
String |
getApiNamePrefix() |
String |
getApiNameSuffix() |
protected String |
getCollectionFormat(CodegenParameter codegenParameter)
Returns null by default but can be overwritten to return a valid collectionFormat
for the
CodegenParameter. |
protected String |
getCollectionFormat(io.swagger.v3.oas.models.parameters.Parameter parameter) |
static Set<String> |
getConsumesInfo(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.Operation operation) |
protected String |
getContentType(io.swagger.v3.oas.models.parameters.RequestBody requestBody) |
Boolean |
getDisallowAdditionalPropertiesIfNotPresent() |
String |
getDocExtension()
Documentation files extension
|
Boolean |
getEnsureUniqueParams() |
FeatureSet |
getFeatureSet() |
GeneratorMetadata |
getGeneratorMetadata()
Returns metadata about the generator.
|
String |
getGitHost()
Git host.
|
String |
getGitRepoId()
Git repo ID
|
String |
getGitUserId()
Git user ID
|
String |
getHelp() |
String |
getHttpUserAgent()
HTTP user agent
|
String |
getIgnoreFilePathOverride()
Provides an override location, if any is specified, for the .openapi-generator-ignore.
|
protected Map<String,Object> |
getInnerEnumAllowableValues(CodegenProperty property) |
String |
getInputSpec() |
Boolean |
getLegacyDiscriminatorBehavior() |
String |
getLibrary()
Library template (sub-template).
|
String |
getModelNamePrefix() |
String |
getModelNameSuffix() |
protected Map<String,io.swagger.v3.oas.models.media.Schema> |
getModelNameToSchemaCache()
Return a map from model name to Schema for efficient lookup.
|
protected CodegenProperty |
getMostInnerItems(CodegenProperty property) |
String |
getName() |
protected List<CodegenDiscriminator.MappedModel> |
getOneOfAnyOfDescendants(String composedSchemaName,
String discPropName,
io.swagger.v3.oas.models.media.ComposedSchema c,
io.swagger.v3.oas.models.OpenAPI openAPI)
This function is only used for composed schemas which have a discriminator
Process oneOf and anyOf models in a composed schema and adds them into
a list if the oneOf and anyOf models contain
the required discriminator.
|
protected String |
getOrGenerateOperationId(io.swagger.v3.oas.models.Operation operation,
String path,
String httpMethod)
Get operationId from the operation object, and if it's blank, generate a new one from the given parameters.
|
String |
getOutputDir() |
protected String |
getParameterDataType(io.swagger.v3.oas.models.parameters.Parameter parameter,
io.swagger.v3.oas.models.media.Schema schema)
Returns the data type of a parameter.
|
Boolean |
getPrependFormOrBodyParameters() |
static Set<String> |
getProducesInfo(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.Operation operation)
returns the list of MIME types the APIs can produce
|
String |
getReleaseNote()
Release note
|
protected io.swagger.v3.oas.models.media.Schema<?> |
getSchemaAdditionalProperties(io.swagger.v3.oas.models.media.Schema schema) |
protected io.swagger.v3.oas.models.media.Schema<?> |
getSchemaItems(io.swagger.v3.oas.models.media.ArraySchema schema) |
String |
getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
returns the OpenAPI type for the property.
|
protected String |
getSingleSchemaType(io.swagger.v3.oas.models.media.Schema schema)
Return a string representation of the schema type, resolving aliasing and references if necessary.
|
Boolean |
getSortModelPropertiesByRequiredFlag() |
Boolean |
getSortParamsByRequiredFlag() |
protected String |
getSymbolName(String input)
Return the symbol name of a symbol
|
CodegenType |
getTag() |
TemplatingEngineAdapter |
getTemplatingEngine() |
String |
getterAndSetterCapitalize(String name)
Camelize the method name of the getter and setter
|
String |
getTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema)
Output the language-specific type declaration of the property.
|
String |
getTypeDeclaration(String name)
Output the language-specific type declaration of a given OAS name.
|
Boolean |
getUseOneOfInterfaces() |
protected void |
handleMethodResponse(io.swagger.v3.oas.models.Operation operation,
Map<String,io.swagger.v3.oas.models.media.Schema> schemas,
CodegenOperation op,
io.swagger.v3.oas.models.responses.ApiResponse methodResponse)
Set op's returnBaseType, returnType, examples etc.
|
protected void |
handleMethodResponse(io.swagger.v3.oas.models.Operation operation,
Map<String,io.swagger.v3.oas.models.media.Schema> schemas,
CodegenOperation op,
io.swagger.v3.oas.models.responses.ApiResponse methodResponse,
Map<String,String> importMappings)
Set op's returnBaseType, returnType, examples etc.
|
boolean |
hasBodyParameter(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.Operation operation) |
boolean |
hasFormParameter(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.Operation operation) |
Map<String,String> |
importMapping() |
protected void |
initializeSpecialCharacterMapping()
Initialize special character mapping
|
Map<String,String> |
instantiationTypes() |
boolean |
isAnyTypeSchema(io.swagger.v3.oas.models.media.Schema schema)
Return true if the schema value can be any type, i.e.
|
boolean |
isDataTypeBinary(String dataType) |
boolean |
isDataTypeFile(String dataType) |
boolean |
isDataTypeString(String dataType)
checks if the data should be classified as "string" in enum
e.g.
|
boolean |
isEnableMinimalUpdate()
Get the boolean value indicating the state of the option for updating only changed files
|
boolean |
isEnablePostProcessFile()
Boolean value indicating the state of the option for post-processing file using envirionment variables.
|
protected boolean |
isFreeFormObject(io.swagger.v3.oas.models.media.Schema schema)
Check to see if the schema is a free form object.
|
boolean |
isHideGenerationTimestamp() |
protected static boolean |
isJsonMimeType(String mime)
Check if the given MIME is a JSON MIME.
|
protected static boolean |
isJsonVendorMimeType(String mime)
Check if the given MIME is a JSON Vendor MIME.
|
boolean |
isLibrary(String library)
check if current active library equals to passed
|
boolean |
isParameterNameUnique(CodegenParameter p,
List<CodegenParameter> parameters) |
protected Boolean |
isPropertyInnerMostEnum(CodegenProperty property)
Update property for map container
|
boolean |
isRemoveEnumValuePrefix()
Get the boolean value indicating whether to remove enum value prefixes
|
boolean |
isRemoveOperationIdPrefix() |
protected boolean |
isReservedWord(String word) |
boolean |
isSkipOverwrite() |
boolean |
isStrictSpecBehavior()
Indicates whether the codegen configuration should treat documents as strictly defined by the OpenAPI specification.
|
Set<String> |
languageSpecificPrimitives() |
String |
lowerCamelCase(String name)
Return the lowerCamelCase of the string
|
String |
modelDocFileFolder() |
Map<String,String> |
modelDocTemplateFiles() |
String |
modelFileFolder() |
String |
modelFilename(String templateName,
String modelName) |
String |
modelPackage() |
Map<String,String> |
modelTemplateFiles() |
String |
modelTestFileFolder() |
Map<String,String> |
modelTestTemplateFiles() |
protected void |
modifyFeatureSet(Consumer<FeatureSet.Builder> processor) |
protected boolean |
needToImport(String type)
Check the type to see if it needs import the library/module/package
|
String |
outputFolder() |
void |
postProcess() |
Map<String,Object> |
postProcessAllModels(Map<String,Object> objs) |
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> |
postProcessModelsEnum(Map<String,Object> objs)
post process enum defined in model's properties
|
Map<String,Object> |
postProcessOperationsWithModels(Map<String,Object> objs,
List<Object> allModels) |
void |
postProcessParameter(CodegenParameter parameter) |
Map<String,Object> |
postProcessSupportingFileData(Map<String,Object> objs) |
void |
preprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI) |
com.samskivert.mustache.Mustache.Compiler |
processCompiler(com.samskivert.mustache.Mustache.Compiler compiler) |
void |
processOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI) |
void |
processOpts() |
TemplatingEngineAdapter |
processTemplatingEngine(TemplatingEngineAdapter templatingEngine) |
String |
removeNonNameElementToCamelCase(String name)
Remove characters not suitable for variable or method name from the input and camelize it
|
protected String |
removeNonNameElementToCamelCase(String name,
String nonNameElementPattern)
Remove characters that is not good to be included in method name from the input and camelize it
|
protected void |
removeOption(String key) |
Set<String> |
reservedWords() |
Map<String,String> |
reservedWordsMappings() |
String |
sanitizeName(String name)
Sanitize name (parameter, property, method, etc)
|
String |
sanitizeName(String name,
String removeCharRegEx)
Sanitize name (parameter, property, method, etc)
|
String |
sanitizeName(String name,
String removeCharRegEx,
ArrayList<String> exceptionList)
Sanitize name (parameter, property, method, etc)
|
String |
sanitizeTag(String tag)
Sanitize tag
|
Map<String,String> |
serverVariableOverrides() |
void |
setAllowUnicodeIdentifiers(Boolean allowUnicodeIdentifiers) |
void |
setApiNamePrefix(String apiNamePrefix) |
void |
setApiNameSuffix(String apiNameSuffix) |
void |
setApiPackage(String apiPackage) |
void |
setCircularReferences(Map<String,CodegenModel> models) |
void |
setDisallowAdditionalPropertiesIfNotPresent(boolean val) |
void |
setDocExtension(String userDocExtension)
Set Documentation files extension
|
void |
setEnableMinimalUpdate(boolean enableMinimalUpdate)
Set the boolean value indicating the state of the option for updating only changed files
|
void |
setEnablePostProcessFile(boolean enablePostProcessFile)
Set the boolean value indicating the state of the option for post-processing file using envirionment variables.
|
void |
setEnsureUniqueParams(Boolean ensureUniqueParams) |
void |
setGitHost(String gitHost)
Set Git host.
|
void |
setGitRepoId(String gitRepoId)
Set Git repo ID.
|
void |
setGitUserId(String gitUserId)
Set Git user ID.
|
void |
setHideGenerationTimestamp(boolean hideGenerationTimestamp) |
void |
setHttpUserAgent(String httpUserAgent)
Set HTTP user agent.
|
void |
setIgnoreFilePathOverride(String ignoreFileOverride)
Sets an override location for the '.openapi-generator-ignore' location for the first code generation.
|
void |
setInputSpec(String inputSpec) |
void |
setLegacyDiscriminatorBehavior(boolean val) |
void |
setLibrary(String library)
Set library template (sub-template).
|
void |
setModelNamePrefix(String modelNamePrefix) |
void |
setModelNameSuffix(String modelNameSuffix) |
void |
setModelPackage(String modelPackage) |
protected void |
setNonArrayMapProperty(CodegenProperty property,
String type) |
void |
setOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI)
Set the OpenAPI document.
|
void |
setOutputDir(String dir) |
void |
setParameterBooleanFlagWithCodegenProperty(CodegenParameter parameter,
CodegenProperty property)
Set CodegenParameter boolean flag using CodegenProperty.
|
void |
setParameterContentType(CodegenParameter codegenParameter,
io.swagger.v3.oas.models.media.MediaType mediaType)
Sets the content type of the parameter based on the encoding specified in the request body.
|
void |
setParameterExampleValue(CodegenParameter codegenParameter)
Return the example value of the parameter.
|
void |
setParameterExampleValue(CodegenParameter codegenParameter,
io.swagger.v3.oas.models.parameters.Parameter parameter)
Return the example value of the parameter.
|
void |
setParameterExampleValue(CodegenParameter codegenParameter,
io.swagger.v3.oas.models.parameters.RequestBody requestBody)
Return the example value of the parameter.
|
protected void |
setParameterNullable(CodegenParameter parameter,
CodegenProperty property) |
void |
setPrependFormOrBodyParameters(Boolean prependFormOrBodyParameters) |
void |
setReleaseNote(String releaseNote)
Set release note.
|
void |
setRemoveEnumValuePrefix(boolean removeEnumValuePrefix)
Set the boolean value indicating whether to remove enum value prefixes
|
void |
setRemoveOperationIdPrefix(boolean removeOperationIdPrefix) |
protected void |
setReservedWordsLowerCase(List<String> words) |
void |
setSkipOverwrite(boolean skipOverwrite) |
void |
setSortModelPropertiesByRequiredFlag(Boolean sortModelPropertiesByRequiredFlag) |
void |
setSortParamsByRequiredFlag(Boolean sortParamsByRequiredFlag) |
void |
setStrictSpecBehavior(boolean strictSpecBehavior)
Sets the boolean valid indicating whether generation will work strictly against the specification, potentially making
minor changes to the input document.
|
void |
setTemplateDir(String templateDir) |
void |
setTemplatingEngine(TemplatingEngineAdapter templatingEngine) |
void |
setUseOneOfInterfaces(Boolean useOneOfInterfaces) |
boolean |
shouldOverwrite(String filename) |
Map<String,String> |
supportedLibraries()
All library templates supported.
|
List<SupportingFile> |
supportingFiles() |
String |
templateDir() |
String |
testPackage() |
String |
toAllOfName(List<String> names,
io.swagger.v3.oas.models.media.ComposedSchema composedSchema)
Return the name of the 'allOf' composed schema.
|
String |
toAnyOfName(List<String> names,
io.swagger.v3.oas.models.media.ComposedSchema composedSchema)
Return the name of the anyOf schema
|
String |
toApiDocFilename(String name)
Return the file name of the Api Documentation
|
String |
toApiFilename(String name)
Return the file name of the Api Test
|
String |
toApiImport(String name)
Return the fully-qualified "Api" name for import
|
String |
toApiName(String name)
Output the API (class) name (capitalized) ending with the specified or default suffix
Return DefaultApi if name is empty
|
String |
toApiTestFilename(String name)
Return the file name of the Api Test
|
String |
toApiVarName(String name)
Return the variable name in the Api
|
String |
toArrayModelParamName(String name)
Return the parameter name of array of model
|
String |
toBooleanGetter(String name)
Output the Getter name for boolean property, e.g.
|
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 |
toDefaultValueWithParam(String name,
io.swagger.v3.oas.models.media.Schema schema)
Return the property initialized from a data object
Useful for initialization with a plain object in Javascript
|
String |
toEnumDefaultValue(String value,
String datatype)
Return the enum default value in the language specified format
|
String |
toEnumName(CodegenProperty property)
Return the Enum name (e.g.
|
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
|
protected List<Map<String,Object>> |
toExamples(Map<String,Object> examples) |
String |
toExampleValue(io.swagger.v3.oas.models.media.Schema schema)
Return the example value of the property
|
String |
toGetter(String name)
Output the Getter name, e.g.
|
String |
toInstantiationType(io.swagger.v3.oas.models.media.Schema schema)
Return the instantiation type of the property, especially for map and array
|
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 |
toModelImport(String name)
Return the fully-qualified "Model" name for import
|
Map<String,String> |
toModelImportMap(String name)
Returns the same content as [[toModelImport]] with key the fully-qualified Model name and value the initial input.
|
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 |
toOneOfName(List<String> names,
io.swagger.v3.oas.models.media.ComposedSchema composedSchema)
Return the name of the oneOf schema.
|
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 |
toRegularExpression(String pattern)
Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)
|
String |
toSetter(String name)
Output the Setter name, e.g.
|
String |
toVarName(String name)
Return the variable name by removing invalid characters and proper escaping if
it's a reserved word.
|
Map<String,String> |
typeMapping() |
io.swagger.v3.oas.models.media.Schema |
unaliasSchema(io.swagger.v3.oas.models.media.Schema schema,
Map<String,String> usedImportMappings) |
Map<String,Object> |
updateAllModels(Map<String,Object> objs)
Loop through all models to update different flags (e.g.
|
void |
updateCodegenPropertyEnum(CodegenProperty var)
Update codegen property's enum by adding "enumVars" (with name and value)
|
protected void |
updateDataTypeWithEnumForArray(CodegenProperty property)
Update datatypeWithEnum for array container
|
protected void |
updateDataTypeWithEnumForMap(CodegenProperty property)
Update datatypeWithEnum for map container
|
protected void |
updateEnumVarsWithExtensions(List<Map<String,Object>> enumVars,
Map<String,Object> vendorExtensions,
String dataType) |
protected void |
updateOption(String key,
String defaultValue) |
protected void |
updatePropertyForArray(CodegenProperty property,
CodegenProperty innerProperty)
Update property for array(list) container
|
protected void |
updatePropertyForMap(CodegenProperty property,
CodegenProperty innerProperty)
Update property for map container
|
Map<String,Object> |
vendorExtensions() |
void |
writePropertyBack(String propertyKey,
boolean value) |
public static FeatureSet DefaultFeatureSet
protected GeneratorMetadata generatorMetadata
protected String inputSpec
protected String outputFolder
protected String modelPackage
protected String apiPackage
protected String fileSuffix
protected String modelNamePrefix
protected String modelNameSuffix
protected String apiNamePrefix
protected String apiNameSuffix
protected String testPackage
protected String templateDir
protected String embeddedTemplateDir
protected List<SupportingFile> supportingFiles
protected boolean skipOverwrite
protected boolean removeOperationIdPrefix
protected boolean supportsMultipleInheritance
protected boolean supportsInheritance
protected boolean supportsAdditionalPropertiesWithComposedSchema
protected boolean supportsMixins
protected String library
protected Boolean sortParamsByRequiredFlag
protected Boolean sortModelPropertiesByRequiredFlag
protected Boolean ensureUniqueParams
protected Boolean allowUnicodeIdentifiers
protected String gitHost
protected String gitUserId
protected String gitRepoId
protected String releaseNote
protected String httpUserAgent
protected Boolean hideGenerationTimestamp
protected Boolean prependFormOrBodyParameters
protected String docExtension
protected String ignoreFilePathOverride
protected boolean enablePostProcessFile
protected boolean useOneOfInterfaces
protected boolean addOneOfInterfaceImports
protected List<CodegenModel> addOneOfInterfaces
protected boolean enableMinimalUpdate
protected boolean strictSpecBehavior
protected boolean removeEnumValuePrefix
protected boolean legacyDiscriminatorBehavior
protected boolean disallowAdditionalPropertiesIfNotPresent
protected io.swagger.v3.oas.models.OpenAPI openAPI
protected static final Pattern JSON_MIME_PATTERN
protected static final Pattern JSON_VENDOR_MIME_PATTERN
public DefaultCodegen()
public List<CliOption> cliOptions()
cliOptions in interface CodegenConfigpublic void processOpts()
processOpts in interface CodegenConfigprotected com.google.common.collect.ImmutableMap.Builder<String,com.samskivert.mustache.Mustache.Lambda> addMustacheLambdas()
public Map<String,Object> postProcessAllModels(Map<String,Object> objs)
postProcessAllModels in interface CodegenConfigprotected Map<String,io.swagger.v3.oas.models.media.Schema> getModelNameToSchemaCache()
public Map<String,CodegenModel> getAllModels(Map<String,Object> objs)
objs - Map of modelspublic Map<String,Object> updateAllModels(Map<String,Object> objs)
updateAllModels in interface CodegenConfigobjs - Map of modelspublic void setCircularReferences(Map<String,CodegenModel> models)
public Map<String,Object> postProcessModels(Map<String,Object> objs)
postProcessModels in interface CodegenConfigpublic Map<String,Object> postProcessModelsEnum(Map<String,Object> objs)
objs - Map of modelspublic String findCommonPrefixOfVars(List<Object> vars)
vars - List of variable namespublic String toEnumDefaultValue(String value, String datatype)
value - enum variable namedatatype - data typepublic String toEnumValue(String value, String datatype)
value - enum variable namedatatype - data typepublic String toEnumVarName(String value, String datatype)
value - enum variable namedatatype - data typepublic void setOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI)
setOpenAPI in interface CodegenConfigopenAPI - specification being generatedpublic void postProcess()
postProcess in interface CodegenConfigpublic Map<String,Object> postProcessOperationsWithModels(Map<String,Object> objs, List<Object> allModels)
postProcessOperationsWithModels in interface CodegenConfigpublic Map<String,Object> postProcessSupportingFileData(Map<String,Object> objs)
postProcessSupportingFileData in interface CodegenConfigpublic void postProcessModelProperty(CodegenModel model, CodegenProperty property)
postProcessModelProperty in interface CodegenConfigpublic void postProcessParameter(CodegenParameter parameter)
postProcessParameter in interface CodegenConfigpublic void preprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI)
preprocessOpenAPI in interface CodegenConfigpublic void processOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI)
processOpenAPI in interface CodegenConfigpublic com.samskivert.mustache.Mustache.Compiler processCompiler(com.samskivert.mustache.Mustache.Compiler compiler)
processCompiler in interface CodegenConfigpublic TemplatingEngineAdapter processTemplatingEngine(TemplatingEngineAdapter templatingEngine)
processTemplatingEngine in interface CodegenConfigpublic String escapeText(String input)
escapeText in interface CodegenConfigpublic String escapeTextWhileAllowingNewLines(String input)
escapeTextWhileAllowingNewLines in interface CodegenConfiginput - String to be escapedpublic String encodePath(String input)
encodePath in interface CodegenConfigpublic String escapeUnsafeCharacters(String input)
escapeUnsafeCharacters in interface CodegenConfiginput - String to be cleaned uppublic String escapeQuotationMark(String input)
escapeQuotationMark in interface CodegenConfiginput - String to be cleaned uppublic Set<String> defaultIncludes()
defaultIncludes in interface CodegenConfigpublic Map<String,String> typeMapping()
typeMapping in interface CodegenConfigpublic Map<String,String> instantiationTypes()
instantiationTypes in interface CodegenConfigpublic Set<String> reservedWords()
reservedWords in interface CodegenConfigpublic Set<String> languageSpecificPrimitives()
languageSpecificPrimitives in interface CodegenConfigpublic Map<String,String> importMapping()
importMapping in interface CodegenConfigpublic String testPackage()
testPackage in interface CodegenConfigpublic String modelPackage()
modelPackage in interface CodegenConfigpublic String apiPackage()
apiPackage in interface CodegenConfigpublic String fileSuffix()
fileSuffix in interface CodegenConfigpublic String templateDir()
templateDir in interface CodegenConfigpublic String embeddedTemplateDir()
embeddedTemplateDir in interface CodegenConfigpublic Map<String,String> apiDocTemplateFiles()
apiDocTemplateFiles in interface CodegenConfigpublic Map<String,String> modelDocTemplateFiles()
modelDocTemplateFiles in interface CodegenConfigpublic Map<String,String> reservedWordsMappings()
reservedWordsMappings in interface CodegenConfigpublic Map<String,String> apiTestTemplateFiles()
apiTestTemplateFiles in interface CodegenConfigpublic Map<String,String> modelTestTemplateFiles()
modelTestTemplateFiles in interface CodegenConfigpublic Map<String,String> apiTemplateFiles()
apiTemplateFiles in interface CodegenConfigpublic Map<String,String> modelTemplateFiles()
modelTemplateFiles in interface CodegenConfigpublic String apiFileFolder()
apiFileFolder in interface CodegenConfigpublic String modelFileFolder()
modelFileFolder in interface CodegenConfigpublic String apiTestFileFolder()
apiTestFileFolder in interface CodegenConfigpublic String modelTestFileFolder()
modelTestFileFolder in interface CodegenConfigpublic String apiDocFileFolder()
apiDocFileFolder in interface CodegenConfigpublic String modelDocFileFolder()
modelDocFileFolder in interface CodegenConfigpublic Map<String,Object> additionalProperties()
additionalProperties in interface CodegenConfigpublic Map<String,String> serverVariableOverrides()
serverVariableOverrides in interface CodegenConfigpublic Map<String,Object> vendorExtensions()
vendorExtensions in interface CodegenConfigpublic List<SupportingFile> supportingFiles()
supportingFiles in interface CodegenConfigpublic String outputFolder()
outputFolder in interface CodegenConfigpublic void setOutputDir(String dir)
setOutputDir in interface CodegenConfigpublic String getOutputDir()
getOutputDir in interface CodegenConfigpublic String getInputSpec()
getInputSpec in interface CodegenConfigpublic void setInputSpec(String inputSpec)
setInputSpec in interface CodegenConfigpublic void setTemplateDir(String templateDir)
public void setModelPackage(String modelPackage)
public String getModelNamePrefix()
public void setModelNamePrefix(String modelNamePrefix)
public String getModelNameSuffix()
public void setModelNameSuffix(String modelNameSuffix)
public String getApiNameSuffix()
public void setApiNameSuffix(String apiNameSuffix)
public String getApiNamePrefix()
public void setApiNamePrefix(String apiNamePrefix)
public void setApiPackage(String apiPackage)
public Boolean getSortParamsByRequiredFlag()
public void setSortParamsByRequiredFlag(Boolean sortParamsByRequiredFlag)
public Boolean getSortModelPropertiesByRequiredFlag()
public void setSortModelPropertiesByRequiredFlag(Boolean sortModelPropertiesByRequiredFlag)
public Boolean getPrependFormOrBodyParameters()
public void setPrependFormOrBodyParameters(Boolean prependFormOrBodyParameters)
public Boolean getEnsureUniqueParams()
public void setEnsureUniqueParams(Boolean ensureUniqueParams)
public Boolean getLegacyDiscriminatorBehavior()
public void setLegacyDiscriminatorBehavior(boolean val)
public Boolean getDisallowAdditionalPropertiesIfNotPresent()
public void setDisallowAdditionalPropertiesIfNotPresent(boolean val)
public Boolean getAllowUnicodeIdentifiers()
public void setAllowUnicodeIdentifiers(Boolean allowUnicodeIdentifiers)
public Boolean getUseOneOfInterfaces()
public void setUseOneOfInterfaces(Boolean useOneOfInterfaces)
public String toRegularExpression(String pattern)
pattern - the pattern (regular expression)public String toApiFilename(String name)
toApiFilename in interface CodegenConfigname - the file name of the Apipublic String toApiDocFilename(String name)
toApiDocFilename in interface CodegenConfigname - the file name of the Apipublic String toApiTestFilename(String name)
toApiTestFilename in interface CodegenConfigname - the file name of the Apipublic String toApiVarName(String name)
toApiVarName in interface CodegenConfigname - the varible name of the Apipublic String toModelFilename(String name)
toModelFilename in interface CodegenConfigname - the model namepublic String toModelTestFilename(String name)
toModelTestFilename in interface CodegenConfigname - the model namepublic String toModelDocFilename(String name)
toModelDocFilename in interface CodegenConfigname - the model namepublic GeneratorMetadata getGeneratorMetadata()
getGeneratorMetadata in interface CodegenConfigGeneratorMetadata instancepublic String toOperationId(String operationId)
operationId - operation IDpublic String toVarName(String name)
name - the variable namepublic String toParamName(String name)
toParamName in interface CodegenConfigname - Codegen property objectpublic String toArrayModelParamName(String name)
name - name of the array modelpublic String toEnumName(CodegenProperty property)
property - Codegen propertypublic String escapeReservedWord(String name)
escapeReservedWord in interface CodegenConfigname - the name to be escapedthrows Runtime exception as reserved word is not allowed (default behavior)
public String toModelImport(String name)
toModelImport in interface CodegenConfigname - the name of the "Model"public Map<String,String> toModelImportMap(String name)
toModelImportMap in interface CodegenConfigname - the name of the "Model"public String toApiImport(String name)
toApiImport in interface CodegenConfigname - the name of the "Api"protected void initializeSpecialCharacterMapping()
protected String getSymbolName(String input)
input - Symbol (e.g. $)public String generateExamplePath(String path, io.swagger.v3.oas.models.Operation operation)
generateExamplePath in interface CodegenConfigpath - the path of the operationoperation - OAS operation objectpublic String toInstantiationType(io.swagger.v3.oas.models.media.Schema schema)
schema - property schemapublic void setParameterExampleValue(CodegenParameter codegenParameter)
codegenParameter - Codegen parameterpublic void setParameterExampleValue(CodegenParameter codegenParameter, io.swagger.v3.oas.models.parameters.Parameter parameter)
codegenParameter - Codegen parameterparameter - Parameterpublic void setParameterExampleValue(CodegenParameter codegenParameter, io.swagger.v3.oas.models.parameters.RequestBody requestBody)
codegenParameter - Codegen parameterrequestBody - Request bodypublic void setParameterContentType(CodegenParameter codegenParameter, io.swagger.v3.oas.models.media.MediaType mediaType)
codegenParameter - Codegen parametermediaType - MediaType from the request bodypublic String toExampleValue(io.swagger.v3.oas.models.media.Schema schema)
schema - Property schemapublic String toDefaultValue(io.swagger.v3.oas.models.media.Schema schema)
schema - Property schemapublic String toDefaultValueWithParam(String name, io.swagger.v3.oas.models.media.Schema schema)
name - Name of the property objectschema - Property schemapublic String getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
schema - property schemaprotected io.swagger.v3.oas.models.media.Schema<?> getSchemaItems(io.swagger.v3.oas.models.media.ArraySchema schema)
protected io.swagger.v3.oas.models.media.Schema<?> getSchemaAdditionalProperties(io.swagger.v3.oas.models.media.Schema schema)
public String toAllOfName(List<String> names, io.swagger.v3.oas.models.media.ComposedSchema composedSchema)
names - List of namescomposedSchema - composed schemapublic String toAnyOfName(List<String> names, io.swagger.v3.oas.models.media.ComposedSchema composedSchema)
names - List of namescomposedSchema - composed schemapublic String toOneOfName(List<String> names, io.swagger.v3.oas.models.media.ComposedSchema composedSchema)
This name is used to set the value of CodegenProperty.openApiType.
If the 'x-one-of-name' extension is specified in the OAS document, return that value. Otherwise, a name is constructed by creating a comma-separated list of all the names of the oneOf schemas.
names - List of namescomposedSchema - composed schemapublic io.swagger.v3.oas.models.media.Schema unaliasSchema(io.swagger.v3.oas.models.media.Schema schema,
Map<String,String> usedImportMappings)
unaliasSchema in interface CodegenConfigprotected String getSingleSchemaType(io.swagger.v3.oas.models.media.Schema schema)
schema - inputpublic String lowerCamelCase(String name)
name - string to be lowerCamelCasedpublic String getTypeDeclaration(String name)
getTypeDeclaration in interface CodegenConfigname - namepublic String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema)
getTypeDeclaration in interface CodegenConfigschema - property schemapublic String getAlias(String name)
name - The type name.public String toBooleanGetter(String name)
toBooleanGetter in interface CodegenConfigname - the name of the propertypublic String toGetter(String name)
toGetter in interface CodegenConfigname - the name of the propertypublic String toSetter(String name)
toSetter in interface CodegenConfigname - the name of the propertypublic String toApiName(String name)
toApiName in interface CodegenConfigname - the name of the Apipublic String toModelName(String name)
toModelName in interface CodegenConfigname - the name of the modelpublic CodegenModel fromModel(String name, io.swagger.v3.oas.models.media.Schema schema)
fromModel in interface CodegenConfigname - the name of the modelschema - OAS Model objectprotected List<CodegenDiscriminator.MappedModel> getOneOfAnyOfDescendants(String composedSchemaName, String discPropName, io.swagger.v3.oas.models.media.ComposedSchema c, io.swagger.v3.oas.models.OpenAPI openAPI)
composedSchemaName - The String model name of the composed schema where we are setting the discriminator mapdiscPropName - The String that is the discriminator propertyName in the schemac - The ComposedSchema that contains the discriminator and oneOf/anyOf schemasopenAPI - The OpenAPI spec that we are usingprotected List<CodegenDiscriminator.MappedModel> getAllOfDescendants(String thisSchemaName, io.swagger.v3.oas.models.OpenAPI openAPI)
protected CodegenDiscriminator createDiscriminator(String schemaName, io.swagger.v3.oas.models.media.Schema schema, io.swagger.v3.oas.models.OpenAPI openAPI)
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, io.swagger.v3.oas.models.media.Schema schema)
codegenModel - The codegen representation of the schema.schema - The input OAS schema.protected void addProperties(Map<String,io.swagger.v3.oas.models.media.Schema> properties, List<String> required, io.swagger.v3.oas.models.media.Schema schema)
properties - all propertiesrequired - required property onlyschema - schema in which the properties will be added to the listspublic String getterAndSetterCapitalize(String name)
name - string to be camelizedpublic CodegenProperty fromProperty(String name, io.swagger.v3.oas.models.media.Schema p)
name - name of the propertyp - OAS property schemaprotected void updatePropertyForArray(CodegenProperty property, CodegenProperty innerProperty)
property - Codegen propertyinnerProperty - Codegen inner property of map or listprotected void updatePropertyForMap(CodegenProperty property, CodegenProperty innerProperty)
property - Codegen propertyinnerProperty - Codegen inner property of map or listprotected Boolean isPropertyInnerMostEnum(CodegenProperty property)
property - Codegen propertyprotected CodegenProperty getMostInnerItems(CodegenProperty property)
protected Map<String,Object> getInnerEnumAllowableValues(CodegenProperty property)
protected void updateDataTypeWithEnumForArray(CodegenProperty property)
property - Codegen propertyprotected void updateDataTypeWithEnumForMap(CodegenProperty property)
property - Codegen propertyprotected void setNonArrayMapProperty(CodegenProperty property, String type)
protected io.swagger.v3.oas.models.responses.ApiResponse findMethodResponse(io.swagger.v3.oas.models.responses.ApiResponses responses)
responses - OAS Operation's responsesnull if not foundprotected void handleMethodResponse(io.swagger.v3.oas.models.Operation operation,
Map<String,io.swagger.v3.oas.models.media.Schema> schemas,
CodegenOperation op,
io.swagger.v3.oas.models.responses.ApiResponse methodResponse)
operation - endpoint Operationschemas - a map of the schemas in the openapi specop - endpoint CodegenOperationmethodResponse - the default ApiResponse for the endpointprotected void handleMethodResponse(io.swagger.v3.oas.models.Operation operation,
Map<String,io.swagger.v3.oas.models.media.Schema> schemas,
CodegenOperation op,
io.swagger.v3.oas.models.responses.ApiResponse methodResponse,
Map<String,String> importMappings)
operation - endpoint Operationschemas - a map of the schemas in the openapi specop - endpoint CodegenOperationmethodResponse - the default ApiResponse for the endpointimportMappings - mappings of external types to be omitted by unaliasingpublic CodegenOperation fromOperation(String path, String httpMethod, io.swagger.v3.oas.models.Operation operation, List<io.swagger.v3.oas.models.servers.Server> servers)
fromOperation in interface CodegenConfighttpMethod - HTTP methodoperation - OAS operation objectpath - the path of the operationservers - list of serverspublic boolean isParameterNameUnique(CodegenParameter p, List<CodegenParameter> parameters)
public CodegenResponse fromResponse(String responseCode, io.swagger.v3.oas.models.responses.ApiResponse response)
responseCode - HTTP response coderesponse - OAS Response objectpublic CodegenCallback fromCallback(String name, io.swagger.v3.oas.models.callbacks.Callback callback, List<io.swagger.v3.oas.models.servers.Server> servers)
name - callback namecallback - OAS Callback objectservers - list of serverspublic CodegenParameter fromParameter(io.swagger.v3.oas.models.parameters.Parameter parameter, Set<String> imports)
parameter - OAS parameter objectimports - set of imports for library/package/moduleprotected String getParameterDataType(io.swagger.v3.oas.models.parameters.Parameter parameter, io.swagger.v3.oas.models.media.Schema schema)
parameter - Parameterschema - Schemapublic boolean isDataTypeBinary(String dataType)
public boolean isDataTypeFile(String dataType)
public List<CodegenSecurity> fromSecurity(Map<String,io.swagger.v3.oas.models.security.SecurityScheme> securitySchemeMap)
fromSecurity in interface CodegenConfigsecuritySchemeMap - a map of OAS SecuritySchemeDefinition objectprotected boolean isReservedWord(String word)
protected String getOrGenerateOperationId(io.swagger.v3.oas.models.Operation operation, String path, String httpMethod)
operation - the operation objectpath - the path of the operationhttpMethod - the HTTP method of the operationprotected boolean needToImport(String type)
type - name of the typeprotected void addHeaders(io.swagger.v3.oas.models.responses.ApiResponse response,
List<CodegenProperty> properties)
response - API responseproperties - list of codegen propertypublic void addOperationToGroup(String tag, String resourcePath, io.swagger.v3.oas.models.Operation operation, CodegenOperation co, Map<String,List<CodegenOperation>> operations)
addOperationToGroup in interface CodegenConfigtag - name of the tagresourcePath - path of the resourceoperation - OAS Operation objectco - Codegen Operation objectoperations - map of Codegen operationsprotected void addParentContainer(CodegenModel model, String name, io.swagger.v3.oas.models.media.Schema schema)
model - the codegen representation of the OAS schema.name - the name of the model.schema - the input OAS schema.protected void addImport(CodegenModel m, String type)
public String removeNonNameElementToCamelCase(String name)
name - string to be camelizeprotected String removeNonNameElementToCamelCase(String name, String nonNameElementPattern)
name - string to be camelizenonNameElementPattern - a regex pattern of the characters that is not good to be included in namepublic String apiFilename(String templateName, String tag)
apiFilename in interface CodegenConfigpublic String modelFilename(String templateName, String modelName)
modelFilename in interface CodegenConfigpublic String apiDocFilename(String templateName, String tag)
apiDocFilename in interface CodegenConfigtemplateName - template nametag - tagpublic String apiTestFilename(String templateName, String tag)
apiTestFilename in interface CodegenConfigtemplateName - template nametag - tagpublic boolean shouldOverwrite(String filename)
shouldOverwrite in interface CodegenConfigpublic boolean isSkipOverwrite()
isSkipOverwrite in interface CodegenConfigpublic void setSkipOverwrite(boolean skipOverwrite)
setSkipOverwrite in interface CodegenConfigpublic boolean isRemoveOperationIdPrefix()
isRemoveOperationIdPrefix in interface CodegenConfigpublic void setRemoveOperationIdPrefix(boolean removeOperationIdPrefix)
setRemoveOperationIdPrefix in interface CodegenConfigpublic boolean isHideGenerationTimestamp()
isHideGenerationTimestamp in interface CodegenConfigpublic void setHideGenerationTimestamp(boolean hideGenerationTimestamp)
setHideGenerationTimestamp in interface CodegenConfigpublic Map<String,String> supportedLibraries()
supportedLibraries in interface CodegenConfigpublic void setLibrary(String library)
setLibrary in interface CodegenConfiglibrary - Library templatepublic String getLibrary()
getLibrary in interface CodegenConfigpublic final boolean isLibrary(String library)
library - - library to be compared withtrue if passed library is active, false otherwisepublic void setGitHost(String gitHost)
setGitHost in interface CodegenConfiggitHost - Git hostpublic String getGitHost()
getGitHost in interface CodegenConfigpublic void setGitUserId(String gitUserId)
setGitUserId in interface CodegenConfiggitUserId - Git user IDpublic String getGitUserId()
getGitUserId in interface CodegenConfigpublic void setGitRepoId(String gitRepoId)
setGitRepoId in interface CodegenConfiggitRepoId - Git repo IDpublic String getGitRepoId()
getGitRepoId in interface CodegenConfigpublic void setReleaseNote(String releaseNote)
setReleaseNote in interface CodegenConfigreleaseNote - Release notepublic String getReleaseNote()
getReleaseNote in interface CodegenConfigpublic String getDocExtension()
getDocExtension in interface CodegenConfigpublic void setDocExtension(String userDocExtension)
setDocExtension in interface CodegenConfiguserDocExtension - documentation files extensionpublic void setHttpUserAgent(String httpUserAgent)
setHttpUserAgent in interface CodegenConfighttpUserAgent - HTTP user agentpublic String getHttpUserAgent()
getHttpUserAgent in interface CodegenConfigprotected CliOption buildLibraryCliOption(Map<String,String> supportedLibraries)
public String sanitizeName(String name)
sanitizeName in interface CodegenConfigname - string to be sanitizepublic void setTemplatingEngine(TemplatingEngineAdapter templatingEngine)
setTemplatingEngine in interface CodegenConfigpublic TemplatingEngineAdapter getTemplatingEngine()
getTemplatingEngine in interface CodegenConfigpublic String sanitizeName(String name, String removeCharRegEx)
name - string to be sanitizeremoveCharRegEx - a regex containing all char that will be removedpublic String sanitizeName(String name, String removeCharRegEx, ArrayList<String> exceptionList)
name - string to be sanitizeremoveCharRegEx - a regex containing all char that will be removedexceptionList - a list of matches which should not be sanitized (i.e exception)public String sanitizeTag(String tag)
sanitizeTag in interface CodegenConfigtag - Tagpublic void setParameterBooleanFlagWithCodegenProperty(CodegenParameter parameter, CodegenProperty property)
parameter - Codegen Parameterproperty - Codegen propertypublic void updateCodegenPropertyEnum(CodegenProperty var)
var - list of CodegenPropertyprotected List<Map<String,Object>> buildEnumVars(List<Object> values, String dataType)
protected void updateEnumVarsWithExtensions(List<Map<String,Object>> enumVars, Map<String,Object> vendorExtensions, String dataType)
public String addRegularExpressionDelimiter(String pattern)
pattern - the pattern (regular expression)public boolean convertPropertyToBooleanAndWriteBack(String propertyKey)
propertyKey - property keypublic String getIgnoreFilePathOverride()
This is originally intended for the first generation only.
getIgnoreFilePathOverride in interface CodegenConfigpublic void setIgnoreFilePathOverride(String ignoreFileOverride)
setIgnoreFilePathOverride in interface CodegenConfigignoreFileOverride - The full path to an ignore filepublic boolean convertPropertyToBoolean(String propertyKey)
public void writePropertyBack(String propertyKey, boolean value)
protected String getContentType(io.swagger.v3.oas.models.parameters.RequestBody requestBody)
public static Set<String> getConsumesInfo(io.swagger.v3.oas.models.OpenAPI openAPI, io.swagger.v3.oas.models.Operation operation)
public boolean hasFormParameter(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.Operation operation)
public boolean hasBodyParameter(io.swagger.v3.oas.models.OpenAPI openAPI,
io.swagger.v3.oas.models.Operation operation)
public static Set<String> getProducesInfo(io.swagger.v3.oas.models.OpenAPI openAPI, io.swagger.v3.oas.models.Operation operation)
openAPI - current specification instanceoperation - Operationprotected String getCollectionFormat(io.swagger.v3.oas.models.parameters.Parameter parameter)
public CodegenType getTag()
getTag in interface CodegenConfigpublic String getName()
getName in interface CodegenConfigpublic String getHelp()
getHelp in interface CodegenConfigpublic List<CodegenParameter> fromRequestBodyToFormParameters(io.swagger.v3.oas.models.parameters.RequestBody body, Set<String> imports)
public CodegenParameter fromFormProperty(String name, io.swagger.v3.oas.models.media.Schema propertySchema, Set<String> imports)
protected void addBodyModelSchema(CodegenParameter codegenParameter, String name, io.swagger.v3.oas.models.media.Schema schema, Set<String> imports, String bodyParameterName, boolean forceSimpleRef)
public CodegenParameter fromRequestBody(io.swagger.v3.oas.models.parameters.RequestBody body, Set<String> imports, String bodyParameterName)
protected void removeOption(String key)
protected void generateJSONSpecFile(Map<String,Object> objs)
objs - map of objectpublic void generateYAMLSpecFile(Map<String,Object> objs)
objs - map of objectpublic boolean isDataTypeString(String dataType)
dataType - data typepublic List<CodegenServer> fromServers(List<io.swagger.v3.oas.models.servers.Server> servers)
fromServers in interface CodegenConfigpublic List<CodegenServerVariable> fromServerVariables(Map<String,io.swagger.v3.oas.models.servers.ServerVariable> variables)
fromServerVariables in interface CodegenConfigprotected void setParameterNullable(CodegenParameter parameter, CodegenProperty property)
public void postProcessFile(File file, String fileType)
TODO: store these values in enum instead
postProcessFile in interface CodegenConfigfile - file to be processedfileType - file typepublic boolean isEnablePostProcessFile()
isEnablePostProcessFile in interface CodegenConfigpublic void setEnablePostProcessFile(boolean enablePostProcessFile)
setEnablePostProcessFile in interface CodegenConfigenablePostProcessFile - true to enable post-processing filepublic boolean isEnableMinimalUpdate()
isEnableMinimalUpdate in interface CodegenConfigpublic void setEnableMinimalUpdate(boolean enableMinimalUpdate)
setEnableMinimalUpdate in interface CodegenConfigenableMinimalUpdate - true to enable minimal updatepublic boolean isStrictSpecBehavior()
isStrictSpecBehavior in interface CodegenConfigpublic void setStrictSpecBehavior(boolean strictSpecBehavior)
setStrictSpecBehavior in interface CodegenConfigstrictSpecBehavior - true if we will behave strictly, false to allow specification documents which pass validation to be loosely interpreted against the spec.public FeatureSet getFeatureSet()
getFeatureSet in interface CodegenConfigpublic boolean isRemoveEnumValuePrefix()
isRemoveEnumValuePrefix in interface CodegenConfigpublic void setRemoveEnumValuePrefix(boolean removeEnumValuePrefix)
setRemoveEnumValuePrefix in interface CodegenConfigremoveEnumValuePrefix - true to enable enum value prefix removalpublic void addOneOfNameExtension(io.swagger.v3.oas.models.media.ComposedSchema s,
String name)
s - schema to add the extension toname - name of the parent oneOf schemapublic void addOneOfInterfaceModel(io.swagger.v3.oas.models.media.ComposedSchema cs,
String type,
io.swagger.v3.oas.models.OpenAPI openAPI)
cs - ComposedSchema object to create as interface modeltype - name to use for the generated interface modelopenAPI - OpenAPI spec that we are usingprotected void modifyFeatureSet(Consumer<FeatureSet.Builder> processor)
public boolean isAnyTypeSchema(io.swagger.v3.oas.models.media.Schema schema)
schema - the OAS schema.protected boolean isFreeFormObject(io.swagger.v3.oas.models.media.Schema schema)
schema - potentially containing a '$ref'protected io.swagger.v3.oas.models.media.Schema getAdditionalProperties(io.swagger.v3.oas.models.media.Schema schema)
schema - the input schema that may or may not have the additionalProperties keyword.protected static boolean isJsonMimeType(String mime)
mime - MIME stringprotected static boolean isJsonVendorMimeType(String mime)
mime - MIME stringprotected String getCollectionFormat(CodegenParameter codegenParameter)
CodegenParameter.codegenParameter - parameterCopyright © 2021. All rights reserved.