# Common Measure assurance record schema

JSON Schema (draft 2020-12) for the Common Measure assurance record,
implementing specification version 0.1.

## Files

- `assurance-record-0.1.schema.json` — the schema. `$id` is
  `https://commonmeasure.bio/schema/assurance-record-0.1.schema.json`.
- `assurance-record-0.1.example.json` — three conformant records, across
  freshwater water, marine sediment and terrestrial soil.

## Validate from the command line

```bash
npx ajv-cli validate \
  -s assurance-record-0.1.schema.json \
  -d my-record.json \
  --spec=draft2020
```

Any JSON Schema draft 2020-12 library will work.

## Declared unknowns

Every field is required. Sixteen of them also accept the literal string
`not recorded` in place of a value, expressed in the schema as
`anyOf: [<value>, {"const": "not recorded"}]`. A gap is therefore
declared rather than silent: a reader can tell the difference between a
measurement that was made, one that was not, and a record that simply omitted
the question.

Nine fields do not accept it — the two coordinates, `collectionDateTime`,
`assayType`, `markerLocus`, `pipelineVersion`, `referenceDatabaseVersion`,
`recordHash` and `standardVersion`. A record without those describes nothing.

## Extending a record

`additionalProperties` is `true`. Fields beyond the specification are
permitted and do not fail validation.

## Authority

The schema is generated from the published specification at
https://commonmeasure.bio/specification/assurance-record. Where the schema and
the specification disagree, the specification governs.

## License

CC BY 4.0. https://creativecommons.org/licenses/by/4.0/
