Class GenerateTask
-
- All Implemented Interfaces:
-
kotlin.Comparable,org.gradle.api.Named,org.gradle.api.Task,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.TaskInternal,org.gradle.api.plugins.ExtensionAware,org.gradle.util.Configurable
@CacheableTask() public abstract class GenerateTask extends DefaultTaskA task which generates the desired code.
Example (CLI):
./gradlew -q openApiGenerate --input=/path/to/file
Jim Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private final WorkerExecutorworkerExecutorprivate final FileSystemOperationsfsprivate final ProjectLayoutlayoutprivate final Property<String>workerIsolationprivate final Property<String>maxWorkerHeapSizeprivate final Property<Boolean>verboseprivate final Property<Boolean>quietprivate final Property<Boolean>validateSpecprivate final Property<String>generatorNameprivate final DirectoryPropertyschemaLocationprivate final DirectoryPropertyoutputDirprivate final RegularFilePropertyinputSpecprivate final DirectoryPropertyinputSpecRootDirectoryprivate final ConfigurableFileCollectioninputSpecFilesprivate final List<String>inputSpecFilesOrderprivate final DirectoryPropertymergedFileOutputDirprivate final Property<Boolean>inputSpecRootDirectorySkipMergeprivate final Property<String>mergedFileNameprivate final Property<String>mergeModeprivate final Property<String>mergeConflictStrategyprivate final Property<String>remoteInputSpecprivate final DirectoryPropertytemplateDirprivate final Property<String>templateResourcePathprivate final Property<String>authprivate final MapProperty<String, String>globalPropertiesprivate final RegularFilePropertyconfigFileprivate final Property<Boolean>skipOverwriteprivate final Property<String>packageNameprivate final Property<String>apiPackageprivate final Property<String>modelPackageprivate final Property<String>modelNamePrefixprivate final Property<String>modelNameSuffixprivate final Property<String>apiNameSuffixprivate final MapProperty<String, String>instantiationTypesprivate final MapProperty<String, String>typeMappingsprivate final MapProperty<String, Object>additionalPropertiesprivate final MapProperty<String, String>serverVariablesprivate final ListProperty<String>languageSpecificPrimitivesprivate final ListProperty<String>openapiGeneratorIgnoreListprivate final MapProperty<String, String>importMappingsprivate final MapProperty<String, String>schemaMappingsprivate final ListProperty<String>forcedGenerateSchemasprivate final MapProperty<String, String>inlineSchemaNameMappingsprivate final MapProperty<String, String>inlineSchemaOptionsprivate final MapProperty<String, String>nameMappingsprivate final MapProperty<String, String>parameterNameMappingsprivate final MapProperty<String, String>modelNameMappingsprivate final MapProperty<String, String>enumNameMappingsprivate final MapProperty<String, String>operationIdNameMappingsprivate final MapProperty<String, String>openapiNormalizerprivate final Property<String>invokerPackageprivate final Property<String>groupIdprivate final Property<String>idprivate final Property<String>versionprivate final Property<String>libraryprivate final Property<String>gitHostprivate final Property<String>gitUserIdprivate final Property<String>gitRepoIdprivate final Property<String>releaseNoteprivate final Property<String>httpUserAgentprivate final MapProperty<String, String>reservedWordsMappingsprivate final RegularFilePropertyignoreFileOverrideprivate final Property<Boolean>removeOperationIdPrefixprivate final Property<Boolean>skipOperationExampleprivate final ListProperty<String>apiFilesConstrainedToprivate final ListProperty<String>modelFilesConstrainedToprivate final ListProperty<String>supportingFilesConstrainedToprivate final Property<Boolean>generateModelTestsprivate final Property<Boolean>generateModelDocumentationprivate final Property<Boolean>generateApiTestsprivate final Property<Boolean>generateApiDocumentationprivate final Property<Boolean>logToStderrprivate final Property<Boolean>enablePostProcessFileprivate final Property<Boolean>skipValidateSpecprivate final Property<Boolean>generateAliasAsModelprivate final MapProperty<String, String>configOptionsprivate final Property<String>engineprivate final Property<Boolean>cleanupOutputprivate final Property<Boolean>dryRunprivate final Property<Boolean>strictSpecprivate final Property<Boolean>minimalUpdateprivate final Property<Boolean>generateRecursiveDependentModelsprivate final Property<String>mergedFileInfoNameprivate final Property<String>mergedFileInfoDescriptionprivate final Property<String>mergedFileInfoVersionprivate final StringeffectiveMergedSpecInfoprivate final TaskOutputsInternaloutputsprivate final Spec<in TaskInternal>onlyIfprivate final Property<Duration>timeoutprivate final TaskRequiredServicesrequiredServicesprivate final TaskDependencyInternaltaskDependenciesprivate final Set<Object>dependsOnprivate final TaskDestroyablesdestroyablesprivate final Loggerloggerprivate final Stringpathprivate final Factory<File>temporaryDirFactoryprivate final Optional<String>reasonTaskIsIncompatibleWithConfigurationCacheprivate final TaskLocalStatelocalStateprivate final List<InputChangesAwareTaskAction>taskActionsprivate final TaskDependencyInternallifecycleDependenciesprivate BooleanisEnabledprivate BooleanimpliesSubProjectsprivate final TaskInputsInternalinputsprivate final Conventionconventionprivate Booleanenabledprivate final TaskStateInternalstateprivate final TaskIdentity<?>taskIdentityprivate final TaskDependencyshouldRunAfterprivate final ExtensionContainerextensionsprivate final BooleanisCompatibleWithConfigurationCacheprivate final TaskDependencyfinalizedByprivate final AntBuilderantprivate final DynamicObjectasDynamicObjectprivate final List<ResourceLock>sharedResourcesprivate BooleandidWorkprivate final Optional<String>reasonNotToTrackStateprivate Stringgroupprivate final BooleanisHasCustomActionsprivate List<Action<in Task>>actionsprivate final Stringnameprivate final FiletemporaryDirprivate final LoggingManagerloggingprivate final PathidentityPathprivate final TaskDependencymustRunAfterprivate final StandardOutputCapturestandardOutputCaptureprivate final Projectprojectprivate Stringdescription
-
Constructor Summary
Constructors Constructor Description GenerateTask()
-
Method Summary
Modifier and Type Method Description abstract WorkerExecutorgetWorkerExecutor()abstract FileSystemOperationsgetFs()abstract ProjectLayoutgetLayout()abstract Property<String>getWorkerIsolation()Controls how the code generation worker is isolated from the Gradle daemon. abstract Property<String>getMaxWorkerHeapSize()Maximum heap size for the worker process when workerIsolation is "process" (e.g. abstract Property<Boolean>getVerbose()The verbosity of generation abstract Property<Boolean>getQuiet()Whether generation should run in quiet mode. abstract Property<Boolean>getValidateSpec()Whether an input specification should be validated upon generation. abstract Property<String>getGeneratorName()The name of the generator which will handle codegen. abstract DirectoryPropertygetSchemaLocation()Optional directory containing additional schema files referenced via $refin the input specification.abstract DirectoryPropertygetOutputDir()The output target directory into which code will be generated. abstract RegularFilePropertygetInputSpec()The Open API 2.0/3.x specification location. abstract DirectoryPropertygetInputSpecRootDirectory()Local root folder with spec files. final ConfigurableFileCollectiongetInputSpecFiles()An explicit collection of spec files to merge, in the order they are declared. final List<String>getInputSpecFilesOrder()The declared order of inputSpecFiles, tracked as an explicit task input. abstract DirectoryPropertygetMergedFileOutputDir()Directory where the merged spec file is written when inputSpecFiles is used. abstract Property<Boolean>getInputSpecRootDirectorySkipMerge()Skip bundling all spec files into a merged spec file, if true. abstract Property<String>getMergedFileName()Name of the file that will contain all merged specs. abstract Property<String>getMergeMode()How multiple spec files are merged. abstract Property<String>getMergeConflictStrategy()Strategy when two specs define the same component name or path+method with conflicting definitions. abstract Property<String>getRemoteInputSpec()The remote Open API 2.0/3.x specification URL location. abstract DirectoryPropertygetTemplateDir()The template directory holding a custom template. abstract Property<String>getTemplateResourcePath()A classpath resource path (or file-system directory path) holding custom Mustache templates. abstract Property<String>getAuth()Adds authorization headers when fetching the OpenAPI definitions remotely. abstract MapProperty<String, String>getGlobalProperties()Sets specified global properties. abstract RegularFilePropertygetConfigFile()Path to json configuration file. abstract Property<Boolean>getSkipOverwrite()Specifies if the existing files should be overwritten during the generation. abstract Property<String>getPackageName()Package for generated classes (where supported) abstract Property<String>getApiPackage()Package for generated api classes abstract Property<String>getModelPackage()Package for generated models abstract Property<String>getModelNamePrefix()Prefix that will be prepended to all model names. abstract Property<String>getModelNameSuffix()Suffix that will be appended to all model names. abstract Property<String>getApiNameSuffix()Suffix that will be appended to all api names. abstract MapProperty<String, String>getInstantiationTypes()Sets instantiation type mappings. abstract MapProperty<String, String>getTypeMappings()Sets mappings between OpenAPI spec types and generated code types. abstract MapProperty<String, Object>getAdditionalProperties()Sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value. abstract MapProperty<String, String>getServerVariables()Sets server variable for server URL template substitution, in the format of name=value,name=value. abstract ListProperty<String>getLanguageSpecificPrimitives()Specifies additional language specific primitive types in the format of type1,type2,type3,type3. abstract ListProperty<String>getOpenapiGeneratorIgnoreList()Specifies .openapi-generator-ignore list in the form of relative/path/to/file1,relative/path/to/file2. abstract MapProperty<String, String>getImportMappings()Specifies mappings between a given class and the import that should be used for that class. abstract MapProperty<String, String>getSchemaMappings()Specifies mappings between a given schema and the new one. abstract ListProperty<String>getForcedGenerateSchemas()Specifies schema names that must be generated even when listed in schemaMappings or importMappings. abstract MapProperty<String, String>getInlineSchemaNameMappings()Specifies mappings between the inline scheme name and the new name abstract MapProperty<String, String>getInlineSchemaOptions()Key/value options controlling how inline schemas are handled during generation. abstract MapProperty<String, String>getNameMappings()Specifies mappings between the property name and the new name abstract MapProperty<String, String>getParameterNameMappings()Specifies mappings between the parameter name and the new name abstract MapProperty<String, String>getModelNameMappings()Specifies mappings between the model name and the new name abstract MapProperty<String, String>getEnumNameMappings()Specifies mappings between the enum name and the new name abstract MapProperty<String, String>getOperationIdNameMappings()Specifies mappings between the operation id name and the new name abstract MapProperty<String, String>getOpenapiNormalizer()Key/value rules passed to the OpenAPI normalizer, which pre-processes the parsed spec before code generation begins. abstract Property<String>getInvokerPackage()Root package for generated code. abstract Property<String>getGroupId()GroupId in generated pom.xml/build.gradle.kts or other build script. abstract Property<String>getId()ArtifactId in generated pom.xml/build.gradle.kts or other build script. abstract Property<String>getVersion()Artifact version in generated pom.xml/build.gradle.kts or other build script. abstract Property<String>getLibrary()Reference the library template (sub-template) of a generator. abstract Property<String>getGitHost()Git host, e.g. abstract Property<String>getGitUserId()Git user ID, e.g. abstract Property<String>getGitRepoId()Git repo ID, e.g. abstract Property<String>getReleaseNote()Release note, default to 'Minor update'. abstract Property<String>getHttpUserAgent()HTTP user agent, e.g. abstract MapProperty<String, String>getReservedWordsMappings()Specifies how a reserved name should be escaped to. abstract RegularFilePropertygetIgnoreFileOverride()Specifies an override location for the .openapi-generator-ignore file. abstract Property<Boolean>getRemoveOperationIdPrefix()Remove prefix of operationId, e.g. abstract Property<Boolean>getSkipOperationExample()Skip examples defined in the operation abstract ListProperty<String>getApiFilesConstrainedTo()Defines which API-related files should be generated. abstract ListProperty<String>getModelFilesConstrainedTo()Defines which model-related files should be generated. abstract ListProperty<String>getSupportingFilesConstrainedTo()Defines which supporting files should be generated. abstract Property<Boolean>getGenerateModelTests()Defines whether model-related test files should be generated. abstract Property<Boolean>getGenerateModelDocumentation()Defines whether model-related documentation files should be generated. abstract Property<Boolean>getGenerateApiTests()Defines whether api-related test files should be generated. abstract Property<Boolean>getGenerateApiDocumentation()Defines whether api-related documentation files should be generated. abstract Property<Boolean>getLogToStderr()To write all log messages (not just errors) to STDERR abstract Property<Boolean>getEnablePostProcessFile()To enable the file post-processing hook. abstract Property<Boolean>getSkipValidateSpec()To skip spec validation. abstract Property<Boolean>getGenerateAliasAsModel()To generate alias (array, list, map) as model. abstract MapProperty<String, String>getConfigOptions()A dynamic map of options specific to a generator. abstract Property<String>getEngine()Templating engine: "mustache" (default) or "handlebars" (beta) abstract Property<Boolean>getCleanupOutput()Defines whether the output dir should be cleaned up before generating the output. abstract Property<Boolean>getDryRun()Defines whether the generator should run in dry-run mode. abstract Property<Boolean>getStrictSpec()When true, applies strict validation against the OpenAPI specification, failing on any deviation.abstract Property<Boolean>getMinimalUpdate()When true, only writes output files that have changed relative to an existing generated output.abstract Property<Boolean>getGenerateRecursiveDependentModels()When true, recursively generates all models that the selected models depend on, even if those dependent models were not explicitly listed for generation.abstract Property<String>getMergedFileInfoName()Title placed in the info.titlefield of the merged spec.abstract Property<String>getMergedFileInfoDescription()Description placed in the info.descriptionfield of the merged spec.abstract Property<String>getMergedFileInfoVersion()Version placed in the info.versionfield of the merged spec.final StringgetEffectiveMergedSpecInfo()Combines mergedFileInfoName, mergedFileInfoDescription, and mergedFileInfoVersion into a single fingerprint value that is only visible to Gradle's up-to-date/caching logic when merge mode is actually active (i.e. final UnitsetInput(String value)final UnitdoWork()final Unitset(RegularFileProperty $self, String path)Extension function to allow setting file properties with a String path in Kotlin DSL. final Unitset(DirectoryProperty $self, String path)Extension function to allow setting directory properties with a String path in Kotlin DSL. final UnitsetInputSpecAsString(String path)Groovy-compatible setter for inputSpec property. final UnitsetConfigFileAsString(String path)Groovy-compatible setter for configFile property. final UnitsetIgnoreFileOverrideAsString(String path)Groovy-compatible setter for ignoreFileOverride property. final UnitsetTemplateDirAsString(String path)Groovy-compatible setter for templateDir property. final UnitsetOutputDirAsString(String path)Groovy-compatible setter for outputDir property. final UnitsetInputSpecRootDirectoryAsString(String path)Groovy-compatible setter for inputSpecRootDirectory property. final UnitsetSchemaLocationAsString(String path)Groovy-compatible setter for schemaLocation property. -
Methods inherited from class org.gradle.api.DefaultTask
getActions, getAnt, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, setActions, setDescription, setDidWork, setEnabled, setEnabled, setGroup -
Methods inherited from class org.gradle.api.internal.AbstractTask
getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, setImpliesSubProjects -
Methods inherited from class org.gradle.api.Task
configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, doNotTrackState, finalizedBy, getConvention, hasProperty, mustRunAfter, notCompatibleWithConfigurationCache, onlyIf, onlyIf, onlyIf, property, setDependsOn, setFinalizedBy, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService -
Methods inherited from class kotlin.Comparable
compareTo -
Methods inherited from class org.gradle.api.internal.TaskInternal
acceptServiceReferences, appendParallelSafeAction, hasTaskActions, prependParallelSafeAction -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getWorkerExecutor
@Inject() abstract WorkerExecutor getWorkerExecutor()
-
getFs
@Inject() abstract FileSystemOperations getFs()
-
getLayout
@Inject() abstract ProjectLayout getLayout()
-
getWorkerIsolation
@Optional()@Input() abstract Property<String> getWorkerIsolation()
Controls how the code generation worker is isolated from the Gradle daemon.
"process" (default): runs in a separate JVM process. Metaspace is fully isolated from the daemon and freed after the process exits. Gradle reuses the worker process across tasks that share the same classpath, so the JVM startup cost is paid at most once per parallel slot — not once per task. Best for projects with many generation tasks.
"classloader": runs inside the Gradle daemon JVM using a separate ClassLoader. No process startup overhead, but each task loads generator classes into the daemon's Metaspace. With many tasks this can exhaust Metaspace. Suitable for projects with very few tasks where the daemon memory budget is not a concern.
-
getMaxWorkerHeapSize
@Optional()@Input() abstract Property<String> getMaxWorkerHeapSize()
Maximum heap size for the worker process when workerIsolation is "process" (e.g. "512m", "1g"). Has no effect when workerIsolation is "classloader". When not set, the JVM uses ergonomic defaults (typically based on available system memory). Only set this if you hit OutOfMemoryError during generation of unusually large specs.
-
getVerbose
@Optional()@Input() abstract Property<Boolean> getVerbose()
The verbosity of generation
-
getQuiet
@Optional()@Input() abstract Property<Boolean> getQuiet()
Whether generation should run in quiet mode.
-
getValidateSpec
@Optional()@Input() abstract Property<Boolean> getValidateSpec()
Whether an input specification should be validated upon generation.
-
getGeneratorName
@Optional()@Input() abstract Property<String> getGeneratorName()
The name of the generator which will handle codegen. (see "openApiGenerators" task)
-
getSchemaLocation
@Optional()@InputDirectory()@PathSensitive(value = PathSensitivity.ABSOLUTE) abstract DirectoryProperty getSchemaLocation()
Optional directory containing additional schema files referenced via
$refin the input specification.Declaring this directory tells Gradle to track all files inside it for up-to-date checks. Without it, changes to
$ref-referenced schemas will not trigger re-generation because Gradle only watches inputSpec by default.
-
getOutputDir
@Optional()@OutputDirectory() abstract DirectoryProperty getOutputDir()
The output target directory into which code will be generated.
-
getInputSpec
@Optional()@InputFile()@PathSensitive(value = PathSensitivity.RELATIVE) abstract RegularFileProperty getInputSpec()
The Open API 2.0/3.x specification location.
Be default, Gradle will treat the openApiGenerate task as up-to-date based only on this file, regardless of changes to any $ref referenced files. Use the
inputSpecRootDirectoryproperty to have Gradle track changes to an entire directory of spec files.
-
getInputSpecRootDirectory
@Optional()@InputDirectory()@PathSensitive(value = PathSensitivity.RELATIVE) abstract DirectoryProperty getInputSpecRootDirectory()
Local root folder with spec files.
By default, a merged spec file will be generated based on the contents of the directory. To disable this, set the
inputSpecRootDirectorySkipMergeproperty.
-
getInputSpecFiles
@InputFiles()@Optional()@PathSensitive(value = PathSensitivity.RELATIVE) final ConfigurableFileCollection getInputSpecFiles()
An explicit collection of spec files to merge, in the order they are declared.
When set, the generator merges exactly these files rather than scanning a directory. Use with mergeMode and mergeConflictStrategy. The merged output is written to mergedFileOutputDir.
Takes precedence over inputSpecRootDirectory if both are set.
-
getInputSpecFilesOrder
@Input()@Optional() final List<String> getInputSpecFilesOrder()
The declared order of inputSpecFiles, tracked as an explicit task input.
inputSpecFiles is an InputFiles collection, whose up-to-date checks are order-insensitive. Because the merge honors a first-wins/conflict contract that depends on file ordering, this derived ordered list is exposed as an Input so that reordering the declared files invalidates the task and forces a fresh merge instead of reusing a stale merged spec.
-
getMergedFileOutputDir
@OutputDirectory()@Optional() abstract DirectoryProperty getMergedFileOutputDir()
Directory where the merged spec file is written when inputSpecFiles is used. Must be set when inputSpecFiles is non-empty.
-
getInputSpecRootDirectorySkipMerge
@Input()@Optional() abstract Property<Boolean> getInputSpecRootDirectorySkipMerge()
Skip bundling all spec files into a merged spec file, if true. Defaults to
false.
-
getMergedFileName
@Input()@Optional() abstract Property<String> getMergedFileName()
Name of the file that will contain all merged specs. Defaults to
"merged".
-
getMergeMode
@Input()@Optional() abstract Property<String> getMergeMode()
How multiple spec files are merged. Accepted values: "REF" (default, original $ref-based shallow merge, backward-compatible) or "DEEP" (full inline merge with component deduplication and conflict detection).
-
getMergeConflictStrategy
@Input()@Optional() abstract Property<String> getMergeConflictStrategy()
Strategy when two specs define the same component name or path+method with conflicting definitions. Accepted values: "WARN" (default) or "FAIL". Only applies when mergeMode is "DEEP".
-
getRemoteInputSpec
@Input()@Optional() abstract Property<String> getRemoteInputSpec()
The remote Open API 2.0/3.x specification URL location.
-
getTemplateDir
@Optional()@InputDirectory()@PathSensitive(value = PathSensitivity.RELATIVE) abstract DirectoryProperty getTemplateDir()
The template directory holding a custom template.
-
getTemplateResourcePath
@Optional()@Input() abstract Property<String> getTemplateResourcePath()
A classpath resource path (or file-system directory path) holding custom Mustache templates.
Takes precedence over templateDir when both are configured. Use this when templates are packaged inside a JAR on the classpath rather than as loose files on disk.
-
getAuth
@Optional()@Input() abstract Property<String> getAuth()
Adds authorization headers when fetching the OpenAPI definitions remotely. Pass in a URL-encoded string of name:header with a comma separating multiple values
-
getGlobalProperties
@Optional()@Input() abstract MapProperty<String, String> getGlobalProperties()
Sets specified global properties.
-
getConfigFile
@Optional()@InputFile()@PathSensitive(value = PathSensitivity.RELATIVE) abstract RegularFileProperty getConfigFile()
Path to json configuration file. File content should be in a json format { "optionKey":"optionValue", "optionKey1":"optionValue1"...} Supported options can be different for each language. Run config-help -g {generator name} command for language specific config options.
-
getSkipOverwrite
@Optional()@Input() abstract Property<Boolean> getSkipOverwrite()
Specifies if the existing files should be overwritten during the generation.
-
getPackageName
@Optional()@Input() abstract Property<String> getPackageName()
Package for generated classes (where supported)
-
getApiPackage
@Optional()@Input() abstract Property<String> getApiPackage()
Package for generated api classes
-
getModelPackage
@Optional()@Input() abstract Property<String> getModelPackage()
Package for generated models
-
getModelNamePrefix
@Optional()@Input() abstract Property<String> getModelNamePrefix()
Prefix that will be prepended to all model names. Default is the empty string.
-
getModelNameSuffix
@Optional()@Input() abstract Property<String> getModelNameSuffix()
Suffix that will be appended to all model names. Default is the empty string.
-
getApiNameSuffix
@Optional()@Input() abstract Property<String> getApiNameSuffix()
Suffix that will be appended to all api names. Default is the empty string.
-
getInstantiationTypes
@Optional()@Input() abstract MapProperty<String, String> getInstantiationTypes()
Sets instantiation type mappings.
-
getTypeMappings
@Optional()@Input() abstract MapProperty<String, String> getTypeMappings()
Sets mappings between OpenAPI spec types and generated code types.
-
getAdditionalProperties
@Optional()@Input() abstract MapProperty<String, Object> getAdditionalProperties()
Sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value. You can also have multiple occurrences of this option.
-
getServerVariables
@Optional()@Input() abstract MapProperty<String, String> getServerVariables()
Sets server variable for server URL template substitution, in the format of name=value,name=value. You can also have multiple occurrences of this option.
-
getLanguageSpecificPrimitives
@Optional()@Input() abstract ListProperty<String> getLanguageSpecificPrimitives()
Specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: String,boolean,Boolean,Double.
-
getOpenapiGeneratorIgnoreList
@Optional()@Input() abstract ListProperty<String> getOpenapiGeneratorIgnoreList()
Specifies .openapi-generator-ignore list in the form of relative/path/to/file1,relative/path/to/file2. For example: README.md,pom.xml.
-
getImportMappings
@Optional()@Input() abstract MapProperty<String, String> getImportMappings()
Specifies mappings between a given class and the import that should be used for that class.
-
getSchemaMappings
@Optional()@Input() abstract MapProperty<String, String> getSchemaMappings()
Specifies mappings between a given schema and the new one.
-
getForcedGenerateSchemas
@Optional()@Input() abstract ListProperty<String> getForcedGenerateSchemas()
Specifies schema names that must be generated even when listed in schemaMappings or importMappings.
-
getInlineSchemaNameMappings
@Optional()@Input() abstract MapProperty<String, String> getInlineSchemaNameMappings()
Specifies mappings between the inline scheme name and the new name
-
getInlineSchemaOptions
@Optional()@Input() abstract MapProperty<String, String> getInlineSchemaOptions()
Key/value options controlling how inline schemas are handled during generation.
Common keys:
RESOLVE_INLINE_ENUMS(promote inline enums to top-level models),ARRAY_ITEMS_SUFFIX,MAP_ITEMS_SUFFIX. Runconfig-help -g {generatorName}for the full list of supported options.
-
getNameMappings
@Optional()@Input() abstract MapProperty<String, String> getNameMappings()
Specifies mappings between the property name and the new name
-
getParameterNameMappings
@Optional()@Input() abstract MapProperty<String, String> getParameterNameMappings()
Specifies mappings between the parameter name and the new name
-
getModelNameMappings
@Optional()@Input() abstract MapProperty<String, String> getModelNameMappings()
Specifies mappings between the model name and the new name
-
getEnumNameMappings
@Optional()@Input() abstract MapProperty<String, String> getEnumNameMappings()
Specifies mappings between the enum name and the new name
-
getOperationIdNameMappings
@Optional()@Input() abstract MapProperty<String, String> getOperationIdNameMappings()
Specifies mappings between the operation id name and the new name
-
getOpenapiNormalizer
@Optional()@Input() abstract MapProperty<String, String> getOpenapiNormalizer()
Key/value rules passed to the OpenAPI normalizer, which pre-processes the parsed spec before code generation begins.
Example rules:
REFACTOR_ALLOF_WITH_PROPERTIES_ONLY=true,REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY=true. See the OpenAPI Generator docs for the full list of normalizer rules.
-
getInvokerPackage
@Optional()@Input() abstract Property<String> getInvokerPackage()
Root package for generated code.
-
getGroupId
@Optional()@Input() abstract Property<String> getGroupId()
GroupId in generated pom.xml/build.gradle.kts or other build script. Language-specific conversions occur in non-jvm generators.
-
getId
@Optional()@Input() abstract Property<String> getId()
ArtifactId in generated pom.xml/build.gradle.kts or other build script. Language-specific conversions occur in non-jvm generators.
-
getVersion
@Optional()@Input() abstract Property<String> getVersion()
Artifact version in generated pom.xml/build.gradle.kts or other build script. Language-specific conversions occur in non-jvm generators.
-
getLibrary
@Optional()@Input() abstract Property<String> getLibrary()
Reference the library template (sub-template) of a generator.
-
getGitHost
@Optional()@Input() abstract Property<String> getGitHost()
Git host, e.g. gitlab.com.
-
getGitUserId
@Optional()@Input() abstract Property<String> getGitUserId()
Git user ID, e.g. openapitools.
-
getGitRepoId
@Optional()@Input() abstract Property<String> getGitRepoId()
Git repo ID, e.g. openapi-generator.
-
getReleaseNote
@Optional()@Input() abstract Property<String> getReleaseNote()
Release note, default to 'Minor update'.
-
getHttpUserAgent
@Optional()@Input() abstract Property<String> getHttpUserAgent()
HTTP user agent, e.g. codegen_csharp_api_client, default to 'OpenAPI-Generator/{packageVersion}/{language}'
-
getReservedWordsMappings
@Optional()@Input() abstract MapProperty<String, String> getReservedWordsMappings()
Specifies how a reserved name should be escaped to.
-
getIgnoreFileOverride
@Optional()@InputFile()@PathSensitive(value = PathSensitivity.RELATIVE) abstract RegularFileProperty getIgnoreFileOverride()
Specifies an override location for the .openapi-generator-ignore file. Most useful on initial generation.
-
getRemoveOperationIdPrefix
@Optional()@Input() abstract Property<Boolean> getRemoveOperationIdPrefix()
Remove prefix of operationId, e.g. config_getId => getId
-
getSkipOperationExample
@Optional()@Input() abstract Property<Boolean> getSkipOperationExample()
Skip examples defined in the operation
-
getApiFilesConstrainedTo
@Optional()@Input() abstract ListProperty<String> getApiFilesConstrainedTo()
Defines which API-related files should be generated. This allows you to create a subset of generated files (or none at all).
This option enables/disables generation of ALL api-related files.
NOTE: Configuring any one of apiFilesConstrainedTo, modelFilesConstrainedTo, or supportingFilesConstrainedTo results in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation. For more control over generation of individual files, configure an ignore file and refer to it via ignoreFileOverride.
-
getModelFilesConstrainedTo
@Optional()@Input() abstract ListProperty<String> getModelFilesConstrainedTo()
Defines which model-related files should be generated. This allows you to create a subset of generated files (or none at all).
NOTE: Configuring any one of apiFilesConstrainedTo, modelFilesConstrainedTo, or supportingFilesConstrainedTo results in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation. For more control over generation of individual files, configure an ignore file and refer to it via ignoreFileOverride.
-
getSupportingFilesConstrainedTo
@Optional()@Input() abstract ListProperty<String> getSupportingFilesConstrainedTo()
Defines which supporting files should be generated. This allows you to create a subset of generated files (or none at all).
Supporting files are those related to
projects/frameworkswhich may be modified by consumers.NOTE: Configuring any one of apiFilesConstrainedTo, modelFilesConstrainedTo, or supportingFilesConstrainedTo results in others being disabled. That is, OpenAPI Generator considers any one of these to define a subset of generation. For more control over generation of individual files, configure an ignore file and refer to it via ignoreFileOverride.
-
getGenerateModelTests
@Optional()@Input() abstract Property<Boolean> getGenerateModelTests()
Defines whether model-related test files should be generated.
This option enables/disables generation of ALL model-related test files.
For more control over generation of individual files, configure an ignore file and refer to it via ignoreFileOverride.
-
getGenerateModelDocumentation
@Optional()@Input() abstract Property<Boolean> getGenerateModelDocumentation()
Defines whether model-related documentation files should be generated.
This option enables/disables generation of ALL model-related documentation files.
For more control over generation of individual files, configure an ignore file and refer to it via ignoreFileOverride.
-
getGenerateApiTests
@Optional()@Input() abstract Property<Boolean> getGenerateApiTests()
Defines whether api-related test files should be generated.
This option enables/disables generation of ALL api-related test files.
For more control over generation of individual files, configure an ignore file and refer to it via ignoreFileOverride.
-
getGenerateApiDocumentation
@Optional()@Input() abstract Property<Boolean> getGenerateApiDocumentation()
Defines whether api-related documentation files should be generated.
This option enables/disables generation of ALL api-related documentation files.
For more control over generation of individual files, configure an ignore file and refer to it via ignoreFileOverride.
-
getLogToStderr
@Optional()@Input() abstract Property<Boolean> getLogToStderr()
To write all log messages (not just errors) to STDERR
-
getEnablePostProcessFile
@Optional()@Input() abstract Property<Boolean> getEnablePostProcessFile()
To enable the file post-processing hook. This enables executing an external post-processor (usually a linter program). This only enables the post-processor. To define the post-processing command, define an environment variable such as LANG_POST_PROCESS_FILE (e.g. GO_POST_PROCESS_FILE, SCALA_POST_PROCESS_FILE). Please open an issue if your target generator does not support this functionality.
-
getSkipValidateSpec
@Optional()@Input() abstract Property<Boolean> getSkipValidateSpec()
To skip spec validation. When true, we will skip the default behavior of validating a spec before generation.
-
getGenerateAliasAsModel
@Optional()@Input() abstract Property<Boolean> getGenerateAliasAsModel()
To generate alias (array, list, map) as model. When false, top-level objects defined as array, list, or map will result in those definitions generated as top-level Array-of-items, List-of-items, Map-of-items definitions. When true, A model representation either containing or extending the array,list,map (depending on specific generator implementation) will be generated.
-
getConfigOptions
@Optional()@Input() abstract MapProperty<String, String> getConfigOptions()
A dynamic map of options specific to a generator.
-
getEngine
@Optional()@Input() abstract Property<String> getEngine()
Templating engine: "mustache" (default) or "handlebars" (beta)
-
getCleanupOutput
@Optional()@Input() abstract Property<Boolean> getCleanupOutput()
Defines whether the output dir should be cleaned up before generating the output.
-
getDryRun
@Optional()@Input() abstract Property<Boolean> getDryRun()
Defines whether the generator should run in dry-run mode.
-
getStrictSpec
@Optional()@Input() abstract Property<Boolean> getStrictSpec()
When
true, applies strict validation against the OpenAPI specification, failing on any deviation. When not set, any value from configFile is used; the generator's own default isfalse.
-
getMinimalUpdate
@Optional()@Input() abstract Property<Boolean> getMinimalUpdate()
When
true, only writes output files that have changed relative to an existing generated output. Reduces unnecessary file churn in version control. When not set, any value from configFile is used; the generator's own default isfalse.
-
getGenerateRecursiveDependentModels
@Optional()@Input() abstract Property<Boolean> getGenerateRecursiveDependentModels()
When
true, recursively generates all models that the selected models depend on, even if those dependent models were not explicitly listed for generation. Only relevant when modelFilesConstrainedTo is configured. When not set, any value from configFile is used; the generator's own default isfalse.
-
getMergedFileInfoName
@Internal() abstract Property<String> getMergedFileInfoName()
Title placed in the
info.titlefield of the merged spec. Defaults to"merged spec". Only used when inputSpecRootDirectory is set.
-
getMergedFileInfoDescription
@Internal() abstract Property<String> getMergedFileInfoDescription()
Description placed in the
info.descriptionfield of the merged spec. Defaults to"merged spec". Only used when inputSpecRootDirectory is set.
-
getMergedFileInfoVersion
@Internal() abstract Property<String> getMergedFileInfoVersion()
Version placed in the
info.versionfield of the merged spec. Defaults to"1.0.0". Only used when inputSpecRootDirectory is set.
-
getEffectiveMergedSpecInfo
@Input()@Optional() final String getEffectiveMergedSpecInfo()
Combines mergedFileInfoName, mergedFileInfoDescription, and mergedFileInfoVersion into a single fingerprint value that is only visible to Gradle's up-to-date/caching logic when merge mode is actually active (i.e. inputSpecRootDirectory is set and inputSpecRootDirectorySkipMerge is false). Returns
null— and is therefore skipped by@Optional— when merge is inactive, preventing unnecessary cache invalidation for tasks that never use the merge feature.
-
set
final Unit set(RegularFileProperty $self, String path)
Extension function to allow setting file properties with a String path in Kotlin DSL. Example: inputSpec.set("$rootDir/api.yaml")
-
set
final Unit set(DirectoryProperty $self, String path)
Extension function to allow setting directory properties with a String path in Kotlin DSL. Example: outputDir.set("$buildDir/generated")
-
setInputSpecAsString
final Unit setInputSpecAsString(String path)
Groovy-compatible setter for inputSpec property. Accepts a String and automatically routes to remote or local file based on URI detection. Clears the opposite property to prevent stale values from taking precedence.
-
setConfigFileAsString
final Unit setConfigFileAsString(String path)
Groovy-compatible setter for configFile property.
-
setIgnoreFileOverrideAsString
final Unit setIgnoreFileOverrideAsString(String path)
Groovy-compatible setter for ignoreFileOverride property.
-
setTemplateDirAsString
final Unit setTemplateDirAsString(String path)
Groovy-compatible setter for templateDir property.
-
setOutputDirAsString
final Unit setOutputDirAsString(String path)
Groovy-compatible setter for outputDir property.
-
setInputSpecRootDirectoryAsString
final Unit setInputSpecRootDirectoryAsString(String path)
Groovy-compatible setter for inputSpecRootDirectory property.
-
setSchemaLocationAsString
final Unit setSchemaLocationAsString(String path)
Groovy-compatible setter for schemaLocation property.
-
-
-
-