bods-dev-handbook

Maintenance and compilation of the BODS schema

Codelists

Codelists are maintained as csv files so that metadata for codelist items can be included. Values of closed codelists are duplicated in JSON schema files for any schema that use them as enums. Eg. the Entity Type codelist is defined in the entityType.csv file, and appears in the entity-statement.json schema like so:

"entityType": {
    ...
    "enum": [
        "registeredEntity",
        "legalEntity",
        "arrangement",
        "anonymousEntity",
        "unknownEntity"
      ],
      "codelist": "entityType.csv",
      "openCodelist": false,
      ...
}

To update an existing codelist:

To add a new codelist:

To remove a codelist:

The tests will catch any codelists that aren’t used in any schema, as well as any schema which reference codelist CSVs that do not exist. The tests also check the enum values against the code column in the equivalent codelist CSV to make sure the values match exactly. The only exception to this is the statementType codelist, as each type of statement is constrained to only one value from the codelist, so it is skipped by the tests.

Compilation

The definitive version of the schema is files in https://github.com/openownership/data-standard/tree/master/schema , starting with “bods-package.json”. “bods-package.json” references other files in that folder.

You may want to compile a version:

To compile a version, use our tool: https://github.com/OpenDataServices/compile-to-json-schema

compiletojsonschema openownership-data-standard/schema/bods-package.json  > compiled_schema.json