Skip to content

MetadataSchema doesn't validate the schema #2102

@jeromekelleher

Description

@jeromekelleher

There doesn't seem to be much validation of the schema itself when we set a metadata schema. E.g., if we do:

import tskit

tables = tskit.TableCollection(1)
tables.nodes.metadata_schema = tskit.MetadataSchema(
    {
        "codec": "json",
        "type": "object",
        "properties": {"accession_number": {"type": "integer"}},
        "additional Properties": True,
    }
)

print(tables.nodes.metadata_schema)

tables.nodes.add_row(metadata={})
OrderedDict([('additional Properties', True),
             ('codec', 'json'),
             ('properties',
              OrderedDict([('accession_number',
                            OrderedDict([('type', 'integer')]))])),
             ('type', 'object')])

(Note the space in "additionalProperties")

This is pretty unhelpful from a developer perspective - we should at least give an error if the schema contains stuff we don't understand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Python APIIssue is about the Python APIenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions