Skip to content

Commit 958a117

Browse files
benjefferymergify[bot]
authored andcommitted
Document permissive_json
1 parent 344326c commit 958a117

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

c/CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
- Add the ``tsk_tree_get_size_bound`` function which returns an upper bound on the number of nodes reachable from
8686
the roots of a tree. Useful for tree stack allocations (:user:`jeromekelleher`, :pr:`1704`).
8787

88+
- Add ``MetadataSchema.permissive_json`` for an easy way to get the simplest schema.
89+
8890

8991
----------------------
9092
[0.99.14] - 2021-09-03

docs/metadata.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ the keys and types of those properties are specified along with optional
5353
long-form names, descriptions and validations such as min/max or regex matching for
5454
strings, see the {ref}`sec_metadata_schema_examples` below.
5555

56+
As a convenience the simplest, permissive JSON schema is available as
57+
{meth}`MetadataSchema.permissive_json()`.
58+
5659
The {ref}`sec_tutorial_metadata` Tutorial shows how to use schemas and access metadata
5760
in the tskit Python API.
5861

python/tskit/metadata.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,12 +700,12 @@ def encode_row(self, row: Any) -> bytes:
700700
# Set by __init__
701701
pass # pragma: no cover
702702

703-
# Utility to make a simple permission JSON schema. Probably should be
704-
# part of the documented API. See
705-
# https://github.com/tskit-dev/tskit/issues/1956 for more details.
706-
707703
@staticmethod
708704
def permissive_json():
705+
"""
706+
The simplest, permissive JSON schema. Only specifies the JSON codec and has
707+
no constraints on the properties.
708+
"""
709709
return MetadataSchema({"codec": "json"})
710710

711711

0 commit comments

Comments
 (0)