You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add schema management wrapper functions using OOP models
- Create schema_management.py with register_jsonschema and bind_jsonschema
- Export functions from curator extension __init__.py
* Update CLI commands to use OOP model wrapper functions
- Update register_json_schema to use register_jsonschema wrapper
- Update bind_json_schema to use bind_jsonschema wrapper
- Add register-json-schema CLI command with argparse configuration
* Add register-json-schema command to CLI documentation
- Add register-json-schema to table of contents
- Add complete command documentation with usage and parameters
- Document schema registration workflow
* Add register and bind examples to Python tutorial
- Update tutorial to cover complete JSON Schema workflow
- Add section 9: Register JSON Schema to Synapse
- Add section 10: Bind JSON Schema to entities
- Update tutorial script with register_jsonschema and bind_jsonschema examples
- Update imports and line references
* [test] Add unit tests for bind-json-schema CLI command
- Add test for argument parsing
- Add test for --enable-derived-annotations flag
- Add test for API call invocation
* [test] Fix bind-json-schema test to match new wrapper implementation
Update test to mock bind_jsonschema wrapper instead of asyncio.run,
and verify correct arguments are passed to the wrapper function.
* Use JSONSchema.uri instead of manually building URI
* Log success message in register_jsonschema instead of returning it
- Update register_jsonschema to log message and return only schema_uri
- Update CLI function to match new signature
- Update docstring and examples
* Return JSONSchema object instead of just URI string
- Update return type from str to JSONSchema
- Update docstring and examples to show accessing json_schema.uri
- Update tutorial script accordingly
* Remove unnecessary fallback logic in bind_jsonschema
* Add integration tests for schema management functions
Add comprehensive integration tests for register_jsonschema and bind_jsonschema
wrapper functions. Tests cover:
- Registering schemas with and without version
- Binding schemas to folders
- Enabling derived annotations
- Complete register + bind workflow
* Use new operations API instead of deprecated syn.get()
* Simplify return statement in bind_jsonschema
* [test]
Add integration tests for register-json-schema and bind-json-schema
CLI commands in test_command_line_client.py.
Tests cover:
- Registering a schema via CLI
- Binding a schema to an entity via CLI
- Complete workflow of register and bind operations
* Fix return type annotation for bind_jsonschema
* Remove comments from schema_manahement.py
* Remove verbose binding details from CLI output
* Simplify initial setup section in schema operations tutorial
* Update main.py
returning result
* [test] fixing import
* [test] removing assert fix
- previously tried to test if that the binding result contains entity information (like entityId or entity_id)
- result is a JSONSchemaBinding object (a Python class instance), not a dictionary
- just checking that the result is not none should be sufficient
* [test] changing clean up to finalizer
* [test] removing try/ except blocks
Now if cleanup fails, the test will fail
* [test] add schema unbinding before folder deletion
Add explicit schema unbinding before folder deletion to ensure schemas can be deleted (schemas cannot be deleted while bound - errors out)
* [test] refactor to reuse existing test_state fixture
- Remove SchemaState container class in favor of separate fixtures for schema_organization and schema_file.
- aligns with the existing test pattern where test_state provides the core Synapse client, project, and parser, while additional fixtures provide test-specific resources.
* [test] refactor
use class-scoped fixture, fix UUID naming, use addfinalizer
* [docs] moving hardcoded file paths to the top
* [test] syn.delete > project.delete
* Add Python 3.14 compatible async versions for schema management functions
- Add register_jsonschema_async and bind_jsonschema_async functions
- Refactor sync functions to use wrap_async_to_sync pattern
- Export async functions from curator __init__.py
* Apply suggestion from @thomasyu888
* Apply suggestions from code review
---------
Co-authored-by: Thomas Yu <thomas.yu@sagebase.org>
Copy file name to clipboardExpand all lines: docs/tutorials/python/schema_operations.md
+49-28Lines changed: 49 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,27 +2,26 @@ JSON Schema is a tool used to validate data. In Synapse, JSON Schemas can be use
2
2
3
3
Synapse supports a subset of features from [json-schema-draft-07](https://json-schema.org/draft-07). To see the list of features currently supported, see the [JSON Schema object definition](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/schema/JsonSchema.html) from Synapse's REST API Documentation.
4
4
5
-
In this tutorial, you will learn how to create these JSON Schema using an existing data model.
5
+
In this tutorial, you will learn how to create, register, and bind JSON Schemas using an existing data model.
6
6
7
7
## Tutorial Purpose
8
8
9
-
You will create a JSON schema from your data model using the Python client as a library. To use the CLI tool, see the [documentation](../command_line_client.md).
9
+
You will learn the complete JSON Schema workflow:
10
+
1.**Generate** JSON schemas from your data model
11
+
2.**Register** schemas to a Synapse organization
12
+
3.**Bind** schemas to Synapse entities for metadata validation
13
+
14
+
This tutorial uses the Python client as a library. To use the CLI tool, see the [command line documentation](../command_line_client.md).
10
15
11
16
## Prerequisites
12
17
13
18
* You have a working [installation](../installation.md) of the Synapse Python Client.
14
19
* You have a data model, see this [data model_documentation](../../explanations/curator_data_model.md).
0 commit comments