mapping_sheet(schema, io, order_by=None, infer_required=False, extension_field=None, include_deprecated=True, include_definitions=False)¶
Writes information about all field paths in a JSON Schema to a CSV file.
- schema (dict) – a JSON schema
- io – a file-like object to which to write the rows
- order_by (str) – the column by which to sort the rows
- infer_required (bool) – whether to infer that a field is required if “null” is not in its
- extension_field (str) – the property in the JSON schema containing the name of the extension in which each field was defined
- include_deprecated (bool) – whether to include any deprecated fields
- include_definitions (bool) – whether to traverse the “definitions” property
The CSV’s columns are:
The first part of the JSON path to the field in the data, e.g.
The JSON path to the field in the data, e.g.
titlein the JSON schema. If the field has no
title, defaults to the field’s name followed by “*”.
descriptionin the JSON schema. URLs are removed (see the
A comma-separated list of the field’s
typein the JSON schema, excluding “null”. If the field has no
type, defaults to “unknown”.
The field’s allowed number of occurrences.
- “0..1” if the field defines an optional literal value.
- “0..n” if the field defines an optional array.
- “1..1” if the field defines a required literal value.
- “1..n” if the field defines a required array.
If the field’s schema sets:
enum: “Enum: ” followed by the
enumas a comma-separated list, excluding
items/enum: “Enum: ” followed by the
items/enumas a comma-separated list, excluding
The URLs extracted from the field’s
The OCDS minor version in which the field (or its parent) was deprecated
The explanation for the deprecation of the field
The name of the extension that introduced the JSON path (see the
MissingColumnError – if the column by which to order is missing