avro-schema:avro-validate

Full name:

org.spf4j:maven-avro-schema-plugin:8.9.3-SNAPSHOT:avro-validate

Description:

Mojo that runs all Schema validators on this project schemas

Built in validators:

  • docValidator (schema documentation),
  • compatibility (schema compatibility),
  • namesValidator (schema named types and field name validation)

By default validation issues will fail the build. This can be disabled at validator level with:


<validatorConfigs>
 <[validatorName].failOnIssue></[validatorName].failOnIssue>
</validatorConfigs>

A particular validator can be sckipped at schema level with:

@ignoreValidators(["validatorname"])

Custom validators can be built and used. A custom validator, will need to implement the org.spf4j.maven.plugin.avro.avscp.validation.Validator interface, and will be loaded via the java Service Loader api.

Attributes:

  • Requires a Maven project to be executed.
  • Binds by default to the lifecycle phase: test.

Optional Parameters

Name Type Since Description
<excludeValidators> List - you can exclude certain validators from execution.
<generatedAvscTarget> File - the destination for the generated avro schema json files (will be published along with the java code).
Default value is: ${project.build.directory}/generated-sources/avsc.
<generatedJavaTarget> File - the destination for the java generated files.
Default value is: ${project.build.directory}/generated-sources/avro.
<schemaArtifactClassifier> String - the schema artifact classifier.
Default value is: avsc.
<schemaArtifactExtension> String - the schema artifact extension.
Default value is: jar.
<sourceDirectory> File - The source directory of avro files. This directory is added to the classpath at schema compiling time. All files can therefore be referenced as classpath resources following the directory structure under the source directory.
Default value is: ${basedir}/src/main/avro.
<target> File - the target folder.
Default value is: ${project.build.directory}.
<useSchemaReferencesForAvsc> boolean - This option will use schema references when writing schemas that depend of schemas from other projects, instead of baking them in. by default (false) all schema references will be inlined.
Default value is: false.
<validatorConfigs> Map - You can configure validators, see individual validator doc (javadoc) for supported configuration keys.

Parameter Details

<excludeValidators>

you can exclude certain validators from execution.
  • Type: java.util.List
  • Required: No

<generatedAvscTarget>

the destination for the generated avro schema json files (will be published along with the java code).
  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}/generated-sources/avsc

<generatedJavaTarget>

the destination for the java generated files.
  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}/generated-sources/avro

<schemaArtifactClassifier>

the schema artifact classifier.
  • Type: java.lang.String
  • Required: No
  • Default: avsc

<schemaArtifactExtension>

the schema artifact extension.
  • Type: java.lang.String
  • Required: No
  • Default: jar

<sourceDirectory>

The source directory of avro files. This directory is added to the classpath at schema compiling time. All files can therefore be referenced as classpath resources following the directory structure under the source directory.
  • Type: java.io.File
  • Required: No
  • Default: ${basedir}/src/main/avro

<target>

the target folder.
  • Type: java.io.File
  • Required: No
  • Default: ${project.build.directory}

<useSchemaReferencesForAvsc>

This option will use schema references when writing schemas that depend of schemas from other projects, instead of baking them in. by default (false) all schema references will be inlined.
  • Type: boolean
  • Required: No
  • Default: false

<validatorConfigs>

You can configure validators, see individual validator doc (javadoc) for supported configuration keys.
  • Type: java.util.Map
  • Required: No