Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions c/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
- Add the ``tsk_tree_get_size_bound`` function which returns an upper bound on the number of nodes reachable from
the roots of a tree. Useful for tree stack allocations (:user:`jeromekelleher`, :pr:`1704`).

- Add ``MetadataSchema.permissive_json`` for an easy way to get the simplest schema.


----------------------
[0.99.14] - 2021-09-03
Expand Down
3 changes: 3 additions & 0 deletions docs/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ the keys and types of those properties are specified along with optional
long-form names, descriptions and validations such as min/max or regex matching for
strings, see the {ref}`sec_metadata_schema_examples` below.

As a convenience the simplest, permissive JSON schema is available as
{meth}`MetadataSchema.permissive_json()`.

The {ref}`sec_tutorial_metadata` Tutorial shows how to use schemas and access metadata
in the tskit Python API.

Expand Down
8 changes: 4 additions & 4 deletions python/tskit/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,12 +700,12 @@ def encode_row(self, row: Any) -> bytes:
# Set by __init__
pass # pragma: no cover

# Utility to make a simple permission JSON schema. Probably should be
# part of the documented API. See
# https://github.com/tskit-dev/tskit/issues/1956 for more details.

@staticmethod
def permissive_json():
"""
The simplest, permissive JSON schema. Only specifies the JSON codec and has
no constraints on the properties.
"""
return MetadataSchema({"codec": "json"})


Expand Down