Class JsonSchemaExtension
- All Implemented Interfaces:
org.gradle.api.plugins.ExtensionAware
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classGradle extension for configuring which packages and modules are included when scanning for subtypes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidextraArguments(String... args) Set additional args to pass to the schema generator.abstract org.gradle.api.provider.ListProperty<String>Optional list of additional arguments to pass to the generator.abstract org.gradle.api.provider.Property<String>Optionally, provide a specific directory to generate schemas into.abstract org.gradle.api.file.DirectoryPropertyOptional resource root where generated schemas should be storedConfigure type scanning for finding subtypes, i.e.abstract org.gradle.api.file.DirectoryPropertyOptional resource root where generated test schemas should be storedConfigure type scanning for finding types to generate schema for, i.e.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.plugins.ExtensionAware
getExtensions
-
Constructor Details
-
JsonSchemaExtension
public JsonSchemaExtension()Constructor
-
-
Method Details
-
getTypeScanning
Configure type scanning for finding types to generate schema for, i.e. types annotated withGeneratesSchema.- Returns:
- the type scanning config
-
getSubtypeScanning
Configure type scanning for finding subtypes, i.e. subtypes of polymorphic types that are part of base types.- Returns:
- the type scanning config
-
getSchemaResourceRoot
public abstract org.gradle.api.file.DirectoryProperty getSchemaResourceRoot()Optional resource root where generated schemas should be storedDefault:
$buildDir/generated/resources/schema- Returns:
- the resource root property.
-
getTestSchemaResourceRoot
public abstract org.gradle.api.file.DirectoryProperty getTestSchemaResourceRoot()Optional resource root where generated test schemas should be storedDefault:
$buildDir/generated/test-resources/schema- Returns:
- the test resource root property.
-
getOutputDirectoryName
Optionally, provide a specific directory to generate schemas into.This is a directory under the
resource rootandtest resource root.By default, schemas will be generated in a package directory structure under the resource root, and the schema filename will match the simple name of the type.
If this directory name is set, schemas will be generated into a single flat directly under the resource root, and the schema filename will match the types fully-qualified name.
For example, given a type
io.acme.financial.model.Account, the default schema location isresource-root/io/acme/financial/model/Account.yml. If this output directory property is set, then the schema location isresource-root/output-directory/io.acme.financial.model.Account.yml.- Returns:
- output directory property.
-
getExtraArguments
Optional list of additional arguments to pass to the generator.See the docs for more info.
Default: none.
- Returns:
- extra args property.
-
extraArguments
Set additional args to pass to the schema generator.See
getExtraArguments()for more info.- Parameters:
args- the extra args to pass to the generator.
-