Class SchemaCompatibilityValidator
- java.lang.Object
-
- org.spf4j.maven.plugin.avro.avscp.validation.impl.SchemaCompatibilityValidator
-
public final class SchemaCompatibilityValidator extends Object implements Validator<Void>
Validates previously released schemas for backward compatibility.The following configurations are available for this "compatibility" validator:
- versionRange - maven version range to check compatibility against. (defaults to "[," + mavenProject.getVersion() + ')' )
- maxNrOfVersionsToCheckForCompatibility = max number oof versions to check against. (defaults to 30)
- maxNrOfDaysBackCheckForCompatibility - max released time to check against (defaults to 1 year)
- deprecationRemoval - validates that a removed schema has been previously deprecated (false by default)
- schemaArtifactClassifier - the classifier of the artifact that contains the schema files. defaults to null (the main jar)
- schemaArtifactExtension - the extension of the artifact that contains the schema files. defaults to jar
The following validations are performed:
- 1) We check previously released schema for (reader to writer) and (writer to reader) compatibility with the current schema. Unless compatibility is not desired ( via "beta" schema annotation, or only partial compatibility is desired with "noNewToOldCompatibility" "noOldToNewCompatibility" schema annotations. (objects written with old schema don't need to be converted to new objects) or "noNewToOldCompatibility" if (objects written with new schema don't need to be converted to old schema objects)
- 2) Schema deprecation and removal policy can also enabled with compatibiliy.deprecationRemoval = true, this will validate that a schema has been deprecated during the entire compatibility interval.
- Author:
- Zoltan Farkas
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spf4j.maven.plugin.avro.avscp.validation.Validator
Validator.Result
-
-
Constructor Summary
Constructors Constructor Description SchemaCompatibilityValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()Class<Void>getValidationInput()Validator.Resultvalidate(Void nv, ValidatorMojo mojo)voidvalidateCompatibility(String groupId, String artifactId, String classifier, String extension, org.eclipse.aether.version.Version version, List<org.eclipse.aether.repository.RemoteRepository> remoteProjectRepositories, org.eclipse.aether.RepositorySystem repoSystem, org.eclipse.aether.RepositorySystemSession repositorySession, ValidatorMojo mojo, boolean deprecationRemoval, Instant instantToGoBack, Consumer<String> issues)voidvalidateCompatiblityBetween2Schemas(Schema newSchema, Schema previousSchema, org.eclipse.aether.version.Version previousVersion, Consumer<String> issues, org.apache.maven.plugin.logging.Log log, boolean deprecationRemoval)
-
-
-
Method Detail
-
validate
public Validator.Result validate(Void nv, ValidatorMojo mojo) throws IOException
- Specified by:
validatein interfaceValidator<Void>- Throws:
IOException
-
validateCompatibility
public void validateCompatibility(String groupId, String artifactId, @Nullable String classifier, String extension, org.eclipse.aether.version.Version version, List<org.eclipse.aether.repository.RemoteRepository> remoteProjectRepositories, org.eclipse.aether.RepositorySystem repoSystem, org.eclipse.aether.RepositorySystemSession repositorySession, ValidatorMojo mojo, boolean deprecationRemoval, Instant instantToGoBack, Consumer<String> issues) throws IOException
- Throws:
IOException
-
validateCompatiblityBetween2Schemas
public void validateCompatiblityBetween2Schemas(Schema newSchema, Schema previousSchema, org.eclipse.aether.version.Version previousVersion, Consumer<String> issues, org.apache.maven.plugin.logging.Log log, boolean deprecationRemoval)
-
getValidationInput
public Class<Void> getValidationInput()
- Specified by:
getValidationInputin interfaceValidator<Void>
-
-