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 enum
s. 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:
enum
values to match.pytest
in the data-standard
repo) to make sure you haven’t missed anything or made any typos.To add a new codelist:
schema/codelists
directory with the column headings:
enum
, codelist
and openCodelist
properties for any properties in the JSON schema(s) which should reference it.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.
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