Skip to content

Commit

Permalink
Add schema binding feature
Browse files Browse the repository at this point in the history
  • Loading branch information
anngvu committed Sep 3, 2024
1 parent 14f6c81 commit 1eb676a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions R/new_project.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,21 @@ new_project <- function(name,

# Create default upper-level folders
folders <- add_default_folders(project)
data_folder <- folders[["Raw Data"]]
data_folder_id <- folders[["Raw Data"]]$properties$id

# Bind JSON schema so children folders have NF's dataset schemas, see
# https://repo-prod.prod.sagebase.org/repo/v1/schema/type/registered/org.synapse.nf-superdataset
# and https://help.synapse.org/docs/JSON-Schemas.3107291536.html
bind_schema_request <- jsonlite::toJSON(list(entityId = data_folder_id,
`schema$id` = "org.synapse.nf-superdataset",
enableDerivedAnnotations = TRUE),
auto_unbox = TRUE)
binding_uri <- glue::glue("https://repo-prod.prod.sagebase.org/repo/v1/entity/{data_folder_id}/schema/binding")
try(.syn$restPUT(binding_uri, bind_schema_request))

# Create data-specific folders in "Raw Data"
if(length(datasets)) {
make_folder(parent = data_folder$properties$id, folders = datasets)
make_folder(parent = data_folder_id, folders = datasets)
}

# Create homes for non-data resources alongside "Raw Data"
Expand Down

0 comments on commit 1eb676a

Please sign in to comment.