@@ -21,7 +21,7 @@ This tutorial uses the Python client as a library. To use the CLI tool, see the
2121## 1. Initial set up
2222
2323``` python
24- {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=1 - 18 }
24+ {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=1 - 28 }
2525```
2626
2727To create a JSON Schema you need a data model, and the data types you want to create.
@@ -35,7 +35,7 @@ The data types must exist in your data model. This can be a list of data types,
3535Create a JSON Schema
3636
3737``` python
38- {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=20 - 27 }
38+ {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=30 - 37 }
3939```
4040
4141You should see the first JSON Schema for the datatype you selected printed.
@@ -47,7 +47,7 @@ By setting the `output` parameter as path to a "temp" directory, the file will b
4747Create multiple JSON Schema
4848
4949``` python
50- {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=30 - 36 }
50+ {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=40 - 46 }
5151```
5252
5353The ` data_types ` parameter is a list and can have multiple data types.
@@ -57,7 +57,7 @@ The `data_types` parameter is a list and can have multiple data types.
5757Create every JSON Schema
5858
5959``` python
60- {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=38 - 43 }
60+ {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=48 - 53 }
6161```
6262
6363If you don't set a ` data_types ` parameter a JSON Schema will be created for every data type in the data model.
@@ -67,7 +67,7 @@ If you don't set a `data_types` parameter a JSON Schema will be created for ever
6767Create a JSON Schema
6868
6969``` python
70- {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=45 - 51 }
70+ {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=55 - 61 }
7171```
7272
7373If you have only one data type and set the ` output ` parameter to a file path(ending in.json), the JSON Schema file will have that path.
@@ -77,7 +77,7 @@ If you have only one data type and set the `output` parameter to a file path(end
7777Create a JSON Schema
7878
7979``` python
80- {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=53 - 58 }
80+ {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=63 - 68 }
8181```
8282
8383If you don't set ` output ` parameter the JSON Schema file will be created in the current working directory.
@@ -87,7 +87,7 @@ If you don't set `output` parameter the JSON Schema file will be created in the
8787Create a JSON Schema
8888
8989``` python
90- {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=60 - 66 }
90+ {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=70 - 76 }
9191```
9292
9393You can have Curator format the property names and valid values in the JSON Schema. This will remove whitespace and special characters.
@@ -97,21 +97,24 @@ You can have Curator format the property names and valid values in the JSON Sche
9797Once you've created a JSON Schema file, you can register it to a Synapse organization.
9898
9999``` python
100- {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=68 - 76 }
100+ {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=78 - 87 }
101101```
102102
103103The ` register_jsonschema ` function:
104104- Takes a path to your generated JSON Schema file
105105- Registers it with the specified organization in Synapse
106106- Returns the schema URI and a success message
107107- You can optionally specify a version (e.g., "0.0.1") or let it auto-generate
108+ - The fix_schema_name argument replaces dashes and underscores with periods in the schema name
109+ - 'my-schema_name' -> 'my.schema.name'
110+ - defaults to False
108111
109112## 9. Bind a JSON Schema to a Synapse Entity
110113
111114After registering a schema, you can bind it to Synapse entities (files, folders, etc.) for metadata validation.
112115
113116``` python
114- {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=78 - 85 }
117+ {! docs/ tutorials/ python/ tutorial_scripts/ schema_operations.py! lines=89 - 96 }
115118```
116119
117120The ` bind_jsonschema ` function:
0 commit comments