Schema#
- class ocdskit.schema.Field(schema=None, pointer=None, path=None, definition_pointer=None, definition_path=None, required=None, deprecated=None, multilingual=None, sep='.')[source]#
- __init__(schema=None, pointer=None, path=None, definition_pointer=None, definition_path=None, required=None, deprecated=None, multilingual=None, sep='.')[source]#
Initializes a schema field object.
- Parameters
schema (dict) – the field’s schema
pointer (tuple) – the JSON pointer to the field in the schema, e.g.
('properties', 'tender', 'properties', 'id')
path (tuple) – the path to the field in data, e.g.
('tender', 'id')
definition_pointer (tuple) – the JSON pointer to the definition in which the field is defined, e.g.
('definitions', 'Item')
definition_path (tuple) – the path to the definition in which the field is defined, e.g.
('Item')
required (bool) – whether the field is listed in the schema’s
required
deprecated (dict) – if the field, or an ancestor of the field, sets
deprecated
, thedeprecated
objectmultilingual (bool) – whether the field has a corresponding field in the schema’s
patternProperties
sep (str) – the separator to use in string representations of paths
- property pointer#
Returns the JSON pointer to the field in the schema, e.g.
/properties/tender/properties/id
.
- property definition_pointer#
Returns the JSON pointer to the definition in which the field is defined, e.g.
/definitions/Item
.
- property path#
Returns the path to the field in data with
self.sep
as separator, e.g.tender.id
.
- property definition_path#
Returns the path to the definition in which the field is defined with
self.sep
as separator, e.g.Item
.
- property sep#
Returns the separator to use in string representations of paths.
- ocdskit.schema.get_schema_fields(schema, pointer=None, path=None, definition_pointer=None, definition_path=None, deprecated=None)[source]#
Yields a
Field
object for each field (whether underproperties
orpatternProperties
) in a JSON schema.- Parameters
schema (dict) – a JSON schema
pointer (tuple) – the JSON pointer to the field in the schema, e.g.
('properties', 'tender', 'properties', 'id')
path (tuple) – the path to the field in data, e.g.
('tender', 'id')
definition_pointer (tuple) – the JSON pointer to the definition in which the field is defined, e.g.
('definitions', 'Item')
definition_path (tuple) – the path to the definition in which the field is defined, e.g.
('Item')
deprecated (dict) – if the field, or an ancestor of the field, sets
deprecated
, thedeprecated
object