Class DefaultCodegen
- All Implemented Interfaces:
org.openapitools.codegen.CodegenConfig
- Direct Known Subclasses:
org.openapitools.codegen.languages.AbstractJavaCodegen,org.openapitools.codegen.languages.AbstractKotlinCodegen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected List<org.openapitools.codegen.CodegenModel>protected booleanprotected Booleanprotected Stringprotected Stringprotected Stringprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected List<org.openapitools.codegen.CliOption>static org.openapitools.codegen.meta.FeatureSetprotected booleanprotected booleanprotected Stringprotected Stringprotected booleanprotected booleanprotected Booleanprotected booleanprotected Stringprotected static io.swagger.v3.oas.models.media.Schemaprotected Stringprotected Stringprotected org.openapitools.codegen.meta.GeneratorMetadataprotected Stringprotected Stringprotected Stringprotected Booleanprotected Stringprotected Stringprotected booleanprotected booleanprotected Stringprotected static final Patternprotected static final Patternprotected booleanprotected Stringprotected booleanprotected booleanprotected booleanprotected booleanprotected booleanprotected Stringprotected Stringprotected Stringprotected io.swagger.v3.oas.models.OpenAPIprotected Stringprotected Booleanprotected Stringprotected booleanprotected booleanprotected intprotected Stringprotected booleanprotected booleanprotected booleanprotected Booleanprotected Booleanprotected booleanprotected List<org.openapitools.codegen.SupportingFile>protected booleanTrue if the language generator supports the 'additionalProperties' keyword as sibling of a composed (allOf/anyOf/oneOf) schema.protected booleanTrue if the code generator supports single class inheritance.protected booleanprotected booleanTrue if the code generator supports multiple class inheritance.protected Stringprotected Stringprotected static io.swagger.v3.oas.models.media.Schemaprotected booleanprotected Stringprotected static final Pattern -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAdditionPropertiesToCodeGenModel(org.openapitools.codegen.CodegenModel codegenModel, io.swagger.v3.oas.models.media.Schema schema) Handle the model for the 'additionalProperties' keyword in the OAS schema.protected voidaddBodyModelSchema(org.openapitools.codegen.CodegenParameter codegenParameter, String name, io.swagger.v3.oas.models.media.Schema schema, Set<String> imports, String bodyParameterName, boolean forceSimpleRef) protected voidaddHeaders(io.swagger.v3.oas.models.responses.ApiResponse response, List<org.openapitools.codegen.CodegenProperty> properties) Add headers to codegen propertyprotected voidaddImport(io.swagger.v3.oas.models.media.Schema composed, io.swagger.v3.oas.models.media.Schema childSchema, org.openapitools.codegen.CodegenModel model, String modelName) Add the model name of the child schema in a composed schema to the set of importsprotected voidprotected voidprotected voidaddImports(Set<String> importsToBeAddedTo, Set<String> importsToAdd) protected voidaddImports(Set<String> importsToBeAddedTo, org.openapitools.codegen.IJsonSchemaValidationProperties type) protected voidaddImports(org.openapitools.codegen.CodegenModel m, org.openapitools.codegen.IJsonSchemaValidationProperties type) protected voidaddImportsForPropertyType(org.openapitools.codegen.CodegenModel model, org.openapitools.codegen.CodegenProperty property) For a given property, adds all needed imports to the model This includes a flat property type (e.g.voidaddImportsToOneOfInterface(List<Map<String, String>> imports) protected com.google.common.collect.ImmutableMap.Builder<String,com.samskivert.mustache.Mustache.Lambda> Preset map builder with commonly used Mustache lambdas.voidaddOneOfInterfaceModel(io.swagger.v3.oas.models.media.Schema cs, String type) Add a given ComposedSchema as an interface model to be generated, assuming it has `oneOf` definedvoidaddOneOfNameExtension(io.swagger.v3.oas.models.media.Schema schema, String name) Add "x-one-of-name" extension to a given oneOf schema (assuming it has at least 1 oneOf elements)voidaddOperationToGroup(String tag, String resourcePath, io.swagger.v3.oas.models.Operation operation, org.openapitools.codegen.CodegenOperation co, Map<String, List<org.openapitools.codegen.CodegenOperation>> operations) Add operation to groupprotected voidprotected voidprotected voidaddParentContainer(org.openapitools.codegen.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 voidaddParentFromContainer(org.openapitools.codegen.CodegenModel model, io.swagger.v3.oas.models.media.Schema schema) protected voidaddProperties(Map<String, io.swagger.v3.oas.models.media.Schema> properties, List<String> required, io.swagger.v3.oas.models.media.Schema schema, Set<io.swagger.v3.oas.models.media.Schema> visitedSchemas) Add schema's properties to "properties" and "required" listaddRegularExpressionDelimiter(String pattern) If the pattern misses the delimiter, add "/" to the beginning and end Otherwise, return the original patternprotected voidaddRequiredVarsMap(io.swagger.v3.oas.models.media.Schema schema, org.openapitools.codegen.IJsonSchemaValidationProperties property) protected voidprotected voidaddVars(org.openapitools.codegen.CodegenModel m, Map<String, io.swagger.v3.oas.models.media.Schema> properties, List<String> required, Map<String, io.swagger.v3.oas.models.media.Schema> allProperties, List<String> allRequired) protected voidaddVars(org.openapitools.codegen.IJsonSchemaValidationProperties m, List<org.openapitools.codegen.CodegenProperty> vars, Map<String, io.swagger.v3.oas.models.media.Schema> properties, Set<String> mandatory) Add variables (properties) to codegen model (list of properties, various flags, etc)protected voidaddVarsRequiredVarsAdditionalProps(io.swagger.v3.oas.models.media.Schema schema, org.openapitools.codegen.IJsonSchemaValidationProperties property) apiDocFilename(String templateName, String tag) Return the full path and API documentation fileapiFilename(String templateName, String tag) apiFilename(String templateName, String tag, String outputDir) apiTestFilename(String templateName, String tag) Return the full path and API test filebuildEnumVars(List<Object> values, String dataType) protected org.openapitools.codegen.CliOptionbuildLibraryCliOption(Map<String, String> supportedLibraries) List<org.openapitools.codegen.CliOption>booleanconvertPropertyToBoolean(String propertyKey) booleanconvertPropertyToBooleanAndWriteBack(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.booleanconvertPropertyToBooleanAndWriteBack(String propertyKey, Consumer<Boolean> booleanSetter) reads propertyKey from additionalProperties, converts it to a boolean and writes it back to additionalProperties to be usable as a boolean in mustache files.convertPropertyToStringAndWriteBack(String propertyKey, Consumer<String> stringSetter) reads propertyKey from additionalProperties, converts it to a string and writes it back to additionalProperties to be usable as a string in mustache files.<T> TconvertPropertyToTypeAndWriteBack(String propertyKey, Function<String, T> converter, Consumer<T> genericTypeSetter) reads propertyKey from additionalProperties, converts it to T and writes it back to additionalProperties to be usable as T in mustache files.protected org.openapitools.codegen.CodegenDiscriminatorcreateDiscriminator(String schemaName, io.swagger.v3.oas.models.media.Schema schema) encodePath(String input) escapeQuotationMark(String input) Escape single and/or double quote to avoid code injectionescapeReservedWord(String name) Return the escaped name of the reserved wordescapeText(String input) escapeTextInSingleQuotes(String input) This method escapes text to be used in a single quoted stringEscape characters while allowing new linesescapeUnsafeCharacters(String input) override with any special text escaping logic to handle unsafe characters so as to avoid code injectionprotected booleanexecutePostProcessor(String[] commandArr) Executes an external command for file post processing.findCommonPrefixOfVars(List<Object> vars) Returns the common prefix of variables for enum naming if two or more variables are presentprotected io.swagger.v3.oas.models.responses.ApiResponsefindMethodResponse(io.swagger.v3.oas.models.responses.ApiResponses responses) Override with any special handling of response codesorg.openapitools.codegen.CodegenCallbackfromCallback(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 objectorg.openapitools.codegen.CodegenParameterfromFormProperty(String name, io.swagger.v3.oas.models.media.Schema propertySchema, Set<String> imports) org.openapitools.codegen.CodegenModelConvert OAS Model object to Codegen Model object.org.openapitools.codegen.CodegenOperationfromOperation(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 objectorg.openapitools.codegen.CodegenParameterfromParameter(io.swagger.v3.oas.models.parameters.Parameter parameter, Set<String> imports) Convert OAS Parameter object to Codegen Parameter objectorg.openapitools.codegen.CodegenPropertyfromProperty(String name, io.swagger.v3.oas.models.media.Schema p) TODO remove this in 7.0.0 as a breaking change This method was kept when required was added to the fromProperty signature to ensure that the change was non-breakingorg.openapitools.codegen.CodegenPropertyfromProperty(String name, io.swagger.v3.oas.models.media.Schema p, boolean required) TODO remove this in 7.0.0 as a breaking change This method was kept when required was added to the fromProperty signature to ensure that the change was non-breakingorg.openapitools.codegen.CodegenPropertyfromProperty(String name, io.swagger.v3.oas.models.media.Schema p, boolean required, boolean schemaIsFromAdditionalProperties) Convert OAS Property object to Codegen Property object.org.openapitools.codegen.CodegenParameterfromRequestBody(io.swagger.v3.oas.models.parameters.RequestBody body, Set<String> imports, String bodyParameterName) List<org.openapitools.codegen.CodegenParameter>fromRequestBodyToFormParameters(io.swagger.v3.oas.models.parameters.RequestBody body, Set<String> imports) org.openapitools.codegen.CodegenResponsefromResponse(String responseCode, io.swagger.v3.oas.models.responses.ApiResponse response) Convert OAS Response object to Codegen Response objectList<org.openapitools.codegen.CodegenSecurity>fromSecurity(Map<String, io.swagger.v3.oas.models.security.SecurityScheme> securitySchemeMap) Convert map of OAS SecurityScheme objects to a list of Codegen Security objectsList<org.openapitools.codegen.CodegenServer>fromServers(List<io.swagger.v3.oas.models.servers.Server> servers) List<org.openapitools.codegen.CodegenServerVariable>fromServerVariables(Map<String, io.swagger.v3.oas.models.servers.ServerVariable> variables) generateExamplePath(String path, io.swagger.v3.oas.models.Operation operation) Return the example pathprotected voidgenerateJSONSpecFile(Map<String, Object> objs) generates OpenAPI specification file in JSON formatvoidgenerateYAMLSpecFile(Map<String, Object> objs) generates OpenAPI specification file in YAML formatorg.openapitools.codegen.GeneratorLanguageprotected StringbooleanDetermine the type alias for the given type if it exists.getAllModels(Map<String, org.openapitools.codegen.model.ModelsMap> objs) Index all CodegenModels by model name.protected List<org.openapitools.codegen.CodegenDiscriminator.MappedModel>getAllOfDescendants(String thisSchemaName) protected StringgetCollectionFormat(io.swagger.v3.oas.models.parameters.Parameter parameter) protected StringgetCollectionFormat(org.openapitools.codegen.CodegenParameter codegenParameter) Builds OAPI 2.0 collectionFormat value based on style and explode values for theCodegenParameter.getConsumesInfo(io.swagger.v3.oas.models.OpenAPI openAPI, io.swagger.v3.oas.models.Operation operation) protected LinkedHashMap<String,org.openapitools.codegen.CodegenMediaType> getContent(io.swagger.v3.oas.models.media.Content content, Set<String> imports, String mediaTypeSchemaSuffix) protected StringgetContentType(io.swagger.v3.oas.models.parameters.RequestBody requestBody) Documentation files extensionprotected StringgetEnumDefaultValue(String defaultValue, String dataType) protected static StringgetEnumValueForProperty(String modelName, org.openapitools.codegen.CodegenDiscriminator discriminator, org.openapitools.codegen.CodegenProperty var) Retrieves the appropriate default value for an enum discriminator property based on the model name.org.openapitools.codegen.meta.FeatureSetorg.openapitools.codegen.meta.GeneratorMetadataReturns metadata about the generator.Git host.Git repo IDGit user IDgetHelp()HTTP user agentProvides an override location, if any is specified, for the .openapi-generator-ignore.getInnerEnumAllowableValues(org.openapitools.codegen.CodegenProperty property) protected StringgetItemsName(io.swagger.v3.oas.models.media.Schema containingSchema, String containingSchemaName) Library template (sub-template).Return a map from model name to Schema for efficient lookup.protected org.openapitools.codegen.CodegenPropertygetMostInnerItems(org.openapitools.codegen.CodegenProperty property) getName()protected List<org.openapitools.codegen.CodegenDiscriminator.MappedModel>getOneOfAnyOfDescendants(String composedSchemaName, String discPropName, io.swagger.v3.oas.models.media.Schema c) 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 StringgetOrGenerateOperationId(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.protected StringgetParameterDataType(io.swagger.v3.oas.models.parameters.Parameter parameter, io.swagger.v3.oas.models.media.Schema schema) Returns the data type of parameter.getProducesInfo(io.swagger.v3.oas.models.OpenAPI openAPI, io.swagger.v3.oas.models.Operation operation) returns the list of MIME types the APIs can produceRelease noteintprotected io.swagger.v3.oas.models.media.Schema<?>getSchemaAdditionalProperties(io.swagger.v3.oas.models.media.Schema schema) protected io.swagger.v3.oas.models.media.SchemagetSchemaFromBooleanOrSchema(Object schema) Used to ensure that null or Schema is returned given an input Boolean/Schema/null This will be used in openapi 3.1.0 spec processing to ensure that Booleans become Schemas Because our generators only understand Schemas Note: use getIsBooleanSchemaTrue or getIsBooleanSchemaFalse on the IJsonSchemaValidationProperties if you need to be able to detect if the original schema's value was true or falsegetSchemaType(io.swagger.v3.oas.models.media.Schema schema) returns the OpenAPI type for the property.protected StringgetSingleSchemaType(io.swagger.v3.oas.models.media.Schema schema) Return a string representation of the schema type, resolving aliasing and references if necessary.List<org.openapitools.codegen.VendorExtension>protected StringgetSymbolName(String input) Return the symbol name of a symbolorg.openapitools.codegen.CodegenTypegetTag()org.openapitools.codegen.api.TemplatingEngineAdapterCamelize the method name of the getter and settergetTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema) Output the language-specific type declaration of the property.getTypeDeclaration(String name) Output the language-specific type declaration of a given OAS name.booleanbooleanprotected voidhandleConstantParams(org.openapitools.codegen.CodegenOperation operation) This method removes all constant Query, Header and Cookie Params from allParams and sets them as constantParams in the CodegenOperation.protected voidhandleMethodResponse(io.swagger.v3.oas.models.Operation operation, Map<String, io.swagger.v3.oas.models.media.Schema> schemas, org.openapitools.codegen.CodegenOperation op, io.swagger.v3.oas.models.responses.ApiResponse methodResponse) Set op's returnBaseType, returnType, examples etc.protected voidhandleMethodResponse(io.swagger.v3.oas.models.Operation operation, Map<String, io.swagger.v3.oas.models.media.Schema> schemas, org.openapitools.codegen.CodegenOperation op, io.swagger.v3.oas.models.responses.ApiResponse methodResponse, Map<String, String> schemaMappings) Set op's returnBaseType, returnType, examples etc.protected StringbooleanhasBodyParameter(io.swagger.v3.oas.models.Operation operation) booleanhasFormParameter(io.swagger.v3.oas.models.Operation operation) protected voidInitialize special character mappingbooleanbooleanbooleanbooleanbooleanisDataTypeBinary(String dataType) booleanisDataTypeFile(String dataType) booleanisDataTypeString(String dataType) checks if the data should be classified as "string" in enum e.g.booleanbooleanGet the boolean value indicating the state of the option for updating only changed filesbooleanBoolean value indicating the state of the option for post-processing file using environment variables.booleanstatic booleanisJsonMimeType(String mime) Check if the given MIME is a JSON MIME.protected static booleanisJsonVendorMimeType(String mime) Check if the given MIME is a JSON Vendor MIME.final booleancheck if current active library equals to passedbooleanbooleanbooleanbooleanbooleanisParameterNameUnique(org.openapitools.codegen.CodegenParameter p, List<org.openapitools.codegen.CodegenParameter> parameters) protected BooleanisPropertyInnerMostEnum(org.openapitools.codegen.CodegenProperty property) Update property for map containerbooleanGet the boolean value indicating whether to remove enum value prefixesbooleanprotected booleanisReservedWord(String word) booleanbooleanbooleanbooleanIndicates whether the codegen configuration should treat documents as strictly defined by the OpenAPI specification.booleanstatic booleanisXmlMimeType(String mime) lowerCamelCase(String name) Return the lowerCamelCase of the stringmodelFilename(String templateName, String modelName) modelFilename(String templateName, String modelName, String outputDir) protected voidmodifyFeatureSet(Consumer<org.openapitools.codegen.meta.FeatureSet.Builder> processor) protected booleanneedToImport(String type) Check the type to see if it needs import the library/module/packagevoidpostProcessAllModels(Map<String, org.openapitools.codegen.model.ModelsMap> objs) protected voidpostProcessEnumVars(List<Map<String, Object>> enumVars) voidpostProcessFile(File file, String fileType) Post-process the auto-generated file, e.g.voidpostProcessModelProperty(org.openapitools.codegen.CodegenModel model, org.openapitools.codegen.CodegenProperty property) org.openapitools.codegen.model.ModelsMappostProcessModels(org.openapitools.codegen.model.ModelsMap objs) org.openapitools.codegen.model.ModelsMappostProcessModelsEnum(org.openapitools.codegen.model.ModelsMap objs) post process enum defined in model's propertiesorg.openapitools.codegen.model.OperationsMappostProcessOperationsWithModels(org.openapitools.codegen.model.OperationsMap objs, List<org.openapitools.codegen.model.ModelMap> allModels) voidpostProcessParameter(org.openapitools.codegen.CodegenParameter parameter) voidpostProcessResponseWithProperty(org.openapitools.codegen.CodegenResponse response, org.openapitools.codegen.CodegenProperty property) org.openapitools.codegen.model.WebhooksMappostProcessWebhooksWithModels(org.openapitools.codegen.model.WebhooksMap objs, List<org.openapitools.codegen.model.ModelMap> allModels) voidpreprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI) com.samskivert.mustache.Mustache.CompilerprocessCompiler(com.samskivert.mustache.Mustache.Compiler compiler) voidprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI) voidorg.openapitools.codegen.api.TemplatingEngineAdapterprocessTemplatingEngine(org.openapitools.codegen.api.TemplatingEngineAdapter templatingEngine) protected ObjectprocessTestExampleData(Object data) A method that allows generators to pre-process test example payloads This can be useful if one needs to change how values like null in string are representedprotected voidremoveImport(org.openapitools.codegen.model.OperationsMap objs, String importToRemove) Removes importToRemove from the imports of objs, if present.Remove characters not suitable for variable or method name from the input and camelize itprotected StringremoveNonNameElementToCamelCase(String name, String nonNameElementPattern) Remove characters that is not good to be included in method name from the input and camelize itprotected voidremoveOption(String key) protected voidremoveSelfReferenceImports(org.openapitools.codegen.CodegenModel model) Removes imports from the model that points to itself Marks a self referencing property, if detectedsanitizeName(String name) Sanitize name (parameter, property, method, etc)sanitizeName(String name, String removeCharRegEx) Sanitize name (parameter, property, method, etc)sanitizeName(String name, String removeCharRegEx, ArrayList<String> exceptionList) Sanitize name (parameter, property, method, etc)sanitizeTag(String tag) Sanitize tagprotected voidsetAddProps(io.swagger.v3.oas.models.media.Schema schema, org.openapitools.codegen.IJsonSchemaValidationProperties property) voidsetAllowUnicodeIdentifiers(Boolean allowUnicodeIdentifiers) voidsetApiNamePrefix(String apiNamePrefix) voidsetApiNameSuffix(String apiNameSuffix) voidsetApiPackage(String apiPackage) voidsetArrayDefaultToEmpty(boolean arrayDefaultToEmpty) voidsetArrayNullableDefaultToEmpty(boolean arrayNullableDefaultToEmpty) voidsetArrayOptionalDefaultToEmpty(boolean arrayOptionalDefaultToEmpty) voidsetArrayOptionalNullableDefaultToEmpty(boolean arrayOptionalNullableDefaultToEmpty) voidsetAutosetConstants(boolean autosetConstants) voidsetCircularReferences(Map<String, org.openapitools.codegen.CodegenModel> models) voidsetDefaultToEmptyContainer(boolean defaultToEmptyContainer) voidsetDisallowAdditionalPropertiesIfNotPresent(boolean disallowAdditionalPropertiesIfNotPresent) voidsetDocExtension(String userDocExtension) Set Documentation files extensionvoidsetEnableMinimalUpdate(boolean enableMinimalUpdate) Set the boolean value indicating the state of the option for updating only changed filesvoidsetEnablePostProcessFile(boolean enablePostProcessFile) Set the boolean value indicating the state of the option for post-processing file using environment variables.voidsetEnsureUniqueParams(Boolean ensureUniqueParams) protected static voidsetEnumDiscriminatorDefaultValue(org.openapitools.codegen.CodegenModel model) Sets the default value for an enum discriminator property in the providedCodegenModel.voidsetEnumUnknownDefaultCase(boolean enumUnknownDefaultCase) voidsetFilesMetadataFilename(String filesMetadataFilename) voidsetGitHost(String gitHost) Set Git host.voidsetGitRepoId(String gitRepoId) Set Git repo ID.voidsetGitUserId(String gitUserId) Set Git user ID.voidsetHideGenerationTimestamp(boolean hideGenerationTimestamp) voidsetHttpUserAgent(String httpUserAgent) Set HTTP user agent.voidsetIgnoreFilePathOverride(String ignoreFileOverride) Sets an override location for the '.openapi-generator-ignore' location for the first code generation.voidsetInputSpec(String inputSpec) voidsetLegacyDiscriminatorBehavior(boolean legacyDiscriminatorBehavior) voidsetLibrary(String library) Set library template (sub-template).voidsetMapDefaultToEmpty(boolean mapDefaultToEmpty) voidsetMapNullableDefaultToEmpty(boolean mapNullableDefaultToEmpty) voidsetMapOptionalDefaultToEmpty(boolean mapOptionalDefaultToEmpty) voidsetMapOptionalNullableDefaultToEmpty(boolean mapOptionalNullableDefaultToEmpty) voidsetModelNamePrefix(String modelNamePrefix) voidsetModelNameSuffix(String modelNameSuffix) voidsetModelPackage(String modelPackage) protected voidsetNonArrayMapProperty(org.openapitools.codegen.CodegenProperty property, String type) voidsetOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI) Set the OpenAPI document.voidsetOutputDir(String dir) voidsetParameterBooleanFlagWithCodegenProperty(org.openapitools.codegen.CodegenParameter parameter, org.openapitools.codegen.CodegenProperty property) Set CodegenParameter boolean flag using CodegenProperty.voidsetParameterEncodingValues(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.media.MediaType mediaType) Sets the content type, style, and explode of the parameter based on the encoding specified in the request body.voidsetParameterExamples(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.parameters.Parameter parameter) Return the examples of the parameter.voidsetParameterExampleValue(org.openapitools.codegen.CodegenParameter codegenParameter) Return the example value of the parameter.voidsetParameterExampleValue(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.parameters.Parameter parameter) Return the example value of the parameter.voidsetParameterExampleValue(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.parameters.RequestBody requestBody) Return the example value of the parameter.protected voidsetParameterNullable(org.openapitools.codegen.CodegenParameter parameter, org.openapitools.codegen.CodegenProperty property) voidsetPrependFormOrBodyParameters(Boolean prependFormOrBodyParameters) voidsetReleaseNote(String releaseNote) Set release note.voidsetRemoveEnumValuePrefix(boolean removeEnumValuePrefix) Set the boolean value indicating whether to remove enum value prefixesvoidsetRemoveOperationIdPrefix(boolean removeOperationIdPrefix) voidsetRemoveOperationIdPrefixCount(int removeOperationIdPrefixCount) voidsetRemoveOperationIdPrefixDelimiter(String removeOperationIdPrefixDelimiter) protected voidsetReservedWordsLowerCase(List<String> words) voidsetSkipOperationExample(boolean skipOperationExample) voidsetSkipOverwrite(boolean skipOverwrite) voidsetSkipSortingOperations(boolean skipSortingOperations) voidsetSortModelPropertiesByRequiredFlag(Boolean sortModelPropertiesByRequiredFlag) voidsetSortParamsByRequiredFlag(Boolean sortParamsByRequiredFlag) voidsetStrictSpecBehavior(boolean strictSpecBehavior) Sets the boolean valid indicating whether generation will work strictly against the specification, potentially making minor changes to the input document.voidsetTemplateDir(String templateDir) voidsetTemplatingEngine(org.openapitools.codegen.api.TemplatingEngineAdapter templatingEngine) voidsetUseOneOfInterfaces(Boolean useOneOfInterfaces) voidsetVersionMetadataFilename(String versionMetadataFilename) protected booleanshouldAddImport(String type) booleanshouldOverwrite(String filename) protected voidSortModelPropertiesByRequiredFlag(org.openapitools.codegen.CodegenModel model) voidSortParametersByRequiredFlag(List<org.openapitools.codegen.CodegenParameter> parameters) booleanspecVersionGreaterThanOrEqualTo310(io.swagger.v3.oas.models.OpenAPI openAPI) All library templates supported.List<org.openapitools.codegen.SupportingFile>toAllOfName(List<String> names, io.swagger.v3.oas.models.media.Schema composedSchema) Return the name of the 'allOf' composed schema.toAnyOfName(List<String> names, io.swagger.v3.oas.models.media.Schema composedSchema) Return the name of the anyOf schematoApiDocFilename(String name) Return the file name of the Api DocumentationtoApiFilename(String name) Return the file name of the ApitoApiImport(String name) Return the fully-qualified "Api" name for importOutput the API (class) name (capitalized) ending with the specified or default suffix Return DefaultApi if name is emptytoApiTestFilename(String name) Return the file name of the Api TesttoApiVarName(String name) Return the variable name in the ApitoArrayModelParamName(String name) Return the parameter name of array of modeltoBooleanGetter(String name) Output the Getter name for boolean property, e.g.toDefaultParameterValue(io.swagger.v3.oas.models.media.Schema<?> schema) Return the default value of the parametertoDefaultParameterValue(org.openapitools.codegen.CodegenProperty codegenProperty, io.swagger.v3.oas.models.media.Schema<?> schema) Return the default value of the parametertoDefaultValue(io.swagger.v3.oas.models.media.Schema schema) Return the default value of the propertytoDefaultValue(org.openapitools.codegen.CodegenProperty codegenProperty, io.swagger.v3.oas.models.media.Schema schema) Return the default value of the propertytoDefaultValueWithParam(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 JavascripttoEnumDefaultValue(String value, String datatype) Return the enum default value in the language specified formattoEnumDefaultValue(org.openapitools.codegen.CodegenProperty property, String value) Return the enum default value in the language specified formattoEnumName(org.openapitools.codegen.CodegenProperty property) Return the Enum name (e.g.toEnumValue(String value, String datatype) Return the enum value in the language specified format e.g.toEnumVarName(String value, String datatype) Return the sanitized variable name for enumtoExamples(Map<String, Object> examples) toExampleValue(io.swagger.v3.oas.models.media.Schema schema) Return the example value of the propertyOutput the Getter name, e.g.toInstantiationType(io.swagger.v3.oas.models.media.Schema schema) Return the instantiation type of the property, especially for map and arrayprotected StringtoMediaTypeSchemaName(String contentType, String mediaTypeSchemaSuffix) toModelDocFilename(String name) Return the capitalized file name of the model documentationtoModelFilename(String name) Return the capitalized file name of the modeltoModelImport(String name) Return the fully-qualified "Model" name for importtoModelImportMap(String name) Returns the same content as [[toModelImport]] with key the fully-qualified Model name and value the initial input.toModelName(String name) Converts the OpenAPI schema name to a model name suitable for the current code generator.toModelTestFilename(String name) Return the capitalized file name of the model testtoOneOfName(List<String> names, io.swagger.v3.oas.models.media.Schema composedSchema) Return the name of the oneOf schema.toOperationId(String operationId) Return the operation ID (method name)toParamName(String name) Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.toRegularExpression(String pattern) Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)Output the Setter name, e.g.protected StringtoTestCaseName(String specTestCaseName) Return the variable name by removing invalid characters and proper escaping if it's a reserved word.unaliasPropertySchema(Map<String, io.swagger.v3.oas.models.media.Schema> properties) Loop through properties and unalias the reference if $ref (reference) is definedio.swagger.v3.oas.models.media.SchemaunaliasSchema(io.swagger.v3.oas.models.media.Schema schema) updateAllModels(Map<String, org.openapitools.codegen.model.ModelsMap> objs) Loop through all models to update different flags (e.g.voidupdateCodegenPropertyEnum(org.openapitools.codegen.CodegenProperty var) Update codegen property's enum by adding "enumVars" (with name and value)protected voidupdateDataTypeWithEnumForArray(org.openapitools.codegen.CodegenProperty property) Update datatypeWithEnum for array containerprotected voidupdateDataTypeWithEnumForMap(org.openapitools.codegen.CodegenProperty property) Update datatypeWithEnum for map containerprotected voidupdateEnumVarsWithExtensions(List<Map<String, Object>> enumVars, Map<String, Object> vendorExtensions, String dataType) protected voidupdateModelForAnyType(org.openapitools.codegen.CodegenModel m, io.swagger.v3.oas.models.media.Schema schema) protected voidupdateModelForComposedSchema(org.openapitools.codegen.CodegenModel m, io.swagger.v3.oas.models.media.Schema schema, Map<String, io.swagger.v3.oas.models.media.Schema> allDefinitions) protected voidupdateModelForInteger(org.openapitools.codegen.CodegenModel model, io.swagger.v3.oas.models.media.Schema schema) protected voidupdateModelForNumber(org.openapitools.codegen.CodegenModel model, io.swagger.v3.oas.models.media.Schema schema) protected voidupdateModelForObject(org.openapitools.codegen.CodegenModel m, io.swagger.v3.oas.models.media.Schema schema) protected voidupdateModelForString(org.openapitools.codegen.CodegenModel model, io.swagger.v3.oas.models.media.Schema schema) Sets the booleans that define the model's typeprotected voidupdateOption(String key, String defaultValue) protected voidupdateParameterForString(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.media.Schema parameterSchema) protected voidupdatePropertyForAnyType(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) protected voidupdatePropertyForArray(org.openapitools.codegen.CodegenProperty property, org.openapitools.codegen.CodegenProperty innerProperty) Update property for array(list) containerprotected voidupdatePropertyForInteger(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) protected voidupdatePropertyForMap(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) protected voidupdatePropertyForMap(org.openapitools.codegen.CodegenProperty property, org.openapitools.codegen.CodegenProperty innerProperty) Update property for map containerprotected voidupdatePropertyForNumber(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) protected voidupdatePropertyForObject(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) protected voidupdatePropertyForString(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) protected voidupdateRequestBodyForArray(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.media.Schema schema, String name, Set<String> imports, String bodyParameterName) protected voidupdateRequestBodyForMap(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.media.Schema schema, String name, Set<String> imports, String bodyParameterName) protected voidupdateRequestBodyForObject(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.media.Schema schema, String name, Set<String> imports, String bodyParameterName) protected voidupdateRequestBodyForPrimitiveType(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.media.Schema schema, String bodyParameterName, Set<String> imports) protected voidupdateRequestBodyForString(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.media.Schema schema, Set<String> imports, String bodyParameterName) protected voidadd this instance to additionalProperties.voidwritePropertyBack(String propertyKey, Object value)
-
Field Details
-
DefaultFeatureSet
public static org.openapitools.codegen.meta.FeatureSet DefaultFeatureSet -
falseSchema
protected static io.swagger.v3.oas.models.media.Schema falseSchema -
trueSchema
protected static io.swagger.v3.oas.models.media.Schema trueSchema -
generatorMetadata
protected org.openapitools.codegen.meta.GeneratorMetadata generatorMetadata -
inputSpec
-
outputFolder
-
defaultIncludes
-
typeMapping
-
instantiationTypes
-
reservedWords
-
languageSpecificPrimitives
-
openapiGeneratorIgnoreList
-
importMapping
-
schemaMapping
-
inlineSchemaNameMapping
-
inlineSchemaOption
-
nameMapping
-
parameterNameMapping
-
modelNameMapping
-
enumNameMapping
-
operationIdNameMapping
-
openapiNormalizer
-
fileSuffix
-
modelNamePrefix
-
modelNameSuffix
-
apiNamePrefix
-
apiNameSuffix
-
testPackage
-
modelPackage
-
apiPackage
-
filesMetadataFilename
-
versionMetadataFilename
-
apiTemplateFiles
-
modelTemplateFiles
-
apiTestTemplateFiles
-
modelTestTemplateFiles
-
apiDocTemplateFiles
-
modelDocTemplateFiles
-
reservedWordsMappings
-
templateDir
-
embeddedTemplateDir
-
additionalProperties
-
serverVariables
-
vendorExtensions
-
templateOutputDirs
-
supportingFiles
-
cliOptions
-
skipOverwrite
protected boolean skipOverwrite -
removeOperationIdPrefix
protected boolean removeOperationIdPrefix -
removeOperationIdPrefixDelimiter
-
removeOperationIdPrefixCount
protected int removeOperationIdPrefixCount -
skipOperationExample
protected boolean skipOperationExample -
skipSortingOperations
protected boolean skipSortingOperations -
XML_MIME_PATTERN
-
JSON_MIME_PATTERN
-
JSON_VENDOR_MIME_PATTERN
-
supportsMultipleInheritance
protected boolean supportsMultipleInheritanceTrue if the code generator supports multiple class inheritance. This is used to model the parent hierarchy based on the 'allOf' composed schemas. -
supportsInheritance
protected boolean supportsInheritanceTrue if the code generator supports single class inheritance. This is used to model the parent hierarchy based on the 'allOf' composed schemas. Note: the single-class inheritance technique has inherent limitations because a 'allOf' composed schema may have multiple $ref child schemas, each one potentially representing a "parent" in the class inheritance hierarchy. Some language generators also use class inheritance to implement the `additionalProperties` keyword. For example, the Java code generator may generate 'extends HashMap'. -
supportsAdditionalPropertiesWithComposedSchema
protected boolean supportsAdditionalPropertiesWithComposedSchemaTrue if the language generator supports the 'additionalProperties' keyword as sibling of a composed (allOf/anyOf/oneOf) schema. Note: all language generators should support this to comply with the OAS specification. -
supportsMixins
protected boolean supportsMixins -
supportedLibraries
-
library
-
sortParamsByRequiredFlag
-
sortModelPropertiesByRequiredFlag
-
ensureUniqueParams
-
allowUnicodeIdentifiers
-
gitHost
-
gitUserId
-
gitRepoId
-
releaseNote
-
httpUserAgent
-
hideGenerationTimestamp
-
specialCharReplacements
-
typeAliases
-
prependFormOrBodyParameters
-
docExtension
-
ignoreFilePathOverride
-
enablePostProcessFile
protected boolean enablePostProcessFile -
useOneOfInterfaces
protected boolean useOneOfInterfaces -
addOneOfInterfaceImports
protected boolean addOneOfInterfaceImports -
addOneOfInterfaces
-
enableMinimalUpdate
protected boolean enableMinimalUpdate -
strictSpecBehavior
protected boolean strictSpecBehavior -
removeEnumValuePrefix
protected boolean removeEnumValuePrefix -
legacyDiscriminatorBehavior
protected boolean legacyDiscriminatorBehavior -
disallowAdditionalPropertiesIfNotPresent
protected boolean disallowAdditionalPropertiesIfNotPresent -
enumUnknownDefaultCase
protected boolean enumUnknownDefaultCase -
enumUnknownDefaultCaseName
-
openAPI
protected io.swagger.v3.oas.models.OpenAPI openAPI -
loadDeepObjectIntoItems
protected boolean loadDeepObjectIntoItems -
importBaseType
protected boolean importBaseType -
importContainerType
protected boolean importContainerType -
addSuffixToDuplicateOperationNicknames
protected boolean addSuffixToDuplicateOperationNicknames -
autosetConstants
protected boolean autosetConstants -
arrayDefaultToEmpty
protected boolean arrayDefaultToEmpty -
arrayNullableDefaultToEmpty
protected boolean arrayNullableDefaultToEmpty -
arrayOptionalNullableDefaultToEmpty
protected boolean arrayOptionalNullableDefaultToEmpty -
arrayOptionalDefaultToEmpty
protected boolean arrayOptionalDefaultToEmpty -
mapDefaultToEmpty
protected boolean mapDefaultToEmpty -
mapNullableDefaultToEmpty
protected boolean mapNullableDefaultToEmpty -
mapOptionalNullableDefaultToEmpty
protected boolean mapOptionalNullableDefaultToEmpty -
mapOptionalDefaultToEmpty
protected boolean mapOptionalDefaultToEmpty -
defaultToEmptyContainer
protected boolean defaultToEmptyContainer
-
-
Constructor Details
-
DefaultCodegen
public DefaultCodegen()Default constructor. This method will map between OAS type and language-specified type, as well as mapping between OAS type and the corresponding import statement for the language. This will also add some language specified CLI options, if any. returns string presentation of the example path (it's a constructor)
-
-
Method Details
-
getAddSuffixToDuplicateOperationNicknames
public boolean getAddSuffixToDuplicateOperationNicknames()- Specified by:
getAddSuffixToDuplicateOperationNicknamesin interfaceorg.openapitools.codegen.CodegenConfig
-
cliOptions
- Specified by:
cliOptionsin interfaceorg.openapitools.codegen.CodegenConfig
-
useCodegenAsMustacheParentContext
protected void useCodegenAsMustacheParentContext()add this instance to additionalProperties. This instance is used as parent context in Mustache. It means that Mustache uses the values found in this order: first from additionalProperties then from the getter in this instance then from the fields in this instance -
processOpts
public void processOpts()- Specified by:
processOptsin interfaceorg.openapitools.codegen.CodegenConfig
-
addMustacheLambdas
protected com.google.common.collect.ImmutableMap.Builder<String,com.samskivert.mustache.Mustache.Lambda> addMustacheLambdas()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. Corresponding user documentation: docs/templating.md, section "Mustache Lambdas"- Returns:
- preinitialized map with common lambdas
-
postProcessAllModels
public Map<String,org.openapitools.codegen.model.ModelsMap> postProcessAllModels(Map<String, org.openapitools.codegen.model.ModelsMap> objs) - Specified by:
postProcessAllModelsin interfaceorg.openapitools.codegen.CodegenConfig
-
getModelNameToSchemaCache
Return a map from model name to Schema for efficient lookup.- Returns:
- map from model name to Schema.
-
getAllModels
public Map<String,org.openapitools.codegen.CodegenModel> getAllModels(Map<String, org.openapitools.codegen.model.ModelsMap> objs) Index all CodegenModels by model name.- Parameters:
objs- Map of models- Returns:
- map of all models indexed by names
-
updateAllModels
public Map<String,org.openapitools.codegen.model.ModelsMap> updateAllModels(Map<String, org.openapitools.codegen.model.ModelsMap> objs) Loop through all models to update different flags (e.g. isSelfReference), children models, etc and update mapped models for import.- Specified by:
updateAllModelsin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
objs- Map of models- Returns:
- maps of models with various updates
-
removeImport
protected void removeImport(org.openapitools.codegen.model.OperationsMap objs, String importToRemove) Removes importToRemove from the imports of objs, if present. This is useful to remove imports that are already present in operations-related template files, to avoid importing the same thing twice.- Parameters:
objs- imports will be removed from this objs' imports collectionimportToRemove- the import statement to be removed
-
removeSelfReferenceImports
protected void removeSelfReferenceImports(org.openapitools.codegen.CodegenModel model) Removes imports from the model that points to itself Marks a self referencing property, if detected- Parameters:
model- Self imports will be removed from this model.imports collection
-
setCircularReferences
-
postProcessModels
public org.openapitools.codegen.model.ModelsMap postProcessModels(org.openapitools.codegen.model.ModelsMap objs) - Specified by:
postProcessModelsin interfaceorg.openapitools.codegen.CodegenConfig
-
postProcessModelsEnum
public org.openapitools.codegen.model.ModelsMap postProcessModelsEnum(org.openapitools.codegen.model.ModelsMap objs) post process enum defined in model's properties- Parameters:
objs- Map of models- Returns:
- maps of models with better enum support
-
findCommonPrefixOfVars
Returns the common prefix of variables for enum naming if two or more variables are present- Parameters:
vars- List of variable names- Returns:
- the common prefix for naming
-
toEnumDefaultValue
Return the enum default value in the language specified format- Parameters:
value- enum variable namedatatype- data type- Returns:
- the default value for the enum
-
toEnumDefaultValue
Return the enum default value in the language specified format- Parameters:
property- The codegen property to create the default for.value- Enum variable name- Returns:
- the default value for the enum
-
toEnumValue
Return the enum value in the language specified format e.g. status becomes "status"- Parameters:
value- enum variable namedatatype- data type- Returns:
- the sanitized value for enum
-
toEnumVarName
Return the sanitized variable name for enum- Parameters:
value- enum variable namedatatype- data type- Returns:
- the sanitized variable name for enum
-
specVersionGreaterThanOrEqualTo310
public boolean specVersionGreaterThanOrEqualTo310(io.swagger.v3.oas.models.OpenAPI openAPI) -
setOpenAPI
public void setOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI) Set the OpenAPI document. This method is invoked when the input OpenAPI document has been parsed and validated.- Specified by:
setOpenAPIin interfaceorg.openapitools.codegen.CodegenConfig
-
postProcess
public void postProcess()- Specified by:
postProcessin interfaceorg.openapitools.codegen.CodegenConfig
-
postProcessOperationsWithModels
public org.openapitools.codegen.model.OperationsMap postProcessOperationsWithModels(org.openapitools.codegen.model.OperationsMap objs, List<org.openapitools.codegen.model.ModelMap> allModels) - Specified by:
postProcessOperationsWithModelsin interfaceorg.openapitools.codegen.CodegenConfig
-
postProcessWebhooksWithModels
public org.openapitools.codegen.model.WebhooksMap postProcessWebhooksWithModels(org.openapitools.codegen.model.WebhooksMap objs, List<org.openapitools.codegen.model.ModelMap> allModels) - Specified by:
postProcessWebhooksWithModelsin interfaceorg.openapitools.codegen.CodegenConfig
-
postProcessSupportingFileData
- Specified by:
postProcessSupportingFileDatain interfaceorg.openapitools.codegen.CodegenConfig
-
postProcessModelProperty
public void postProcessModelProperty(org.openapitools.codegen.CodegenModel model, org.openapitools.codegen.CodegenProperty property) - Specified by:
postProcessModelPropertyin interfaceorg.openapitools.codegen.CodegenConfig
-
postProcessResponseWithProperty
public void postProcessResponseWithProperty(org.openapitools.codegen.CodegenResponse response, org.openapitools.codegen.CodegenProperty property) - Specified by:
postProcessResponseWithPropertyin interfaceorg.openapitools.codegen.CodegenConfig
-
postProcessParameter
public void postProcessParameter(org.openapitools.codegen.CodegenParameter parameter) - Specified by:
postProcessParameterin interfaceorg.openapitools.codegen.CodegenConfig
-
preprocessOpenAPI
public void preprocessOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI) - Specified by:
preprocessOpenAPIin interfaceorg.openapitools.codegen.CodegenConfig
-
processOpenAPI
public void processOpenAPI(io.swagger.v3.oas.models.OpenAPI openAPI) - Specified by:
processOpenAPIin interfaceorg.openapitools.codegen.CodegenConfig
-
processCompiler
public com.samskivert.mustache.Mustache.Compiler processCompiler(com.samskivert.mustache.Mustache.Compiler compiler) - Specified by:
processCompilerin interfaceorg.openapitools.codegen.CodegenConfig
-
processTemplatingEngine
public org.openapitools.codegen.api.TemplatingEngineAdapter processTemplatingEngine(org.openapitools.codegen.api.TemplatingEngineAdapter templatingEngine) - Specified by:
processTemplatingEnginein interfaceorg.openapitools.codegen.CodegenConfig
-
escapeText
- Specified by:
escapeTextin interfaceorg.openapitools.codegen.CodegenConfig
-
escapeTextInSingleQuotes
This method escapes text to be used in a single quoted string- Parameters:
input- the input string- Returns:
- the escaped string
-
escapeTextWhileAllowingNewLines
Escape characters while allowing new lines- Specified by:
escapeTextWhileAllowingNewLinesin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
input- String to be escaped- Returns:
- escaped string
-
encodePath
- Specified by:
encodePathin interfaceorg.openapitools.codegen.CodegenConfig
-
escapeUnsafeCharacters
override with any special text escaping logic to handle unsafe characters so as to avoid code injection- Specified by:
escapeUnsafeCharactersin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
input- String to be cleaned up- Returns:
- string with unsafe characters removed or escaped
-
escapeQuotationMark
Escape single and/or double quote to avoid code injection- Specified by:
escapeQuotationMarkin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
input- String to be cleaned up- Returns:
- string with quotation mark removed or escaped
-
defaultIncludes
- Specified by:
defaultIncludesin interfaceorg.openapitools.codegen.CodegenConfig
-
typeMapping
- Specified by:
typeMappingin interfaceorg.openapitools.codegen.CodegenConfig
-
instantiationTypes
- Specified by:
instantiationTypesin interfaceorg.openapitools.codegen.CodegenConfig
-
reservedWords
- Specified by:
reservedWordsin interfaceorg.openapitools.codegen.CodegenConfig
-
languageSpecificPrimitives
- Specified by:
languageSpecificPrimitivesin interfaceorg.openapitools.codegen.CodegenConfig
-
openapiGeneratorIgnoreList
- Specified by:
openapiGeneratorIgnoreListin interfaceorg.openapitools.codegen.CodegenConfig
-
importMapping
- Specified by:
importMappingin interfaceorg.openapitools.codegen.CodegenConfig
-
schemaMapping
- Specified by:
schemaMappingin interfaceorg.openapitools.codegen.CodegenConfig
-
inlineSchemaNameMapping
- Specified by:
inlineSchemaNameMappingin interfaceorg.openapitools.codegen.CodegenConfig
-
inlineSchemaOption
- Specified by:
inlineSchemaOptionin interfaceorg.openapitools.codegen.CodegenConfig
-
nameMapping
- Specified by:
nameMappingin interfaceorg.openapitools.codegen.CodegenConfig
-
parameterNameMapping
- Specified by:
parameterNameMappingin interfaceorg.openapitools.codegen.CodegenConfig
-
modelNameMapping
- Specified by:
modelNameMappingin interfaceorg.openapitools.codegen.CodegenConfig
-
enumNameMapping
- Specified by:
enumNameMappingin interfaceorg.openapitools.codegen.CodegenConfig
-
operationIdNameMapping
- Specified by:
operationIdNameMappingin interfaceorg.openapitools.codegen.CodegenConfig
-
openapiNormalizer
- Specified by:
openapiNormalizerin interfaceorg.openapitools.codegen.CodegenConfig
-
testPackage
- Specified by:
testPackagein interfaceorg.openapitools.codegen.CodegenConfig
-
modelPackage
- Specified by:
modelPackagein interfaceorg.openapitools.codegen.CodegenConfig
-
apiPackage
- Specified by:
apiPackagein interfaceorg.openapitools.codegen.CodegenConfig
-
fileSuffix
- Specified by:
fileSuffixin interfaceorg.openapitools.codegen.CodegenConfig
-
templateDir
- Specified by:
templateDirin interfaceorg.openapitools.codegen.CodegenConfig
-
setTemplateDir
-
embeddedTemplateDir
- Specified by:
embeddedTemplateDirin interfaceorg.openapitools.codegen.CodegenConfig
-
apiDocTemplateFiles
- Specified by:
apiDocTemplateFilesin interfaceorg.openapitools.codegen.CodegenConfig
-
modelDocTemplateFiles
- Specified by:
modelDocTemplateFilesin interfaceorg.openapitools.codegen.CodegenConfig
-
reservedWordsMappings
- Specified by:
reservedWordsMappingsin interfaceorg.openapitools.codegen.CodegenConfig
-
apiTestTemplateFiles
- Specified by:
apiTestTemplateFilesin interfaceorg.openapitools.codegen.CodegenConfig
-
modelTestTemplateFiles
- Specified by:
modelTestTemplateFilesin interfaceorg.openapitools.codegen.CodegenConfig
-
apiTemplateFiles
- Specified by:
apiTemplateFilesin interfaceorg.openapitools.codegen.CodegenConfig
-
modelTemplateFiles
- Specified by:
modelTemplateFilesin interfaceorg.openapitools.codegen.CodegenConfig
-
apiFileFolder
- Specified by:
apiFileFolderin interfaceorg.openapitools.codegen.CodegenConfig
-
modelFileFolder
- Specified by:
modelFileFolderin interfaceorg.openapitools.codegen.CodegenConfig
-
apiTestFileFolder
- Specified by:
apiTestFileFolderin interfaceorg.openapitools.codegen.CodegenConfig
-
modelTestFileFolder
- Specified by:
modelTestFileFolderin interfaceorg.openapitools.codegen.CodegenConfig
-
apiDocFileFolder
- Specified by:
apiDocFileFolderin interfaceorg.openapitools.codegen.CodegenConfig
-
modelDocFileFolder
- Specified by:
modelDocFileFolderin interfaceorg.openapitools.codegen.CodegenConfig
-
additionalProperties
- Specified by:
additionalPropertiesin interfaceorg.openapitools.codegen.CodegenConfig
-
serverVariableOverrides
- Specified by:
serverVariableOverridesin interfaceorg.openapitools.codegen.CodegenConfig
-
vendorExtensions
- Specified by:
vendorExtensionsin interfaceorg.openapitools.codegen.CodegenConfig
-
templateOutputDirs
- Specified by:
templateOutputDirsin interfaceorg.openapitools.codegen.CodegenConfig
-
supportingFiles
- Specified by:
supportingFilesin interfaceorg.openapitools.codegen.CodegenConfig
-
outputFolder
- Specified by:
outputFolderin interfaceorg.openapitools.codegen.CodegenConfig
-
setOutputDir
- Specified by:
setOutputDirin interfaceorg.openapitools.codegen.CodegenConfig
-
getOutputDir
- Specified by:
getOutputDirin interfaceorg.openapitools.codegen.CodegenConfig
-
getInputSpec
- Specified by:
getInputSpecin interfaceorg.openapitools.codegen.CodegenConfig
-
setInputSpec
- Specified by:
setInputSpecin interfaceorg.openapitools.codegen.CodegenConfig
-
getFilesMetadataFilename
- Specified by:
getFilesMetadataFilenamein interfaceorg.openapitools.codegen.CodegenConfig
-
getVersionMetadataFilename
- Specified by:
getVersionMetadataFilenamein interfaceorg.openapitools.codegen.CodegenConfig
-
getLegacyDiscriminatorBehavior
-
getDisallowAdditionalPropertiesIfNotPresent
-
getEnumUnknownDefaultCase
-
getUseOneOfInterfaces
-
setUseOneOfInterfaces
-
toRegularExpression
Return the regular expression/JSON schema pattern (http://json-schema.org/latest/json-schema-validation.html#anchor33)- Parameters:
pattern- the pattern (regular expression)- Returns:
- properly-escaped pattern
-
toApiFilename
Return the file name of the Api- Specified by:
toApiFilenamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the file name of the Api- Returns:
- the file name of the Api
-
toApiDocFilename
Return the file name of the Api Documentation- Specified by:
toApiDocFilenamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the file name of the Api- Returns:
- the file name of the Api
-
toApiTestFilename
Return the file name of the Api Test- Specified by:
toApiTestFilenamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the file name of the Api- Returns:
- the file name of the Api
-
toApiVarName
Return the variable name in the Api- Specified by:
toApiVarNamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the variable name of the Api- Returns:
- the snake-cased variable name
-
toModelFilename
Return the capitalized file name of the model- Specified by:
toModelFilenamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the model name- Returns:
- the file name of the model
-
toModelTestFilename
Return the capitalized file name of the model test- Specified by:
toModelTestFilenamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the model name- Returns:
- the file name of the model
-
toModelDocFilename
Return the capitalized file name of the model documentation- Specified by:
toModelDocFilenamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the model name- Returns:
- the file name of the model
-
getGeneratorMetadata
public org.openapitools.codegen.meta.GeneratorMetadata getGeneratorMetadata()Returns metadata about the generator.- Specified by:
getGeneratorMetadatain interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- A provided
GeneratorMetadatainstance
-
toOperationId
Return the operation ID (method name)- Parameters:
operationId- operation ID- Returns:
- the sanitized method name
-
toVarName
Return the variable name by removing invalid characters and proper escaping if it's a reserved word.- Parameters:
name- the variable name- Returns:
- the sanitized variable name
-
toParamName
Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.- Specified by:
toParamNamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- Codegen property object- Returns:
- the sanitized parameter name
-
toArrayModelParamName
Return the parameter name of array of model- Parameters:
name- name of the array model- Returns:
- the sanitized parameter name
-
toEnumName
Return the Enum name (e.g. StatusEnum given 'status')- Parameters:
property- Codegen property- Returns:
- the Enum name
-
escapeReservedWord
Return the escaped name of the reserved word- Specified by:
escapeReservedWordin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the name to be escaped- Returns:
- the escaped reserved word
throws Runtime exception as reserved word is not allowed (default behavior)
-
toModelImport
Return the fully-qualified "Model" name for import- Specified by:
toModelImportin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the name of the "Model"- Returns:
- the fully-qualified "Model" name for import
-
toModelImportMap
Returns the same content as [[toModelImport]] with key the fully-qualified Model name and value the initial input. In case of union types this method has a key for each separate model and import.- Specified by:
toModelImportMapin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the name of the "Model"- Returns:
- Map of fully-qualified models.
-
toApiImport
Return the fully-qualified "Api" name for import- Specified by:
toApiImportin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the name of the "Api"- Returns:
- the fully-qualified "Api" name for import
-
initializeSpecialCharacterMapping
protected void initializeSpecialCharacterMapping()Initialize special character mapping -
getSymbolName
Return the symbol name of a symbol- Parameters:
input- Symbol (e.g. $)- Returns:
- Symbol name (e.g. Dollar)
-
generateExamplePath
Return the example path- Specified by:
generateExamplePathin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
path- the path of the operationoperation- OAS operation object- Returns:
- string presentation of the example path
-
toInstantiationType
Return the instantiation type of the property, especially for map and array- Parameters:
schema- property schema- Returns:
- string presentation of the instantiation type of the property
-
setParameterExampleValue
public void setParameterExampleValue(org.openapitools.codegen.CodegenParameter codegenParameter) Return the example value of the parameter.- Parameters:
codegenParameter- Codegen parameter
-
setParameterExampleValue
public void setParameterExampleValue(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.parameters.Parameter parameter) Return the example value of the parameter.- Parameters:
codegenParameter- Codegen parameterparameter- Parameter
-
setParameterExamples
public void setParameterExamples(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.parameters.Parameter parameter) Return the examples of the parameter.- Parameters:
codegenParameter- Codegen parameterparameter- Parameter
-
setParameterExampleValue
public void setParameterExampleValue(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.parameters.RequestBody requestBody) Return the example value of the parameter.- Parameters:
codegenParameter- Codegen parameterrequestBody- Request body
-
setParameterEncodingValues
public void setParameterEncodingValues(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.media.MediaType mediaType) Sets the content type, style, and explode of the parameter based on the encoding specified in the request body.- Parameters:
codegenParameter- Codegen parametermediaType- MediaType from the request body
-
toExampleValue
Return the example value of the propertyThis method should be overridden in the generator to meet its requirement.
- Parameters:
schema- Property schema- Returns:
- string presentation of the example value of the property
-
toDefaultValue
Return the default value of the propertyThis 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.
- Parameters:
schema- Property schema- Returns:
- string presentation of the default value of the property
-
toDefaultParameterValue
Return the default value of the parameterReturn null if you do NOT want a default value. Any non-null value will cause {{#defaultValue} check to pass.
- Parameters:
schema- Parameter schema- Returns:
- string presentation of the default value of the parameter
-
toDefaultParameterValue
public String toDefaultParameterValue(org.openapitools.codegen.CodegenProperty codegenProperty, io.swagger.v3.oas.models.media.Schema<?> schema) Return the default value of the parameterReturn null if you do NOT want a default value. Any non-null value will cause {{#defaultValue} check to pass.
- Parameters:
codegenProperty- Codegen Propertyschema- Parameter schema- Returns:
- string presentation of the default value of the parameter
-
toDefaultValueWithParam
Return the property initialized from a data object Useful for initialization with a plain object in Javascript- Parameters:
name- Name of the property objectschema- Property schema- Returns:
- string presentation of the default value of the property
-
toDefaultValue
public String toDefaultValue(org.openapitools.codegen.CodegenProperty codegenProperty, io.swagger.v3.oas.models.media.Schema schema) Return the default value of the propertyReturn null if you do NOT want a default value. Any non-null value will cause {{#defaultValue} check to pass.
- Parameters:
schema- Property schemacodegenProperty- Codegen property- Returns:
- string presentation of the default value of the property
-
getSchemaType
returns the OpenAPI type for the property. Use getAlias to handle $ref of primitive type- Parameters:
schema- property schema- Returns:
- string presentation of the type
-
getSchemaAdditionalProperties
protected io.swagger.v3.oas.models.media.Schema<?> getSchemaAdditionalProperties(io.swagger.v3.oas.models.media.Schema schema) -
toAllOfName
Return the name of the 'allOf' composed schema.- Parameters:
names- List of namescomposedSchema- composed schema- Returns:
- name of the allOf schema
-
toAnyOfName
Return the name of the anyOf schema- Parameters:
names- List of namescomposedSchema- composed schema- Returns:
- name of the anyOf schema
-
toOneOfName
Return the name of the oneOf schema.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.
- Parameters:
names- List of namescomposedSchema- composed schema- Returns:
- name of the oneOf schema
-
unaliasSchema
public io.swagger.v3.oas.models.media.Schema unaliasSchema(io.swagger.v3.oas.models.media.Schema schema) - Specified by:
unaliasSchemain interfaceorg.openapitools.codegen.CodegenConfig
-
getSingleSchemaType
Return a string representation of the schema type, resolving aliasing and references if necessary.- Parameters:
schema- input- Returns:
- the string representation of the schema type.
-
lowerCamelCase
Return the lowerCamelCase of the string- Parameters:
name- string to be lowerCamelCased- Returns:
- lowerCamelCase string
-
getTypeDeclaration
Output the language-specific type declaration of a given OAS name.- Specified by:
getTypeDeclarationin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- name- Returns:
- a string presentation of the type
-
getTypeDeclaration
Output the language-specific type declaration of the property.- Specified by:
getTypeDeclarationin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
schema- property schema- Returns:
- a string presentation of the property type
-
getAlias
Determine the type alias for the given type if it exists. This feature was originally developed for Java because the language does not have an aliasing mechanism of its own but later extends to handle other languages- Parameters:
name- The type name.- Returns:
- The alias of the given type, if it exists. If there is no alias for this type, then returns the input type name.
-
toBooleanGetter
Output the Getter name for boolean property, e.g. getActive- Specified by:
toBooleanGetterin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the name of the property- Returns:
- getter name based on naming convention
-
toGetter
Output the Getter name, e.g. getSize- Specified by:
toGetterin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the name of the property- Returns:
- getter name based on naming convention
-
toSetter
Output the Setter name, e.g. setSize- Specified by:
toSetterin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the name of the property- Returns:
- setter name based on naming convention
-
toApiName
Output the API (class) name (capitalized) ending with the specified or default suffix Return DefaultApi if name is empty- Specified by:
toApiNamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the name of the Api- Returns:
- capitalized Api name
-
toModelName
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:
toModelNamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the name of the model- Returns:
- capitalized model name
-
updateModelForComposedSchema
-
updateModelForObject
protected void updateModelForObject(org.openapitools.codegen.CodegenModel m, io.swagger.v3.oas.models.media.Schema schema) -
updateModelForAnyType
protected void updateModelForAnyType(org.openapitools.codegen.CodegenModel m, io.swagger.v3.oas.models.media.Schema schema) -
toTestCaseName
-
processTestExampleData
A method that allows generators to pre-process test example payloads This can be useful if one needs to change how values like null in string are represented- Parameters:
data- the test data payload- Returns:
- the updated test data payload
-
updateModelForString
protected void updateModelForString(org.openapitools.codegen.CodegenModel model, io.swagger.v3.oas.models.media.Schema schema) Sets the booleans that define the model's type- Parameters:
model- the model to updateschema- the model's schema
-
updateModelForNumber
protected void updateModelForNumber(org.openapitools.codegen.CodegenModel model, io.swagger.v3.oas.models.media.Schema schema) -
updateModelForInteger
protected void updateModelForInteger(org.openapitools.codegen.CodegenModel model, io.swagger.v3.oas.models.media.Schema schema) -
fromModel
public org.openapitools.codegen.CodegenModel fromModel(String name, io.swagger.v3.oas.models.media.Schema schema) Convert OAS Model object to Codegen Model object.- Specified by:
fromModelin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- the name of the modelschema- OAS Model object- Returns:
- Codegen Model object
-
setEnumDiscriminatorDefaultValue
protected static void setEnumDiscriminatorDefaultValue(org.openapitools.codegen.CodegenModel model) Sets the default value for an enum discriminator property in the providedCodegenModel.If the model's discriminator is defined, this method identifies the discriminator properties among the model's variables and assigns the default value to reflect the corresponding enum value for the model type.
Example: If the discriminator is for type `Animal`, and the model is `Cat`, the default value will be set to `Animal.Cat` for the properties that have the same name as the discriminator.
- Parameters:
model- theCodegenModelwhose discriminator property default value is to be set
-
getEnumValueForProperty
protected static String getEnumValueForProperty(String modelName, org.openapitools.codegen.CodegenDiscriminator discriminator, org.openapitools.codegen.CodegenProperty var) Retrieves the appropriate default value for an enum discriminator property based on the model name.If the discriminator has a mapping defined, it attempts to find a mapping for the model name. Otherwise, it defaults to one of the allowable enum value associated with the property. If no suitable value is found, the original default value of the property is returned.
- Parameters:
modelName- the name of the model to determine the default value fordiscriminator- theCodegenDiscriminatorcontaining the mapping and enum detailsvar- theCodegenPropertyrepresenting the discriminator property- Returns:
- the default value for the enum discriminator property, or its original default value if none is found
-
SortModelPropertiesByRequiredFlag
protected void SortModelPropertiesByRequiredFlag(org.openapitools.codegen.CodegenModel model) -
setAddProps
protected void setAddProps(io.swagger.v3.oas.models.media.Schema schema, org.openapitools.codegen.IJsonSchemaValidationProperties property) -
getOneOfAnyOfDescendants
protected List<org.openapitools.codegen.CodegenDiscriminator.MappedModel> getOneOfAnyOfDescendants(String composedSchemaName, String discPropName, io.swagger.v3.oas.models.media.Schema c) 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. If they don't contain the required discriminator or the discriminator is the wrong type then an error is thrown- Parameters:
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 schemas- Returns:
- the list of oneOf and anyOf MappedModel that need to be added to the discriminator map
-
getAllOfDescendants
-
createDiscriminator
protected org.openapitools.codegen.CodegenDiscriminator createDiscriminator(String schemaName, io.swagger.v3.oas.models.media.Schema schema) -
addAdditionPropertiesToCodeGenModel
protected void addAdditionPropertiesToCodeGenModel(org.openapitools.codegen.CodegenModel codegenModel, io.swagger.v3.oas.models.media.Schema schema) Handle the model for the 'additionalProperties' keyword in the OAS schema.- Parameters:
codegenModel- The codegen representation of the schema.schema- The input OAS schema.
-
addProperties
protected void addProperties(Map<String, io.swagger.v3.oas.models.media.Schema> properties, List<String> required, io.swagger.v3.oas.models.media.Schema schema, Set<io.swagger.v3.oas.models.media.Schema> visitedSchemas) Add schema's properties to "properties" and "required" list- Parameters:
properties- all propertiesrequired- required property onlyschema- schema in which the properties will be added to the listsvisitedSchemas- circuit-breaker - the schemas with which the method was called before for recursive structures
-
getterAndSetterCapitalize
Camelize the method name of the getter and setter- Parameters:
name- string to be camelized- Returns:
- Camelized string
-
updatePropertyForMap
protected void updatePropertyForMap(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) -
updatePropertyForObject
protected void updatePropertyForObject(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) -
updatePropertyForAnyType
protected void updatePropertyForAnyType(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) -
updatePropertyForString
protected void updatePropertyForString(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) -
updatePropertyForNumber
protected void updatePropertyForNumber(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) -
updatePropertyForInteger
protected void updatePropertyForInteger(org.openapitools.codegen.CodegenProperty property, io.swagger.v3.oas.models.media.Schema p) -
fromProperty
public org.openapitools.codegen.CodegenProperty fromProperty(String name, io.swagger.v3.oas.models.media.Schema p, boolean required) TODO remove this in 7.0.0 as a breaking change This method was kept when required was added to the fromProperty signature to ensure that the change was non-breaking- Parameters:
name- name of the propertyp- OAS property schemarequired- true if the property is required in the next higher object schema, false otherwise- Returns:
- Codegen Property object
-
fromProperty
public org.openapitools.codegen.CodegenProperty fromProperty(String name, io.swagger.v3.oas.models.media.Schema p) TODO remove this in 7.0.0 as a breaking change This method was kept when required was added to the fromProperty signature to ensure that the change was non-breaking- Parameters:
name- name of the propertyp- OAS property schema- Returns:
- Codegen Property object
-
fromProperty
public org.openapitools.codegen.CodegenProperty fromProperty(String name, io.swagger.v3.oas.models.media.Schema p, boolean required, boolean schemaIsFromAdditionalProperties) Convert OAS Property object 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 p) arguments. Any subsequent processing of the CodegenModel return value must be idempotent for a given (String name, Schema schema).
- Parameters:
name- name of the propertyp- OAS property schemarequired- true if the property is required in the next higher object schema, false otherwiseschemaIsFromAdditionalProperties- true if the property is a required property defined by additional properties schema If this is the actual additionalProperties schema not defining a required property, then the value should be false- Returns:
- Codegen Property object
-
updatePropertyForArray
protected void updatePropertyForArray(org.openapitools.codegen.CodegenProperty property, org.openapitools.codegen.CodegenProperty innerProperty) Update property for array(list) container- Parameters:
property- Codegen propertyinnerProperty- Codegen inner property of map or list
-
updatePropertyForMap
protected void updatePropertyForMap(org.openapitools.codegen.CodegenProperty property, org.openapitools.codegen.CodegenProperty innerProperty) Update property for map container- Parameters:
property- Codegen propertyinnerProperty- Codegen inner property of map or list
-
isPropertyInnerMostEnum
Update property for map container- Parameters:
property- Codegen property- Returns:
- True if the inner most type is enum
-
getMostInnerItems
protected org.openapitools.codegen.CodegenProperty getMostInnerItems(org.openapitools.codegen.CodegenProperty property) -
getInnerEnumAllowableValues
-
updateDataTypeWithEnumForArray
protected void updateDataTypeWithEnumForArray(org.openapitools.codegen.CodegenProperty property) Update datatypeWithEnum for array container- Parameters:
property- Codegen property
-
updateDataTypeWithEnumForMap
protected void updateDataTypeWithEnumForMap(org.openapitools.codegen.CodegenProperty property) Update datatypeWithEnum for map container- Parameters:
property- Codegen property
-
setNonArrayMapProperty
protected void setNonArrayMapProperty(org.openapitools.codegen.CodegenProperty property, String type) -
findMethodResponse
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- Parameters:
responses- OAS Operation's responses- Returns:
- default method response or
nullif not found
-
handleMethodResponse
protected void handleMethodResponse(io.swagger.v3.oas.models.Operation operation, Map<String, io.swagger.v3.oas.models.media.Schema> schemas, org.openapitools.codegen.CodegenOperation op, io.swagger.v3.oas.models.responses.ApiResponse methodResponse) Set op's returnBaseType, returnType, examples etc.- Parameters:
operation- endpoint Operationschemas- a map of the schemas in the OpenAPI specop- endpoint CodegenOperationmethodResponse- the default ApiResponse for the endpoint
-
handleMethodResponse
protected void handleMethodResponse(io.swagger.v3.oas.models.Operation operation, Map<String, io.swagger.v3.oas.models.media.Schema> schemas, org.openapitools.codegen.CodegenOperation op, io.swagger.v3.oas.models.responses.ApiResponse methodResponse, Map<String, String> schemaMappings) Set op's returnBaseType, returnType, examples etc.- Parameters:
operation- endpoint Operationschemas- a map of the schemas in the OpenAPI specop- endpoint CodegenOperationmethodResponse- the default ApiResponse for the endpointschemaMappings- mappings of external types to be omitted by unaliasing
-
fromOperation
public org.openapitools.codegen.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:
fromOperationin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
httpMethod- HTTP methodoperation- OAS operation objectpath- the path of the operationservers- list of servers- Returns:
- Codegen Operation object
-
SortParametersByRequiredFlag
public void SortParametersByRequiredFlag(List<org.openapitools.codegen.CodegenParameter> parameters) -
isParameterNameUnique
public boolean isParameterNameUnique(org.openapitools.codegen.CodegenParameter p, List<org.openapitools.codegen.CodegenParameter> parameters) -
fromResponse
public org.openapitools.codegen.CodegenResponse fromResponse(String responseCode, io.swagger.v3.oas.models.responses.ApiResponse response) Convert OAS Response object to Codegen Response object- Parameters:
responseCode- HTTP response coderesponse- OAS Response object- Returns:
- Codegen Response object
-
fromCallback
public org.openapitools.codegen.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- Parameters:
name- callback namecallback- OAS Callback objectservers- list of servers- Returns:
- Codegen Response object
-
updateParameterForString
protected void updateParameterForString(org.openapitools.codegen.CodegenParameter codegenParameter, io.swagger.v3.oas.models.media.Schema parameterSchema) -
fromParameter
public org.openapitools.codegen.CodegenParameter fromParameter(io.swagger.v3.oas.models.parameters.Parameter parameter, Set<String> imports) Convert OAS Parameter object to Codegen Parameter object- Parameters:
parameter- OAS parameter objectimports- set of imports for library/package/module- Returns:
- Codegen Parameter object
-
getParameterDataType
protected String getParameterDataType(io.swagger.v3.oas.models.parameters.Parameter parameter, io.swagger.v3.oas.models.media.Schema schema) Returns the data type of parameter. Returns null by default to use the CodegenProperty.datatype value- Parameters:
parameter- Parameterschema- Schema- Returns:
- data type
-
isDataTypeBinary
-
isDataTypeFile
-
fromSecurity
public List<org.openapitools.codegen.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- Specified by:
fromSecurityin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
securitySchemeMap- a map of OAS SecuritySchemeDefinition object- Returns:
- a list of Codegen Security objects
-
setReservedWordsLowerCase
-
isReservedWord
-
getOrGenerateOperationId
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.- Parameters:
operation- the operation objectpath- the path of the operationhttpMethod- the HTTP method of the operation- Returns:
- the (generated) operationId
-
needToImport
Check the type to see if it needs import the library/module/package- Parameters:
type- name of the type- Returns:
- true if the library/module/package of the corresponding type needs to be imported
-
toExamples
-
addHeaders
protected void addHeaders(io.swagger.v3.oas.models.responses.ApiResponse response, List<org.openapitools.codegen.CodegenProperty> properties) Add headers to codegen property- Parameters:
response- API responseproperties- list of codegen property
-
addOperationToGroup
public void addOperationToGroup(String tag, String resourcePath, io.swagger.v3.oas.models.Operation operation, org.openapitools.codegen.CodegenOperation co, Map<String, List<org.openapitools.codegen.CodegenOperation>> operations) Add operation to group- Specified by:
addOperationToGroupin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
tag- name of the tagresourcePath- path of the resourceoperation- OAS Operation objectco- Codegen Operation objectoperations- map of Codegen operations
-
addParentFromContainer
protected void addParentFromContainer(org.openapitools.codegen.CodegenModel model, io.swagger.v3.oas.models.media.Schema schema) -
addParentContainer
protected void addParentContainer(org.openapitools.codegen.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. Some language generator use class inheritance to implement additional properties. For example, in Java the generated model class has 'extends HashMap' to represent the additional properties.TODO: it's not a good idea to use single class inheritance to implement additionalProperties. That may work for non-composed schemas, but that does not work for composed 'allOf' schemas. For example, in Java, if additionalProperties is set to true (which it should be by default, per OAS spec), then the generated code has extends HashMap. That wouldn't work for composed 'allOf' schemas.
- Parameters:
model- the codegen representation of the OAS schema.name- the name of the model.schema- the input OAS schema.
-
addImports
protected void addImports(org.openapitools.codegen.CodegenModel m, org.openapitools.codegen.IJsonSchemaValidationProperties type) -
addImports
-
addImports
-
addImport
-
addImport
-
addImport
protected void addImport(io.swagger.v3.oas.models.media.Schema composed, io.swagger.v3.oas.models.media.Schema childSchema, org.openapitools.codegen.CodegenModel model, String modelName) Add the model name of the child schema in a composed schema to the set of imports- Parameters:
composed- composed schemachildSchema- composed schemamodel- codegen modelmodelName- model name
-
shouldAddImport
-
unaliasPropertySchema
protected Map<String,io.swagger.v3.oas.models.media.Schema> unaliasPropertySchema(Map<String, io.swagger.v3.oas.models.media.Schema> properties) Loop through properties and unalias the reference if $ref (reference) is defined- Parameters:
properties- model properties (schemas)- Returns:
- model properties with direct reference to schemas
-
addVars
-
addVars
protected void addVars(org.openapitools.codegen.IJsonSchemaValidationProperties m, List<org.openapitools.codegen.CodegenProperty> vars, Map<String, io.swagger.v3.oas.models.media.Schema> properties, Set<String> mandatory) Add variables (properties) to codegen model (list of properties, various flags, etc)- Parameters:
m- Must be an instance of IJsonSchemaValidationProperties, may be model or property...vars- list of codegen properties (e.g. vars, allVars) to be updated with the new propertiesproperties- a map of properties (schema)mandatory- a set of required properties' name
-
addImportsForPropertyType
protected void addImportsForPropertyType(org.openapitools.codegen.CodegenModel model, org.openapitools.codegen.CodegenProperty property) For a given property, adds all needed imports to the model This includes a flat property type (e.g. property type: ReferencedModel) as well as container type (property type: array of ReferencedModel's)- Parameters:
model- The codegen representation of the OAS schema.property- The codegen representation of the OAS schema's property.
-
removeNonNameElementToCamelCase
Remove characters not suitable for variable or method name from the input and camelize it- Parameters:
name- string to be camelize- Returns:
- camelized string
-
removeNonNameElementToCamelCase
Remove characters that is not good to be included in method name from the input and camelize it- Parameters:
name- string to be camelizenonNameElementPattern- a regex pattern of the characters that is not good to be included in name- Returns:
- camelized string
-
apiFilename
- Specified by:
apiFilenamein interfaceorg.openapitools.codegen.CodegenConfig
-
apiFilename
- Specified by:
apiFilenamein interfaceorg.openapitools.codegen.CodegenConfig
-
modelFilename
- Specified by:
modelFilenamein interfaceorg.openapitools.codegen.CodegenConfig
-
modelFilename
- Specified by:
modelFilenamein interfaceorg.openapitools.codegen.CodegenConfig
-
apiDocFilename
Return the full path and API documentation file- Specified by:
apiDocFilenamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
templateName- template nametag- tag- Returns:
- the API documentation file name with full path
-
apiTestFilename
Return the full path and API test file- Specified by:
apiTestFilenamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
templateName- template nametag- tag- Returns:
- the API test file name with full path
-
shouldOverwrite
- Specified by:
shouldOverwritein interfaceorg.openapitools.codegen.CodegenConfig
-
isSkipOverwrite
public boolean isSkipOverwrite()- Specified by:
isSkipOverwritein interfaceorg.openapitools.codegen.CodegenConfig
-
setSkipOverwrite
public void setSkipOverwrite(boolean skipOverwrite) - Specified by:
setSkipOverwritein interfaceorg.openapitools.codegen.CodegenConfig
-
isRemoveOperationIdPrefix
public boolean isRemoveOperationIdPrefix()- Specified by:
isRemoveOperationIdPrefixin interfaceorg.openapitools.codegen.CodegenConfig
-
isSkipOperationExample
public boolean isSkipOperationExample()- Specified by:
isSkipOperationExamplein interfaceorg.openapitools.codegen.CodegenConfig
-
setRemoveOperationIdPrefix
public void setRemoveOperationIdPrefix(boolean removeOperationIdPrefix) - Specified by:
setRemoveOperationIdPrefixin interfaceorg.openapitools.codegen.CodegenConfig
-
setSkipOperationExample
public void setSkipOperationExample(boolean skipOperationExample) - Specified by:
setSkipOperationExamplein interfaceorg.openapitools.codegen.CodegenConfig
-
isSkipSortingOperations
public boolean isSkipSortingOperations()- Specified by:
isSkipSortingOperationsin interfaceorg.openapitools.codegen.CodegenConfig
-
setSkipSortingOperations
public void setSkipSortingOperations(boolean skipSortingOperations) - Specified by:
setSkipSortingOperationsin interfaceorg.openapitools.codegen.CodegenConfig
-
isHideGenerationTimestamp
public boolean isHideGenerationTimestamp()- Specified by:
isHideGenerationTimestampin interfaceorg.openapitools.codegen.CodegenConfig
-
setHideGenerationTimestamp
public void setHideGenerationTimestamp(boolean hideGenerationTimestamp) - Specified by:
setHideGenerationTimestampin interfaceorg.openapitools.codegen.CodegenConfig
-
supportedLibraries
All library templates supported. (key: library name, value: library description)- Specified by:
supportedLibrariesin interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- the supported libraries
-
setLibrary
Set library template (sub-template).- Specified by:
setLibraryin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
library- Library template
-
getLibrary
Library template (sub-template).- Specified by:
getLibraryin interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- Library template
-
isLibrary
check if current active library equals to passed- Parameters:
library- - library to be compared with- Returns:
trueif passed library is active,falseotherwise
-
setGitHost
Set Git host.- Specified by:
setGitHostin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
gitHost- Git host
-
getGitHost
Git host.- Specified by:
getGitHostin interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- Git host
-
setGitUserId
Set Git user ID.- Specified by:
setGitUserIdin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
gitUserId- Git user ID
-
getGitUserId
Git user ID- Specified by:
getGitUserIdin interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- Git user ID
-
setGitRepoId
Set Git repo ID.- Specified by:
setGitRepoIdin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
gitRepoId- Git repo ID
-
getGitRepoId
Git repo ID- Specified by:
getGitRepoIdin interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- Git repo ID
-
setReleaseNote
Set release note.- Specified by:
setReleaseNotein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
releaseNote- Release note
-
getReleaseNote
Release note- Specified by:
getReleaseNotein interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- Release note
-
getDocExtension
Documentation files extension- Specified by:
getDocExtensionin interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- Documentation files extension
-
setDocExtension
Set Documentation files extension- Specified by:
setDocExtensionin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
userDocExtension- documentation files extension
-
setHttpUserAgent
Set HTTP user agent.- Specified by:
setHttpUserAgentin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
httpUserAgent- HTTP user agent
-
getHttpUserAgent
HTTP user agent- Specified by:
getHttpUserAgentin interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- HTTP user agent
-
buildLibraryCliOption
-
sanitizeName
Sanitize name (parameter, property, method, etc)- Specified by:
sanitizeNamein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
name- string to be sanitize- Returns:
- sanitized string
-
setTemplatingEngine
public void setTemplatingEngine(org.openapitools.codegen.api.TemplatingEngineAdapter templatingEngine) - Specified by:
setTemplatingEnginein interfaceorg.openapitools.codegen.CodegenConfig
-
getTemplatingEngine
public org.openapitools.codegen.api.TemplatingEngineAdapter getTemplatingEngine()- Specified by:
getTemplatingEnginein interfaceorg.openapitools.codegen.CodegenConfig
-
sanitizeName
Sanitize name (parameter, property, method, etc)- Parameters:
name- string to be sanitizeremoveCharRegEx- a regex containing all char that will be removed- Returns:
- sanitized string
-
sanitizeName
Sanitize name (parameter, property, method, etc)- Parameters:
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)- Returns:
- sanitized string
-
sanitizeTag
Sanitize tag- Specified by:
sanitizeTagin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
tag- Tag- Returns:
- Sanitized tag
-
setParameterBooleanFlagWithCodegenProperty
public void setParameterBooleanFlagWithCodegenProperty(org.openapitools.codegen.CodegenParameter parameter, org.openapitools.codegen.CodegenProperty property) Set CodegenParameter boolean flag using CodegenProperty. NOTE: This is deprecated and can be removed in 6.0.0 This logic has been folded into the original call sites and long term will be moved into IJsonSchemaValidationProperties.setTypeProperties and overrides like updateModelForObject- Parameters:
parameter- Codegen Parameterproperty- Codegen property
-
updateCodegenPropertyEnum
public void updateCodegenPropertyEnum(org.openapitools.codegen.CodegenProperty var) Update codegen property's enum by adding "enumVars" (with name and value)- Parameters:
var- list of CodegenProperty
-
getEnumDefaultValue
-
buildEnumVars
-
postProcessEnumVars
-
updateEnumVarsWithExtensions
-
addRegularExpressionDelimiter
If the pattern misses the delimiter, add "/" to the beginning and end Otherwise, return the original pattern- Parameters:
pattern- the pattern (regular expression)- Returns:
- the pattern with delimiter
-
convertPropertyToBooleanAndWriteBack
reads propertyKey from additionalProperties, converts it to a boolean and writes it back to additionalProperties to be usable as a boolean in mustache files.- Parameters:
propertyKey- property key- Returns:
- property value as boolean
-
convertPropertyToBooleanAndWriteBack
public boolean convertPropertyToBooleanAndWriteBack(String propertyKey, Consumer<Boolean> booleanSetter) reads propertyKey from additionalProperties, converts it to a boolean and writes it back to additionalProperties to be usable as a boolean in mustache files.- Parameters:
propertyKey- property keybooleanSetter- the setter function reference- Returns:
- property value as boolean or false if it does not exist
-
convertPropertyToStringAndWriteBack
public String convertPropertyToStringAndWriteBack(String propertyKey, Consumer<String> stringSetter) reads propertyKey from additionalProperties, converts it to a string and writes it back to additionalProperties to be usable as a string in mustache files.- Parameters:
propertyKey- property keystringSetter- the setter function reference- Returns:
- property value as String or null if not found
-
convertPropertyToTypeAndWriteBack
public <T> T convertPropertyToTypeAndWriteBack(String propertyKey, Function<String, T> converter, Consumer<T> genericTypeSetter) reads propertyKey from additionalProperties, converts it to T and writes it back to additionalProperties to be usable as T in mustache files.- Parameters:
propertyKey- property keygenericTypeSetter- the setter function reference- Returns:
- property value as instance of type T or null if not found
-
getIgnoreFilePathOverride
Provides an override location, if any is specified, for the .openapi-generator-ignore.This is originally intended for the first generation only.
- Specified by:
getIgnoreFilePathOverridein interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- a string of the full path to an override ignore file.
-
setIgnoreFilePathOverride
Sets an override location for the '.openapi-generator-ignore' location for the first code generation.- Specified by:
setIgnoreFilePathOverridein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
ignoreFileOverride- The full path to an ignore file
-
convertPropertyToBoolean
-
writePropertyBack
-
getContentType
-
getConsumesInfo
-
hasFormParameter
public boolean hasFormParameter(io.swagger.v3.oas.models.Operation operation) -
hasBodyParameter
public boolean hasBodyParameter(io.swagger.v3.oas.models.Operation operation) -
getProducesInfo
public 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- Parameters:
openAPI- current specification instanceoperation- Operation- Returns:
- a set of MIME types
-
getCollectionFormat
-
getTag
public org.openapitools.codegen.CodegenType getTag()- Specified by:
getTagin interfaceorg.openapitools.codegen.CodegenConfig
-
getName
- Specified by:
getNamein interfaceorg.openapitools.codegen.CodegenConfig
-
getHelp
- Specified by:
getHelpin interfaceorg.openapitools.codegen.CodegenConfig
-
fromRequestBodyToFormParameters
-
fromFormProperty
-
addBodyModelSchema
-
updateRequestBodyForMap
-
updateRequestBodyForPrimitiveType
-
updateRequestBodyForObject
-
updateRequestBodyForArray
-
updateRequestBodyForString
-
toMediaTypeSchemaName
-
getContent
protected LinkedHashMap<String,org.openapitools.codegen.CodegenMediaType> getContent(io.swagger.v3.oas.models.media.Content content, Set<String> imports, String mediaTypeSchemaSuffix) -
fromRequestBody
-
addRequiredVarsMap
protected void addRequiredVarsMap(io.swagger.v3.oas.models.media.Schema schema, org.openapitools.codegen.IJsonSchemaValidationProperties property) -
addVarsRequiredVarsAdditionalProps
protected void addVarsRequiredVarsAdditionalProps(io.swagger.v3.oas.models.media.Schema schema, org.openapitools.codegen.IJsonSchemaValidationProperties property) -
getItemsName
-
getAdditionalPropertiesName
-
addOption
-
addOption
-
updateOption
-
removeOption
-
addSwitch
-
generateJSONSpecFile
generates OpenAPI specification file in JSON format- Parameters:
objs- map of object
-
generateYAMLSpecFile
generates OpenAPI specification file in YAML format- Parameters:
objs- map of object
-
isDataTypeString
checks if the data should be classified as "string" in enum e.g. double in C# needs to be double-quoted (e.g. "2.8") by treating it as a string In the future, we may rename this function to "isEnumString"- Parameters:
dataType- data type- Returns:
- true if it's a enum string
-
fromServers
public List<org.openapitools.codegen.CodegenServer> fromServers(List<io.swagger.v3.oas.models.servers.Server> servers) - Specified by:
fromServersin interfaceorg.openapitools.codegen.CodegenConfig
-
fromServerVariables
public List<org.openapitools.codegen.CodegenServerVariable> fromServerVariables(Map<String, io.swagger.v3.oas.models.servers.ServerVariable> variables) - Specified by:
fromServerVariablesin interfaceorg.openapitools.codegen.CodegenConfig
-
setParameterNullable
protected void setParameterNullable(org.openapitools.codegen.CodegenParameter parameter, org.openapitools.codegen.CodegenProperty property) -
postProcessFile
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-file", "openapi-generator-ignore", "openapi-generator-version"TODO: store these values in enum instead
- Specified by:
postProcessFilein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
file- file to be processedfileType- file type
-
executePostProcessor
Executes an external command for file post processing.- Parameters:
commandArr- an array of commands and arguments. They will be concatenated with space and tokenized again.- Returns:
- Whether the execution passed (true) or failed (false)
-
isEnablePostProcessFile
public boolean isEnablePostProcessFile()Boolean value indicating the state of the option for post-processing file using environment variables.- Specified by:
isEnablePostProcessFilein interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- true if the option is enabled
-
setEnablePostProcessFile
public void setEnablePostProcessFile(boolean enablePostProcessFile) Set the boolean value indicating the state of the option for post-processing file using environment variables.- Specified by:
setEnablePostProcessFilein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
enablePostProcessFile- true to enable post-processing file
-
isEnableMinimalUpdate
public boolean isEnableMinimalUpdate()Get the boolean value indicating the state of the option for updating only changed files- Specified by:
isEnableMinimalUpdatein interfaceorg.openapitools.codegen.CodegenConfig
-
setEnableMinimalUpdate
public void setEnableMinimalUpdate(boolean enableMinimalUpdate) Set the boolean value indicating the state of the option for updating only changed files- Specified by:
setEnableMinimalUpdatein interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
enableMinimalUpdate- true to enable minimal update
-
isStrictSpecBehavior
public boolean isStrictSpecBehavior()Indicates whether the codegen configuration should treat documents as strictly defined by the OpenAPI specification.- Specified by:
isStrictSpecBehaviorin interfaceorg.openapitools.codegen.CodegenConfig- Returns:
- true to act strictly upon spec documents, potentially modifying the spec to strictly fit the spec.
-
setStrictSpecBehavior
public 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.- Specified by:
setStrictSpecBehaviorin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
strictSpecBehavior- true if we will behave strictly, false to allow specification documents which pass validation to be loosely interpreted against the spec.
-
getFeatureSet
public org.openapitools.codegen.meta.FeatureSet getFeatureSet()- Specified by:
getFeatureSetin interfaceorg.openapitools.codegen.CodegenConfig
-
isRemoveEnumValuePrefix
public boolean isRemoveEnumValuePrefix()Get the boolean value indicating whether to remove enum value prefixes- Specified by:
isRemoveEnumValuePrefixin interfaceorg.openapitools.codegen.CodegenConfig
-
setRemoveEnumValuePrefix
public void setRemoveEnumValuePrefix(boolean removeEnumValuePrefix) Set the boolean value indicating whether to remove enum value prefixes- Specified by:
setRemoveEnumValuePrefixin interfaceorg.openapitools.codegen.CodegenConfig- Parameters:
removeEnumValuePrefix- true to enable enum value prefix removal
-
addOneOfNameExtension
Add "x-one-of-name" extension to a given oneOf schema (assuming it has at least 1 oneOf elements)- Parameters:
schema- schema to add the extension toname- name of the parent oneOf schema
-
addOneOfInterfaceModel
Add a given ComposedSchema as an interface model to be generated, assuming it has `oneOf` defined- Parameters:
cs- ComposedSchema object to create as interface modeltype- name to use for the generated interface model
-
addImportsToOneOfInterface
-
modifyFeatureSet
protected void modifyFeatureSet(Consumer<org.openapitools.codegen.meta.FeatureSet.Builder> processor) -
isJsonMimeType
Check if the given MIME is a JSON MIME. JSON MIME examples: application/json application/json; charset=UTF8 APPLICATION/JSON- Parameters:
mime- MIME string- Returns:
- true if the input matches the JSON MIME
-
isXmlMimeType
-
isJsonVendorMimeType
Check if the given MIME is a JSON Vendor MIME. JSON MIME examples: application/vnd.mycompany+json application/vnd.mycompany.resourceA.version1+json- Parameters:
mime- MIME string- Returns:
- true if the input matches the JSON vendor MIME
-
getCollectionFormat
Builds OAPI 2.0 collectionFormat value based on style and explode values for theCodegenParameter.- Parameters:
codegenParameter- parameter- Returns:
- string for a collectionFormat.
-
defaultTemplatingEngine
- Specified by:
defaultTemplatingEnginein interfaceorg.openapitools.codegen.CodegenConfig
-
generatorLanguage
public org.openapitools.codegen.GeneratorLanguage generatorLanguage()- Specified by:
generatorLanguagein interfaceorg.openapitools.codegen.CodegenConfig
-
generatorLanguageVersion
- Specified by:
generatorLanguageVersionin interfaceorg.openapitools.codegen.CodegenConfig
-
getSupportedVendorExtensions
- Specified by:
getSupportedVendorExtensionsin interfaceorg.openapitools.codegen.CodegenConfig
-
getUseInlineModelResolver
public boolean getUseInlineModelResolver()- Specified by:
getUseInlineModelResolverin interfaceorg.openapitools.codegen.CodegenConfig
-
getUseOpenapiNormalizer
public boolean getUseOpenapiNormalizer()- Specified by:
getUseOpenapiNormalizerin interfaceorg.openapitools.codegen.CodegenConfig
-
getOpenapiGeneratorIgnoreList
- Specified by:
getOpenapiGeneratorIgnoreListin interfaceorg.openapitools.codegen.CodegenConfig
-
isTypeErasedGenerics
public boolean isTypeErasedGenerics()- Specified by:
isTypeErasedGenericsin interfaceorg.openapitools.codegen.CodegenConfig
-
handleSpecialCharacters
-
getSchemaFromBooleanOrSchema
Used to ensure that null or Schema is returned given an input Boolean/Schema/null This will be used in openapi 3.1.0 spec processing to ensure that Booleans become Schemas Because our generators only understand Schemas Note: use getIsBooleanSchemaTrue or getIsBooleanSchemaFalse on the IJsonSchemaValidationProperties if you need to be able to detect if the original schema's value was true or false- Parameters:
schema- the input Boolean or Schema data to convert to a Schema- Returns:
- Schema the input data converted to a Schema if possible
-
handleConstantParams
protected void handleConstantParams(org.openapitools.codegen.CodegenOperation operation) This method removes all constant Query, Header and Cookie Params from allParams and sets them as constantParams in the CodegenOperation. The definition of constant is single valued required enum params. The constantParams in the generated code should be hardcoded to the constantValue if autosetConstants feature is enabled.- Parameters:
operation- - operation to be processed
-
getModelNamePrefix
-
setModelNamePrefix
-
getApiNamePrefix
-
setApiNamePrefix
-
getModelNameSuffix
-
setModelNameSuffix
-
getApiNameSuffix
-
setApiNameSuffix
-
setModelPackage
-
setApiPackage
-
setFilesMetadataFilename
-
setVersionMetadataFilename
-
getRemoveOperationIdPrefixDelimiter
-
setRemoveOperationIdPrefixDelimiter
-
getRemoveOperationIdPrefixCount
public int getRemoveOperationIdPrefixCount() -
setRemoveOperationIdPrefixCount
public void setRemoveOperationIdPrefixCount(int removeOperationIdPrefixCount) -
getSortModelPropertiesByRequiredFlag
-
setSortModelPropertiesByRequiredFlag
-
getEnsureUniqueParams
-
setEnsureUniqueParams
-
getAllowUnicodeIdentifiers
-
setAllowUnicodeIdentifiers
-
getPrependFormOrBodyParameters
-
setPrependFormOrBodyParameters
-
setLegacyDiscriminatorBehavior
public void setLegacyDiscriminatorBehavior(boolean legacyDiscriminatorBehavior) -
setDisallowAdditionalPropertiesIfNotPresent
public void setDisallowAdditionalPropertiesIfNotPresent(boolean disallowAdditionalPropertiesIfNotPresent) -
setEnumUnknownDefaultCase
public void setEnumUnknownDefaultCase(boolean enumUnknownDefaultCase) -
setAutosetConstants
public void setAutosetConstants(boolean autosetConstants) -
getSortParamsByRequiredFlag
-
setSortParamsByRequiredFlag
-
isArrayDefaultToEmpty
public boolean isArrayDefaultToEmpty() -
setArrayDefaultToEmpty
public void setArrayDefaultToEmpty(boolean arrayDefaultToEmpty) -
isArrayNullableDefaultToEmpty
public boolean isArrayNullableDefaultToEmpty() -
setArrayNullableDefaultToEmpty
public void setArrayNullableDefaultToEmpty(boolean arrayNullableDefaultToEmpty) -
isArrayOptionalNullableDefaultToEmpty
public boolean isArrayOptionalNullableDefaultToEmpty() -
setArrayOptionalNullableDefaultToEmpty
public void setArrayOptionalNullableDefaultToEmpty(boolean arrayOptionalNullableDefaultToEmpty) -
isArrayOptionalDefaultToEmpty
public boolean isArrayOptionalDefaultToEmpty() -
setArrayOptionalDefaultToEmpty
public void setArrayOptionalDefaultToEmpty(boolean arrayOptionalDefaultToEmpty) -
isMapDefaultToEmpty
public boolean isMapDefaultToEmpty() -
setMapDefaultToEmpty
public void setMapDefaultToEmpty(boolean mapDefaultToEmpty) -
isMapNullableDefaultToEmpty
public boolean isMapNullableDefaultToEmpty() -
setMapNullableDefaultToEmpty
public void setMapNullableDefaultToEmpty(boolean mapNullableDefaultToEmpty) -
isMapOptionalNullableDefaultToEmpty
public boolean isMapOptionalNullableDefaultToEmpty() -
setMapOptionalNullableDefaultToEmpty
public void setMapOptionalNullableDefaultToEmpty(boolean mapOptionalNullableDefaultToEmpty) -
isMapOptionalDefaultToEmpty
public boolean isMapOptionalDefaultToEmpty() -
setMapOptionalDefaultToEmpty
public void setMapOptionalDefaultToEmpty(boolean mapOptionalDefaultToEmpty) -
isDefaultToEmptyContainer
public boolean isDefaultToEmptyContainer() -
setDefaultToEmptyContainer
public void setDefaultToEmptyContainer(boolean defaultToEmptyContainer)
-