Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

JSON Schemas are an experimental feature in Synapse. Functionality in the web UI and programmatic clients is currently limited, but we have plans to improve support for managing organizations, schemas, and annotations in the near future.

JSON Schemas and Annotations

JSON Schema is a tool used to validate data. In Synapse, JSON Schemas can be used to validate the metadata applied to a project, file, folder, table, or view, including the Annotations applied to it. To learn more about JSON Schemas, check out JSON-Schema.org.

...

  • When the metadata or schema changes, the metadata is automatically validated against the applied JSON schema.

  • (Experimental Mode only) In the web UI, a custom form is shown when editing Annotations to help write Annotations that match the bound schema.

Organizations

JSON Schemas are managed by Organizations. At this time, Organizations must be created via a programmatic client or REST API call.

...

Code Block
languagepy
organizationName = "SynapseDocs"

organizationRequestBody = f"{{ \"organizationName\": \"{organizationName}\"}}"

organization = syn.restPOST("/schema/organization", organizationRequestBody)

Create a JSON Schema

Once you’ve created an Organization, you can create a JSON Schema. We’ll create a simple schema that specifies an annotation called “color”. Note that you will have to modify the organization name in the schema $id to successfully create your own schema.

...

When you bind a JSON schema to an object, you can choose to bind a particular version of the schema to prevent updates to the schema from applying to the object.

Bind a JSON Schema to an Object

You can bind a JSON Schema to any project, folder, file, table, or view. When you bind a JSON Schema to a project or folder, then all items inside of the project or folder will inherit the schema binding, unless the item has a schema bound to itself. Only one schema can be bound to an item at a time.

Bound schema inheritance is similar to Sharing Settings inheritance, but is tracked separately.

...

Even though only one schema can be applied to an item, you can use JSON schema references to create a schema composed of multiple sub-schemas.

Annotate an Object with a Schema

At the bottom of the page, ensure that Experimental Mode is toggled on. This may cause issues with other Synapse features that you use in your workflow.

...