Class JsonSchemaExtension

java.lang.Object
org.creekservice.api.json.schema.gradle.plugin.JsonSchemaExtension
All Implemented Interfaces:
org.gradle.api.plugins.ExtensionAware

public abstract class JsonSchemaExtension extends Object implements org.gradle.api.plugins.ExtensionAware
Gradle extension for configuring schema generation
  • Constructor Details

    • JsonSchemaExtension

      public JsonSchemaExtension()
      Constructor
  • Method Details

    • getTypeScanning

      public JsonSchemaExtension.TypeScanningSpec getTypeScanning()
      Configure type scanning for finding types to generate schema for, i.e. types annotated with GeneratesSchema.
      Returns:
      the type scanning config
    • getSubtypeScanning

      public JsonSchemaExtension.TypeScanningSpec 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 stored

      Default: $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 stored

      Default: $buildDir/generated/test-resources/schema

      Returns:
      the test resource root property.
    • getOutputDirectoryName

      public abstract org.gradle.api.provider.Property<String> getOutputDirectoryName()
      Optionally, provide a specific directory to generate schemas into.

      This is a directory under the resource root and test 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 is resource-root/io/acme/financial/model/Account.yml. If this output directory property is set, then the schema location is resource-root/output-directory/io.acme.financial.model.Account.yml.

      Returns:
      output directory property.
    • getExtraArguments

      public abstract org.gradle.api.provider.ListProperty<String> getExtraArguments()
      Optional list of additional arguments to pass to the generator.

      See the docs for more info.

      Default: none.

      Returns:
      extra args property.
    • extraArguments

      public void extraArguments(String... args)
      Set additional args to pass to the schema generator.

      See getExtraArguments() for more info.

      Parameters:
      args - the extra args to pass to the generator.