VEFA Validator :: API

API for extensions to validator.

License

License

GroupId

GroupId

no.difi.vefa
ArtifactId

ArtifactId

validator-api
Last Version

Last Version

2.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

VEFA Validator :: API
API for extensions to validator.
Project URL

Project URL

https://github.com/anskaffelser/vefa-validator
Project Organization

Project Organization

Norwegian Agency for Public Management and eGovernment (Difi)
Source Code Management

Source Code Management

https://github.com/anskaffelser/vefa-validator

Download validator-api

How to add to project

<!-- https://jarcasting.com/artifacts/no.difi.vefa/validator-api/ -->
<dependency>
    <groupId>no.difi.vefa</groupId>
    <artifactId>validator-api</artifactId>
    <version>2.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/no.difi.vefa/validator-api/
implementation 'no.difi.vefa:validator-api:2.1.0'
// https://jarcasting.com/artifacts/no.difi.vefa/validator-api/
implementation ("no.difi.vefa:validator-api:2.1.0")
'no.difi.vefa:validator-api:jar:2.1.0'
<dependency org="no.difi.vefa" name="validator-api" rev="2.1.0">
  <artifact name="validator-api" type="jar" />
</dependency>
@Grapes(
@Grab(group='no.difi.vefa', module='validator-api', version='2.1.0')
)
libraryDependencies += "no.difi.vefa" % "validator-api" % "2.1.0"
[no.difi.vefa/validator-api "2.1.0"]

Dependencies

provided (2)

Group / Artifact Type Version
org.kohsuke.metainf-services : metainf-services jar 1.8
org.projectlombok : lombok jar 1.18.10

test (2)

Group / Artifact Type Version
org.testng : testng jar 6.9.9
org.mockito : mockito-core jar 2.28.2

Project Modules

There are no modules declared in this project.

Maven Central Docker

VEFA Validator 2.x

Features

  • Very easy to use.
  • Much faster than the 1.x version.
  • Supports rendering documents.
  • Very low footprint in your code.
  • Pooling of resources.
  • Supports different lifecycles of validation artifacts.
  • Configurable to fit multiple sizes.
  • Nested validation (next version)
  • Tailoring individual validation using properties (next version)

Getting started

Include dependency in your pom.xml:

<dependency>
  <groupId>no.difi.vefa</groupId>
  <artifactId>validator-core</artifactId>
  <version>2.1.0</version>
</dependency>

Start validating business documents:

// Create a new validator using validation artifacts from Difi.
Validator validator = ValidatorBuilder.newValidator().build();

// Validate business document.
Validation validation = validator.validate(Paths.get("/path/to/document.xml"));

// Print result of validation.
System.out.println(validation.getReport().getFlag());

The validator is expensive to create, one instance should be enough.

New repositories

Repositories referenced in the code was moved as of September 1st 2020. To switch to the new repository, adding source in the ValidatorBuilder is required. Example of how it may look like:

Validator validator = ValidatorBuilder.newValidator()
    .setSource(RepositorySource.of("https://anskaffelser.dev/repo/validator/current/"))
    .build();

More information on the change and link to the new test repository may be found in the announcment of the new repositories.

no.difi.vefa

Anskaffelser

Versions

Version
2.1.0
2.0.2
2.0.1
2.0.0
2.0.0-RC2