datacatalog.jsonschemas package

Submodules

datacatalog.jsonschemas.encoders module

class datacatalog.jsonschemas.encoders.DateTimeEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: json.encoder.JSONEncoder

Enables encoding of Python datetime as JSON strings

default(o)[source]

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)

datacatalog.jsonschemas.exceptions module

datacatalog.jsonschemas.formatchecker module

class datacatalog.jsonschemas.formatchecker.formatChecker[source]

Bases: jsonschema._format.FormatChecker

Enables python-jsonschema to validate format fields

datacatalog.jsonschemas.schema module

class datacatalog.jsonschemas.schema.JSONSchemaBaseObject(**kwargs)[source]

Bases: object

Interface to JSON schema plus datacatalog-specific extensions

BASEREF = 'https://schema.catalog.sd2e.org/schemas/'
COLLECTION = 'generic'
DELETE_FIELD = '_visible'
INDENT = 4
JSONSCHEMA_SPEC = 'http://json-schema.org/draft-07/schema#'
PARAMS = [('schema', False, 'schema', 'http://json-schema.org/draft-07/schema#', '$'), ('comment', False, 'comment', '', '$'), ('id', False, 'id', '', '$'), ('definitions', False, 'definitions', None, ''), ('title', False, 'title', None, ''), ('description', False, 'description', None, ''), ('additionalProperties', False, 'additionalProperties', False, ''), ('type', False, 'type', 'object', ''), ('items', False, 'items', None, ''), ('oneOf', False, 'oneOf', None, ''), ('properties', False, 'properties', None, ''), ('required', False, 'required', None, ''), ('pattern', False, 'pattern', None, ''), ('enum', False, 'enum', None, ''), ('format', False, 'format', None, ''), ('examples', False, 'examples', None, ''), ('_filename', False, '_filename', 'baseobject', ''), ('_snake_case', False, '_snake_case', True, ''), ('_collection', False, '__collection', None, ''), ('_indexes', False, '__indexes', None, ''), ('_identifiers', False, '__identifiers', None, ''), ('_uuid_type', False, '__uuid_type', 'generic', ''), ('_uuid_fields', False, '__uuid_fields', 'id', ''), ('_visible', False, '_visible', True, '')]
SORT_KEYS = True
VERSION = '2.2.0#master'
get_class(classname=None)[source]
to_dict(private_prefix='_', **kwargs)[source]

Render the schema as a dict

Private keys are filtered.

to_jsonschema(**kwargs)[source]

Render the schema as a JSON-formatted string

update_comment()[source]

Dynamically populate schema.$comment

Combines existing comment with date, rep URL, and git commit hash

update_id()[source]

Dynamically builds schema.$id

Transforms self._filename into a schema.id URL in the current namespace.

datacatalog.jsonschemas.schemas module

datacatalog.jsonschemas.schemas.COMPOSED_SCHEMAS = ['compositions.sample_set']

Modules that represent compositions or translations of existing datacatalog schemas. These are useful for backwards or sideways compatibility.

datacatalog.jsonschemas.schemas.PRIMITIVE_SCHEMAS = ['definitions', 'filetypes', 'identifiers', 'tenancy', 'managers.annotations']

Modules that define simple patterns, enumerators, or static foreign entities

datacatalog.jsonschemas.schemas.SCHEMAS = [['linkedstores.basestore', 'linkedstores.challenge_problem', 'linkedstores.experiment_design', 'linkedstores.structured_request', 'linkedstores.experiment', 'linkedstores.sample', 'linkedstores.measurement', 'linkedstores.file', 'linkedstores.fixity', 'linkedstores.pipeline', 'linkedstores.pipelinejob', 'linkedstores.product', 'linkedstores.reference', 'linkedstores.process', 'linkedstores.association', 'linkedstores.annotations.tag', 'linkedstores.annotations.text'], ['compositions.sample_set'], ['definitions', 'filetypes', 'identifiers', 'tenancy', 'managers.annotations'], ['formats']]

The union set of all schemas. This list is traversed when building the set of all project schemas.

datacatalog.jsonschemas.schemas.STORE_SCHEMAS = ['linkedstores.basestore', 'linkedstores.challenge_problem', 'linkedstores.experiment_design', 'linkedstores.structured_request', 'linkedstores.experiment', 'linkedstores.sample', 'linkedstores.measurement', 'linkedstores.file', 'linkedstores.fixity', 'linkedstores.pipeline', 'linkedstores.pipelinejob', 'linkedstores.product', 'linkedstores.reference', 'linkedstores.process', 'linkedstores.association', 'linkedstores.annotations.tag', 'linkedstores.annotations.text']

Modules that define object and document schemas for managed document collections linked by UUID and linkage fields. Classes in these modules inherit schema and database logic from basestore classes

datacatalog.jsonschemas.schemas.UNMANAGED_SCHEMAS = ['formats']

Modules that define schemas imported from outside the core datacatalog data model into the shared datacatalog schema namespace

datacatalog.jsonschemas.schemas.get_all_schemas(filters=[])[source]

Top-level function to discover and return all known JSON schemas

Parameters:filters (list, optional) – subset list of classes to traverse
Returns:Collection of schemas indexed by filename
Return type:JSONSchemaCollection

datacatalog.jsonschemas.validate module

datacatalog.jsonschemas.validate.validate(to_validate, schema, format_checker=None)[source]

Validate a dict against a JSON schema.

Includes retry in case the remote schema does not resolve

datacatalog.jsonschemas.version module