Skip to content

How it works

Every service version is described by a spec sheet: a JSON document that an extractor generates from the code in the service's own build. valerify never runs a service. It reads spec sheets and compares what one side needs with what the other side offers.

Consumer and provider

valerify check compares the sheet of the project with others, in both directions at once:

  • As a consumer, against the sheet of every upstream the project has needs towards. An upstream is found by its name, from a path or a URL; loading from a registry follows.
  • As a provider, against the sheets of the consumers listed in consumers.json, each as a gate or a report.

The comparison is the same either way: one offer against one need. Which side it protects follows from where it runs and how the project is configured, not from the tool having a favourite side.

Gate and report

A finding is an error, a warning or an info, with a stable code that configurations can refer to. Whether an error fails the run is a property of the place where the check runs: in gate mode an error fails it, in report mode it is only reported. The most restrictive mode applies, whichever side states it, and the log says which setting decided. A warning or an info never fails a run, and an error cannot be suppressed.

The project files

A project states how it wants to be checked in a few small files next to its build:

  • sheet.json: the spec sheet of the project, written by its build.
  • config.json: the mode, the size limit of the documents it reads and the suppressions.
  • upstreams.json: where the sheets of the upstreams are, and which version.
  • consumers.json: the consumers a provider tracks, each as a gate or a report.
  • hosts.json: which environment variable holds the credential for which host, for sheets behind a login. It is read from the local project only, and a credential goes to that host only.

Exit statuses

StatusMeaning
0The result is positive: the document is valid, the sheets fit.
1Errors were detected in what was read: a document is invalid or cut off, or an exchange that gates has an error.
2valerify could not do its job: an input cannot be read, or the invocation is unusable.

Strict reading

valerify validate checks a single document, formally and for contradictions within it. Documents are read strictly: unknown keys, duplicate keys and empty collections are rejected with their position, and a document that is read is written back unchanged. Strictness lies in the validity of the content: a valid document in another layout is accepted, with an info.

Where it runs

As a one-shot step in CI: one static binary with TLS built in, no server, no database, no permanent infrastructure. A one-shot container image is part of the delivery that is being built. Where the code and the documentation are.