From 7658f5937ad14147eb2346422e5db4d69c3c33a8 Mon Sep 17 00:00:00 2001 From: Scott Christley Date: Mon, 4 Dec 2023 20:34:06 -0600 Subject: [PATCH] functions for CURIE --- lang/js/schema.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lang/js/schema.js b/lang/js/schema.js index b822cf1bb..6ee5fa545 100644 --- a/lang/js/schema.js +++ b/lang/js/schema.js @@ -52,6 +52,11 @@ module.exports = function(airr, schema) { //console.log('airr-js schema:', JSON.stringify(schema, null, 2)); airr.Schema = {"specification": schema}; + airr.get_specification = function() { + if (!airr.Schema) throw new Error('AIRR schema is not loaded.'); + return airr.Schema['specification']; + } + // return schemas in format appropriate for API doc airr.get_schemas = function() { if (! airr.Schema['specification']) return null; @@ -73,6 +78,16 @@ module.exports = function(airr, schema) { return airr.Schema['specification']['Info']; } + airr.get_curie_map = function() { + if (!airr.Schema) throw new Error('AIRR schema is not loaded.'); + return airr.Schema['specification']['CURIEMap']; + } + + airr.get_iri_providers = function() { + if (!airr.Schema) throw new Error('AIRR schema is not loaded.'); + return airr.Schema['specification']['InformationProvider']; + } + airr.SchemaDefinition = function(definition) { if (!airr.Schema) throw new Error('AIRR schema is not loaded.');