From 73f26f2a19cc54e7f586aee113483c02260b4f3c Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 24 Feb 2026 09:43:06 -0800 Subject: [PATCH 1/8] add fix_schema_name --- docs/tutorials/command_line_client.md | 1 + synapseclient/__main__.py | 7 ++ .../extensions/curator/schema_management.py | 12 +++ .../synapseclient/test_command_line_client.py | 25 +++++ .../extensions/test_schema_management.py | 102 ++++++++++++++++++ 5 files changed, 147 insertions(+) create mode 100644 tests/unit/synapseclient/extensions/test_schema_management.py diff --git a/docs/tutorials/command_line_client.md b/docs/tutorials/command_line_client.md index 8c572df2d..84da764a7 100644 --- a/docs/tutorials/command_line_client.md +++ b/docs/tutorials/command_line_client.md @@ -575,6 +575,7 @@ synapse register-json-schema [-h] [--schema-version VERSION] schema_path organiz | `organization_name` | Positional | Name of the organization to register the schema under | | | `schema_name` | Positional | The name of the JSON schema | | | `--schema-version` | Named | Version of the schema to register (e.g., '0.0.1'). If not specified, auto-generated | None | +| `--fix-schema-name` | Named | Replace dashes and underscores in the schema name with periods. | False | ### `bind-json-schema` diff --git a/synapseclient/__main__.py b/synapseclient/__main__.py index e68ca4c19..0b2670742 100644 --- a/synapseclient/__main__.py +++ b/synapseclient/__main__.py @@ -824,6 +824,7 @@ def register_json_schema(args, syn): schema_path=args.schema_path, organization_name=args.organization_name, schema_name=args.schema_name, + fix_schema_name=args.fix_schema_name, schema_version=args.schema_version, synapse_client=syn, ) @@ -1892,6 +1893,12 @@ def build_parser(): type=str, help="The name of the JSON schema", ) + parser_register_json_schema.add_argument( + "--fix-schema-name", + action="store_true", + default=False, + help="Whether to fix the schema name to meet Synapse requirements", + ) parser_register_json_schema.add_argument( "--schema-version", dest="schema_version", diff --git a/synapseclient/extensions/curator/schema_management.py b/synapseclient/extensions/curator/schema_management.py index 02e37fc0b..1b0442baf 100644 --- a/synapseclient/extensions/curator/schema_management.py +++ b/synapseclient/extensions/curator/schema_management.py @@ -20,6 +20,7 @@ def register_jsonschema( schema_path: str, organization_name: str, schema_name: str, + fix_schema_name: bool = False, schema_version: Optional[str] = None, synapse_client: Optional["Synapse"] = None, ) -> "JSONSchema": @@ -33,6 +34,8 @@ def register_jsonschema( schema_path: Path to the JSON schema file to register organization_name: Name of the organization to register the schema under schema_name: Name of the JSON schema + fix_schema_name: Whether to fix the schema name to meet Synapse requirements by replacing + dashes and underscores with periods. Defaults to False. schema_version: Optional version of the schema (e.g., '0.0.1'). If not specified, a version will be auto-generated. synapse_client: If not passed in and caching was not disabled by @@ -54,6 +57,7 @@ def register_jsonschema( schema_path="/path/to/schema.json", organization_name="my.org", schema_name="my.schema", + fix_schema_name=True, schema_version="0.0.1", synapse_client=syn ) @@ -65,6 +69,7 @@ def register_jsonschema( coroutine=register_jsonschema_async( schema_path=schema_path, organization_name=organization_name, + fix_schema_name=fix_schema_name, schema_name=schema_name, schema_version=schema_version, synapse_client=synapse_client, @@ -76,6 +81,7 @@ async def register_jsonschema_async( schema_path: str, organization_name: str, schema_name: str, + fix_schema_name: bool = False, schema_version: Optional[str] = None, synapse_client: Optional["Synapse"] = None, ) -> "JSONSchema": @@ -89,6 +95,8 @@ async def register_jsonschema_async( schema_path: Path to the JSON schema file to register organization_name: Name of the organization to register the schema under schema_name: The name of the JSON schema + fix_schema_name: Whether to fix the schema name to meet Synapse requirements by replacing + dashes and underscores with periods. Defaults to False. schema_version: Optional version of the schema (e.g., '0.0.1'). If not specified, a version will be auto-generated. synapse_client: If not passed in and caching was not disabled by @@ -111,6 +119,7 @@ async def register_jsonschema_async( schema_path="/path/to/schema.json", organization_name="my.org", schema_name="my.schema", + fix_schema_name=True, schema_version="0.0.1", synapse_client=syn )) @@ -121,6 +130,9 @@ async def register_jsonschema_async( from synapseclient import Synapse from synapseclient.models.schema_organization import JSONSchema + if fix_schema_name: + schema_name = schema_name.replace("-", ".").replace("_", ".") + syn = Synapse.get_client(synapse_client=synapse_client) with open(schema_path, "r") as f: diff --git a/tests/integration/synapseclient/test_command_line_client.py b/tests/integration/synapseclient/test_command_line_client.py index a6062620d..f50267bd7 100644 --- a/tests/integration/synapseclient/test_command_line_client.py +++ b/tests/integration/synapseclient/test_command_line_client.py @@ -1333,6 +1333,31 @@ def test_register_json_schema(self, test_state, schema_organization, schema_file assert "Successfully registered schema" in output assert schema_name in output assert schema_organization.name in output + assert False + + def test_register_json_schema_fix_schema_name( + self, test_state, schema_organization, schema_file + ): + """Test register-json-schema CLI command""" + schema_name = f"test-schema_id{str(uuid.uuid4())[:8]}" + fixed_schema_name = schema_name.replace("-", ".").replace("_", ".") + + output = run( + test_state, + "synapse", + "--skip-checks", + "register-json-schema", + schema_file, + schema_organization.name, + schema_name, + "--schema-version", + "1.0.0", + "--fix-schema-name", + ) + + assert "Successfully registered schema" in output + assert fixed_schema_name in output + assert schema_organization.name in output def test_bind_json_schema(self, test_state, schema_organization, schema_file): """Test bind-json-schema CLI command""" diff --git a/tests/unit/synapseclient/extensions/test_schema_management.py b/tests/unit/synapseclient/extensions/test_schema_management.py new file mode 100644 index 000000000..0b17bd7c7 --- /dev/null +++ b/tests/unit/synapseclient/extensions/test_schema_management.py @@ -0,0 +1,102 @@ +import json +from unittest.mock import AsyncMock, MagicMock, mock_open, patch + +import pytest + +from synapseclient.extensions.curator import register_jsonschema_async + + +@pytest.fixture +def mock_synapse_client(): + mock_client = MagicMock() + mock_client.logger = MagicMock() + return mock_client + + +@pytest.fixture +def mock_jsonschema(): + with patch("synapseclient.models.schema_organization.JSONSchema") as MockSchema: + instance = MockSchema.return_value + instance.store_async = AsyncMock() + instance.uri = "syn123.456" + yield MockSchema + + +@pytest.mark.asyncio +async def test_register_jsonschema_async(mock_synapse_client, mock_jsonschema): + # Setup + schema_path = "mock_path.json" + schema_content = {"$id": "test_schema", "type": "object"} + org_name = "test.org" + schema_name = "my-schema_name" + version = "1.0.0" + + # Mock file reading and the Synapse client retrieval + m_open = mock_open(read_data=json.dumps(schema_content)) + + with patch("builtins.open", m_open), patch( + "synapseclient.Synapse.get_client", return_value=mock_synapse_client + ), patch("json.load", return_value=schema_content): + result = await register_jsonschema_async( + schema_path=schema_path, + organization_name=org_name, + schema_name=schema_name, + schema_version=version, + synapse_client=mock_synapse_client, + ) + + # Verify the name was used as-is + mock_jsonschema.assert_called_once_with( + name=schema_name, organization_name=org_name + ) + + # Verify the async store was called with the right data + result.store_async.assert_awaited_once_with( + schema_body=schema_content, + version=version, + synapse_client=mock_synapse_client, + ) + + assert result.uri == "syn123.456" + + +@pytest.mark.asyncio +async def test_register_jsonschema_async_fix_schema_name( + mock_synapse_client, mock_jsonschema +): + # Setup + schema_path = "mock_path.json" + schema_content = {"$id": "test_schema", "type": "object"} + org_name = "test.org" + schema_name = "my-schema_name" + fixed_schema_name = "my.schema.name" + version = "1.0.0" + + # Mock file reading and the Synapse client retrieval + m_open = mock_open(read_data=json.dumps(schema_content)) + + with patch("builtins.open", m_open), patch( + "synapseclient.Synapse.get_client", return_value=mock_synapse_client + ), patch("json.load", return_value=schema_content): + result = await register_jsonschema_async( + schema_path=schema_path, + organization_name=org_name, + schema_name=schema_name, + fix_schema_name=True, + schema_version=version, + synapse_client=mock_synapse_client, + ) + + # Verify the name was fixed (dashes/underscores to dots) + mock_jsonschema.assert_called_once_with( + name=fixed_schema_name, organization_name=org_name + ) + + # Verify the async store was called with the right data + result.store_async.assert_awaited_once_with( + schema_body=schema_content, + version=version, + synapse_client=mock_synapse_client, + ) + + assert result.uri == "syn123.456" From 4a79d47bc62202dcad5ff983aa9a05b84295c1a5 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 24 Feb 2026 09:45:10 -0800 Subject: [PATCH 2/8] improved docstring description --- synapseclient/extensions/curator/schema_management.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synapseclient/extensions/curator/schema_management.py b/synapseclient/extensions/curator/schema_management.py index 1b0442baf..7eeaca68c 100644 --- a/synapseclient/extensions/curator/schema_management.py +++ b/synapseclient/extensions/curator/schema_management.py @@ -34,7 +34,7 @@ def register_jsonschema( schema_path: Path to the JSON schema file to register organization_name: Name of the organization to register the schema under schema_name: Name of the JSON schema - fix_schema_name: Whether to fix the schema name to meet Synapse requirements by replacing + fix_schema_name: If True, fixes the schema name to meet Synapse requirements by replacing dashes and underscores with periods. Defaults to False. schema_version: Optional version of the schema (e.g., '0.0.1'). If not specified, a version will be auto-generated. @@ -95,7 +95,7 @@ async def register_jsonschema_async( schema_path: Path to the JSON schema file to register organization_name: Name of the organization to register the schema under schema_name: The name of the JSON schema - fix_schema_name: Whether to fix the schema name to meet Synapse requirements by replacing + fix_schema_name: If True, fixes the schema name to meet Synapse requirements by replacing dashes and underscores with periods. Defaults to False. schema_version: Optional version of the schema (e.g., '0.0.1'). If not specified, a version will be auto-generated. From c31b271a71730dc274d7a87f2f369b93e7ca0c4c Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 24 Feb 2026 09:46:24 -0800 Subject: [PATCH 3/8] fix cli description --- synapseclient/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapseclient/__main__.py b/synapseclient/__main__.py index 0b2670742..d8f8321df 100644 --- a/synapseclient/__main__.py +++ b/synapseclient/__main__.py @@ -1897,7 +1897,7 @@ def build_parser(): "--fix-schema-name", action="store_true", default=False, - help="Whether to fix the schema name to meet Synapse requirements", + help="Fixes the schema name to meet Synapse requirements by replacing dashes and underscores with periods.", ) parser_register_json_schema.add_argument( "--schema-version", From 5acdb31c8ba13bd1059fa15ab69b2e84d0c09a5e Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 24 Feb 2026 09:47:14 -0800 Subject: [PATCH 4/8] remove assert statement --- tests/integration/synapseclient/test_command_line_client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration/synapseclient/test_command_line_client.py b/tests/integration/synapseclient/test_command_line_client.py index f50267bd7..803f08cdf 100644 --- a/tests/integration/synapseclient/test_command_line_client.py +++ b/tests/integration/synapseclient/test_command_line_client.py @@ -1333,7 +1333,6 @@ def test_register_json_schema(self, test_state, schema_organization, schema_file assert "Successfully registered schema" in output assert schema_name in output assert schema_organization.name in output - assert False def test_register_json_schema_fix_schema_name( self, test_state, schema_organization, schema_file From a47dd7059ea3e176c26ae4dc727c2ffdda5a8f85 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Tue, 24 Feb 2026 09:49:09 -0800 Subject: [PATCH 5/8] remove uneeded comments --- .../unit/synapseclient/extensions/test_schema_management.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/unit/synapseclient/extensions/test_schema_management.py b/tests/unit/synapseclient/extensions/test_schema_management.py index 0b17bd7c7..c656475ea 100644 --- a/tests/unit/synapseclient/extensions/test_schema_management.py +++ b/tests/unit/synapseclient/extensions/test_schema_management.py @@ -24,14 +24,12 @@ def mock_jsonschema(): @pytest.mark.asyncio async def test_register_jsonschema_async(mock_synapse_client, mock_jsonschema): - # Setup schema_path = "mock_path.json" schema_content = {"$id": "test_schema", "type": "object"} org_name = "test.org" schema_name = "my-schema_name" version = "1.0.0" - # Mock file reading and the Synapse client retrieval m_open = mock_open(read_data=json.dumps(schema_content)) with patch("builtins.open", m_open), patch( @@ -50,7 +48,6 @@ async def test_register_jsonschema_async(mock_synapse_client, mock_jsonschema): name=schema_name, organization_name=org_name ) - # Verify the async store was called with the right data result.store_async.assert_awaited_once_with( schema_body=schema_content, version=version, @@ -64,7 +61,6 @@ async def test_register_jsonschema_async(mock_synapse_client, mock_jsonschema): async def test_register_jsonschema_async_fix_schema_name( mock_synapse_client, mock_jsonschema ): - # Setup schema_path = "mock_path.json" schema_content = {"$id": "test_schema", "type": "object"} org_name = "test.org" @@ -72,7 +68,6 @@ async def test_register_jsonschema_async_fix_schema_name( fixed_schema_name = "my.schema.name" version = "1.0.0" - # Mock file reading and the Synapse client retrieval m_open = mock_open(read_data=json.dumps(schema_content)) with patch("builtins.open", m_open), patch( @@ -92,7 +87,6 @@ async def test_register_jsonschema_async_fix_schema_name( name=fixed_schema_name, organization_name=org_name ) - # Verify the async store was called with the right data result.store_async.assert_awaited_once_with( schema_body=schema_content, version=version, From f96349ffd8810da17d7dd1ce7d3c1e32b351f489 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 25 Feb 2026 09:08:07 -0800 Subject: [PATCH 6/8] Linglings suggestions --- synapseclient/__main__.py | 2 +- .../extensions/curator/schema_management.py | 27 ++++++++++++++++--- .../extensions/test_schema_management.py | 26 ++++++++++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/synapseclient/__main__.py b/synapseclient/__main__.py index d8f8321df..c86ecf75d 100644 --- a/synapseclient/__main__.py +++ b/synapseclient/__main__.py @@ -1897,7 +1897,7 @@ def build_parser(): "--fix-schema-name", action="store_true", default=False, - help="Fixes the schema name to meet Synapse requirements by replacing dashes and underscores with periods.", + help="Replaces dashes and underscores with periods in the schema name (e.g., 'my-schema_name' becomes 'my.schema.name')", ) parser_register_json_schema.add_argument( "--schema-version", diff --git a/synapseclient/extensions/curator/schema_management.py b/synapseclient/extensions/curator/schema_management.py index 7eeaca68c..e5b9bed58 100644 --- a/synapseclient/extensions/curator/schema_management.py +++ b/synapseclient/extensions/curator/schema_management.py @@ -6,6 +6,7 @@ """ import json +import re from typing import TYPE_CHECKING, Optional from synapseclient.core.async_utils import wrap_async_to_sync @@ -130,11 +131,13 @@ async def register_jsonschema_async( from synapseclient import Synapse from synapseclient.models.schema_organization import JSONSchema - if fix_schema_name: - schema_name = schema_name.replace("-", ".").replace("_", ".") - syn = Synapse.get_client(synapse_client=synapse_client) + if fix_schema_name: + old_name = schema_name + schema_name = fix_name(schema_name) + syn.logger.info(f"Changed schema name from '{old_name}' to '{schema_name}' ") + with open(schema_path, "r") as f: schema_body = json.load(f) @@ -154,6 +157,24 @@ async def register_jsonschema_async( return json_schema +def fix_name(name: str) -> str: + """ + Fixes a schema name to meet Synapse requirements by: + - replacing dashes and underscores with periods. + - collapsing multiple consecutive periods into a single period. + + Arguments: + name: The original schema name + + Returns: + The fixed schema name + + """ + name = name.replace("-", ".").replace("_", ".") + name = re.sub(r"\.+", ".", name) + return name + + def bind_jsonschema( entity_id: str, json_schema_uri: str, diff --git a/tests/unit/synapseclient/extensions/test_schema_management.py b/tests/unit/synapseclient/extensions/test_schema_management.py index c656475ea..101b94736 100644 --- a/tests/unit/synapseclient/extensions/test_schema_management.py +++ b/tests/unit/synapseclient/extensions/test_schema_management.py @@ -4,6 +4,7 @@ import pytest from synapseclient.extensions.curator import register_jsonschema_async +from synapseclient.extensions.curator.schema_management import fix_name @pytest.fixture @@ -94,3 +95,28 @@ async def test_register_jsonschema_async_fix_schema_name( ) assert result.uri == "syn123.456" + + +@pytest.mark.parametrize( + "name, expected_fixed_name", + [ + ("name", "name"), + ("name.name", "name.name"), + ("name..name", "name.name"), + ("name-name", "name.name"), + ("name--name", "name.name"), + ("name_name", "name.name"), + ("name-_name", "name.name"), + ], + ids=[ + "No special characters", + "One period", + "Multiple periods", + "One dash", + "Multiple dashes", + "Underscore", + "Mixed special characters", + ], +) +def test_fix_name(name, expected_fixed_name): + assert fix_name(name) == expected_fixed_name From 212d7c3970902f2436b1735bbbb68c13fca1a05d Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 25 Feb 2026 09:55:16 -0800 Subject: [PATCH 7/8] update docs --- docs/tutorials/command_line_client.md | 14 ++++++------- docs/tutorials/python/schema_operations.md | 21 +++++++++++-------- .../tutorial_scripts/schema_operations.py | 1 + 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/tutorials/command_line_client.md b/docs/tutorials/command_line_client.md index 84da764a7..5cc7da890 100644 --- a/docs/tutorials/command_line_client.md +++ b/docs/tutorials/command_line_client.md @@ -569,13 +569,13 @@ Register a JSON Schema to a Synapse organization for later binding to entities. synapse register-json-schema [-h] [--schema-version VERSION] schema_path organization_name schema_name ``` -| Name | Type | Description | Default | -|-----------------------|------------|-------------------------------------------------------------------------------------|---------| -| `schema_path` | Positional | Path to the JSON schema file to register | | -| `organization_name` | Positional | Name of the organization to register the schema under | | -| `schema_name` | Positional | The name of the JSON schema | | -| `--schema-version` | Named | Version of the schema to register (e.g., '0.0.1'). If not specified, auto-generated | None | -| `--fix-schema-name` | Named | Replace dashes and underscores in the schema name with periods. | False | +| Name | Type | Description | Default | +|-----------------------|------------|--------------------------------------------------------------------------------------------------------|---------| +| `schema_path` | Positional | Path to the JSON schema file to register | | +| `organization_name` | Positional | Name of the organization to register the schema under | | +| `schema_name` | Positional | The name of the JSON schema | | +| `--schema-version` | Named | Version of the schema to register (e.g., '0.0.1'). If not specified, auto-generated | None | +| `--fix-schema-name` | Named | Replaces dashes and underscores with periods in the schema name ('my-schema_name' -> 'my.schema.name') | False | ### `bind-json-schema` diff --git a/docs/tutorials/python/schema_operations.md b/docs/tutorials/python/schema_operations.md index fc3c8e3b0..96b917af6 100644 --- a/docs/tutorials/python/schema_operations.md +++ b/docs/tutorials/python/schema_operations.md @@ -21,7 +21,7 @@ This tutorial uses the Python client as a library. To use the CLI tool, see the ## 1. Initial set up ```python -{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=1-18} +{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=1-28} ``` To 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, Create a JSON Schema ```python -{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=20-27} +{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=30-37} ``` You 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 Create multiple JSON Schema ```python -{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=30-36} +{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=40-46} ``` The `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. Create every JSON Schema ```python -{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=38-43} +{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=48-53} ``` If 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 Create a JSON Schema ```python -{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=45-51} +{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=55-61} ``` If 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 Create a JSON Schema ```python -{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=53-58} +{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=63-68} ``` If 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 Create a JSON Schema ```python -{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=60-66} +{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=70-76} ``` You can have Curator format the property names and valid values in the JSON Schema. This will remove whitespace and special characters. @@ -97,7 +97,7 @@ You can have Curator format the property names and valid values in the JSON Sche Once you've created a JSON Schema file, you can register it to a Synapse organization. ```python -{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=68-76} +{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=78-87} ``` The `register_jsonschema` function: @@ -105,13 +105,16 @@ The `register_jsonschema` function: - Registers it with the specified organization in Synapse - Returns the schema URI and a success message - You can optionally specify a version (e.g., "0.0.1") or let it auto-generate +- The fix_schema_name argument replaces dashes and underscores with periods in the schema name + - 'my-schema_name' -> 'my.schema.name' + - defaults to False ## 9. Bind a JSON Schema to a Synapse Entity After registering a schema, you can bind it to Synapse entities (files, folders, etc.) for metadata validation. ```python -{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=78-85} +{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=89-96} ``` The `bind_jsonschema` function: diff --git a/docs/tutorials/python/tutorial_scripts/schema_operations.py b/docs/tutorials/python/tutorial_scripts/schema_operations.py index 419ae08a4..09df80c82 100644 --- a/docs/tutorials/python/tutorial_scripts/schema_operations.py +++ b/docs/tutorials/python/tutorial_scripts/schema_operations.py @@ -82,6 +82,7 @@ schema_name=SCHEMA_NAME, schema_version=SCHEMA_VERSION, synapse_client=syn, + fix_schema_name=True, ) print(f"Registered schema URI: {json_schema.uri}") From 6f049b6686564e7b444ff7c43e623214c2ee30eb Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 25 Feb 2026 13:07:15 -0800 Subject: [PATCH 8/8] fix doc list --- docs/tutorials/python/schema_operations.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/tutorials/python/schema_operations.md b/docs/tutorials/python/schema_operations.md index 96b917af6..7647c3f3f 100644 --- a/docs/tutorials/python/schema_operations.md +++ b/docs/tutorials/python/schema_operations.md @@ -101,13 +101,12 @@ Once you've created a JSON Schema file, you can register it to a Synapse organiz ``` The `register_jsonschema` function: -- Takes a path to your generated JSON Schema file -- Registers it with the specified organization in Synapse -- Returns the schema URI and a success message -- You can optionally specify a version (e.g., "0.0.1") or let it auto-generate -- The fix_schema_name argument replaces dashes and underscores with periods in the schema name - - 'my-schema_name' -> 'my.schema.name' - - defaults to False + +* Takes a path to your generated JSON Schema file +* Registers it with the specified organization in Synapse +* Returns the schema URI and a success message +* Optionally takes a version (e.g., "0.0.1"), otherwise it will increment to the next available version +* Optionally Fixes the schema name by replacing dashes and underscores with periods in the schema name (e.g.'my-schema_name' -> 'my.schema.name') ## 9. Bind a JSON Schema to a Synapse Entity