Skip to contents

Unbind the JSON schema bound to the entity.

Usage

synUnbindSchema(instance, synapse_client=NULL)

Arguments

instance

(Project) The Project instance to operate on.

synapse_client

(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used.

Value

NULL

Examples

if (FALSE) { # \dontrun{
## Using this function
    # Unbinding a JSON schema from a project. This example demonstrates
    # how to remove a schema binding from an entity. Assumes the entity
    # already has a schema bound. Set the PROJECT_NAME variable to your
    # project name.
    library(synapser)
    synLogin()

    # Define Project and JSON schema info
    PROJECT_NAME = "test_json_schema_project"  # replace with your project name

    PROJECT_ID = synFindEntityId(name = PROJECT_NAME)
    ORG_NAME = "UniqueOrg"  # replace with your organization name
    SCHEMA_NAME = "myTestSchema"  # replace with your schema name
    VERSION = "0.0.1"
    SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION)

    # Create the organization and JSON schema used in this example.
    my_test_org = Organization(name = ORG_NAME) |> synStore()

    schema_definition = list(
        "$id" = "mySchema",
        type = "object",
        properties = list(
            foo = list(type = "string"),
            bar = list(type = "integer")
        ),
        required = list("foo")
    )
    test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore(
        json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION)
    )

    # Get the test project
    test_project = Project(id = PROJECT_ID)

    # Bind JSON schema to the project first
    bound_schema = test_project |> synBindSchema(
        json_schema_uri = SCHEMA_URI,
        enable_derived_annotations = TRUE
    )
    cat("Bound schema to project:\n")
    bound_schema

    # Unbind the schema from the project
    test_project |> synUnbindSchema()
    cat("Successfully unbound schema from project\n")
} # }