From 0a3d1c6260ea1b9bc801ca02a45608104941b75d Mon Sep 17 00:00:00 2001 From: Omesi Abulu Date: Thu, 8 Dec 2022 11:20:15 -0500 Subject: [PATCH 1/3] Code checkin. Methods seem to look good tests are passing. --- common/openapi.yml | 197 ++++++++++++++ service/src/main/resources/api/schema.json | 243 ++++++++++++++++++ .../resources/schema/development/example.json | 192 ++++++++++++++ .../resources/schema/development/schema.json | 2 +- 4 files changed, 633 insertions(+), 1 deletion(-) create mode 100644 service/src/main/resources/api/schema.json create mode 100644 service/src/main/resources/schema/development/example.json diff --git a/common/openapi.yml b/common/openapi.yml index 40a22a83..bdaeffe3 100644 --- a/common/openapi.yml +++ b/common/openapi.yml @@ -106,6 +106,202 @@ paths: application/json: schema: type: string + examples: + jsonObject: + summary: A sample object + value: '{ + "dct:title": "sint", + "dct:description": "officia dolor et dolor", + "dct:creator": "voluptate exercitation Ut cillum", + "dct:issued": "1996-08-17T19:54:24.0Z", + "TerraDCAT_ap:hasDataCollection": [ + { + "dct:publisher": "Duis", + "dct:issued": "1960-12-29T23:38:51.0Z", + "dct:creator": "in irure dolor in non", + "dct:modified": "1949-02-20T01:48:05.0Z", + "dct:identifier": "qui laboris in", + "dct:title": "dolore Duis" + }, + { + "dct:publisher": "proident eu in amet sed", + "dct:creator": "ut amet eu elit", + "dct:issued": "1945-04-14T01:25:37.0Z", + "dct:title": "consectetur anim adipisicing", + "dct:description": "amet labore do incididunt id", + "dct:identifier": "cupidatat", + "dct:modified": "1979-06-08T11:47:09.0Z" + }, + { + "dct:title": "adipisicing mollit qui", + "dct:identifier": "ad labore dolore enim aliquip", + "dct:issued": "1954-06-17T13:05:40.0Z", + "anim_d87": true + } + ], + "dcat:accessURL": "cillum mollit", + "storage": [ + { + "cloudPlatform": "azure", + "laboris_a": 46232158.70534593, + "ex25": -77142789.36118478 + }, + { + "deserunt_8ed": false, + "voluptate_a8": false, + "veniam_d": 16463225.891367823 + } + ], + "counts": { + "samples": -44514847, + "donors": 83785293, + "files": 36174655 + }, + "contributors": [ + { + "email": "anim in dolor", + "additionalInformation": { + "doloreb": -41708022, + "do_3": "non elit esse officia" + }, + "name": "do ut magna in", + "ida": false, + "ut8e": 74800361 + }, + { + "additionalInformation": { + "et_eef": -34070171.25837757 + }, + "email": "in ea dolore in" + }, + { + "name": "eu eiusmod labore", + "email": "magna pariatur cupidatat in", + "additionalInformation": { + "mollit_3": 46544276.01068279 + }, + "anim_9": -44261677.03337054, + "mollit_8": -48392032 + }, + { + "name": "Excepteur consequat", + "additionalInformation": { + "anim_7b8": true, + "aliquip_7": "anim labore reprehenderit quis", + "tempor_03": -84144440, + "Lorem4a": 23215743.30680622 + }, + "email": "non irure eiusmod", + "nostrud_3": "veniam", + "est_b": true, + "ut_27": -83762846.0241488, + "Duis_e": "quis" + } + ], + "TerraDCAT_ap:hasGenomicDataType": [ + "elit fugiat eu nostrud" + ], + "TerraDCAT_ap:hasOwner": "non dolor eu ut voluptate", + "TerraDCAT_ap:hasPublication": [ + { + "dcat:accessURL": "incididunt eu amet adipisicing occaecat", + "dct:title": "quis laboris" + }, + { + "dct:title": "Duis consequat dolor", + "dcat:accessURL": "quis", + "aliqua_5": "cupidatat minim ea eiusmod occaecat" + } + ], + "prov:wasAssociatedWith": [ + "velit", + "esse ea" + ], + "samples": { + "eiusmod_e1_": false, + "reprehenderit_2": true + }, + "TerraDCAT_ap:hasConsentGroup": "qui adipisicing consectetur ut", + "TerraDCAT_ap:hasCustodian": [ + "sint mollit id cupidatat dolor", + "sit non dolor ut officia" + ], + "TerraDCAT_ap:hasOriginalPublication": { + "dct:title": "ad amet", + "amet783": true, + "doloree40": 88647167 + }, + "fileAggregate": [ + { + "byteSize": 31285755, + "TerraCore:hasFileFormat": "nisi", + "count": 8911265, + "anim9": "nulla aliqua Ut sed", + "dolore83a": -50706848.01385088, + "dolor8": 73959962.60321835, + "Excepteur43": 63858776, + "in276": true + }, + { + "count": 15916179, + "TerraCore:hasFileFormat": "eiusmod", + "byteSize": -24580801, + "est_75": "Ut in amet velit" + }, + { + "TerraCore:hasFileFormat": "irure do", + "byteSize": -79723165, + "count": 36351881 + }, + { + "TerraCore:hasFileFormat": "Lorem", + "byteSize": -37260619, + "count": -26071485 + } + ], + "TerraDCAT_ap:hasDataUsePermission": "DUO:0000011", + "requestAccessURL": "commodo", + "TerraCoreValueSets:SampleType": [ + "fugiat in enim", + "pariatur ut nostrud" + ], + "prov:wasGeneratedBy": [ + { + "TerraCore:hasAssayCategory": [ + "deserunt id", + "sint aute Duis dolore", + "eu", + "dolor quis ipsum ullamco" + ], + "TerraCore:hasDataModality": [ + "consequat Duis sunt", + "laborum consequat enim eiusmod veniam", + "ea est in nisi ut", + "proident mollit Excepteur commodo occaecat", + "velit sunt exercitation ad" + ] + }, + { + "aliqua3": 81242364, + "laboris5a": "occaecat" + }, + { + "TerraCore:hasAssayCategory": [ + "cupidatat", + "consectetur proident dolor", + "velit adipisicing", + "sunt ex irure cillum", + "enim voluptate cillum" + ], + "TerraCore:hasDataModality": [ + "quis reprehenderit magna", + "ullamco in ut qui sed", + "exercitation dolore fugiat Excepteur" + ] + } + ] +} +' required: true responses: 204: @@ -372,6 +568,7 @@ components: DatasetPreviewTablesResponse: type: object properties: + tables: type: array items: diff --git a/service/src/main/resources/api/schema.json b/service/src/main/resources/api/schema.json new file mode 100644 index 00000000..8ae99bca --- /dev/null +++ b/service/src/main/resources/api/schema.json @@ -0,0 +1,243 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://app.terra.bio/schemas/datacatalog.development.json", + "title": "catalog dataset", + "type": "object", + "required": ["dct:title", "dct:description", "dct:creator", "dct:issued", "TerraDCAT_ap:hasDataCollection", "dcat:accessURL", "storage", "counts", "contributors"], + "properties": { + "TerraCore:id": { + "type": "string", + "description": "A generated identifier provided by the data catalog" + }, + "dct:title": { + "type": "string", + "description": "A user provided title for the dataset" + }, + "dct:description": { + "type": "string", + "description": "A user provided description for the dataset" + }, + "dct:creator": { + "type": "string" + }, + "dct:issued": { + "type": "string", + "format": "date-time", + "description": "The date and time the dataset was created." + }, + "dct:modified": { + "type": "string", + "format": "date-time", + "description": "The date and time the dataset was last modified" + }, + "dcat:accessURL": { + "type": "string", + "description": "A URL to the dataset in the underlying storage system" + }, + "requestAccessURL": { + "type": "string" + }, + "TerraDCAT_ap:hasDataUsePermission": { + "description": "Full List taken from https://www.ebi.ac.uk/ols/ontologies/duo/terms?iri=http://purl.obolibrary.org/obo/DUO_0000001", + "enum": ["DUO:0000007", "DUO:0000042", "DUO:0000006", "DUO:0000011", "DUO:0000004"] + }, + "TerraDCAT_ap:hasOriginalPublication": { + "$ref": "#/$defs/publication" + }, + "TerraDCAT_ap:hasPublication": { + "type": "array", + "items": { "$ref": "#/$defs/publication" } + }, + "TerraDCAT_ap:hasDataCollection": { + "type": "array", + "items": { "$ref": "#/$defs/dataCollection" } + }, + "TerraDCAT_ap:hasOwner": { + "type": "string", + "description": "The entity responsible for making the item available and responsible for identifying authorized users of the Dataset or DataCollection." + }, + "TerraDCAT_ap:hasCustodian": { + "type": "array", + "items": { "type": "string" } + }, + "TerraDCAT_ap:hasConsentGroup": { + "type": "string", + "description": "A reference to the consent group for datasets not yet using the Data Use Ontology; data use permission and data use modifier supersede this value if they are present." + }, + "TerraCoreValueSets:SampleType": { + "type": "array", + "items": { "type": "string" } + }, + "prov:wasAssociatedWith": { + "type": "array", + "items": { "type": "string" } + }, + "prov:wasGeneratedBy": { + "type": "array", + "items": { "$ref": "#/$defs/generatedBy" }, + "description": "Used to determine assay and data modality." + }, + "TerraDCAT_ap:hasGenomicDataType": { + "type": "array", + "items": { "type": "string" } + }, + "TerraDCAT_ap:hasPhenotypeDataType": { + "type": "array", + "items": { "type": "string" } + }, + "storage": { + "type": "array", + "items": { "$ref": "#/$defs/storageObject" } + }, + "counts": { + "type": "object", + "$ref": "#/$defs/counts" + }, + "fileAggregate": { + "type": "array", + "items": { "$ref": "#/$defs/fileTypeCounts" } + }, + "samples": { + "type": "object", + "ref": "#/$defs/samples" + }, + "contributors": { + "type": "array", + "items": { "$ref": "#/$defs/contributor" } + } + }, + "$defs": { + "publication": { + "type": "object", + "properties": { + "dct:title": { + "type": "string", + "description": "The name of the publication" + }, + "dcat:accessURL": { + "type": "string", + "description": "The URL to access the publication" + } + } + }, + "dataCollection": { + "type": "object", + "properties": { + "dct:identifier": { + "type": "string", + "description": "The identifier for the data collection" + }, + "dct:title": { + "type": "string", + "description": "The name of the data collection" + }, + "dct:description": { + "type": "string", + "description": "A description of the data collection" + }, + "dct:creator": { + "type": "string" + }, + "dct:publisher": { + "type": "string", + "description": "The name of the publisher" + }, + "dct:issued": { + "type": "string", + "format": "date-time", + "description": "The date and time the publisher was created." + }, + "dct:modified": { + "type": "string", + "format": "date-time", + "description": "The date and time the publisher was last modified" + } + } + }, + "generatedBy": { + "type": "object", + "properties": { + "TerraCore:hasAssayCategory": { + "type": "array", + "items": { "type": "string" } + }, + "TerraCore:hasDataModality": { + "type": "array", + "items": { "type": "string" } + } + } + }, + "storageObject": { + "type": "object", + "properties": { + "region": { + "enum": ["southamerica-west1", "us-central1", "us-east1", "us-east4", "us-west1", "us-west4", "europe-north1", "europe-west1", "europe-west4", "asia-east1", "asia-southeast1"] + }, + "cloudResource": { + "enum": ["bigquery", "firestore", "bucket"] + }, + "cloudPlatform": { + "enum": ["gcp", "azure"] + } + } + }, + "counts": { + "type": "object", + "properties": { + "donors": { + "type": "integer" + }, + "samples": { + "type": "integer" + }, + "files": { + "type": "integer" + } + } + }, + "fileTypeCounts": { + "type": "object", + "properties": { + "TerraCore:hasFileFormat": { + "type": "string", + "description":"An indication of the format of an electronic file; include the full file extension including compression extensions." + }, + "byteSize": { + "type": "integer" + }, + "count": { + "type": "integer" + } + } + }, + "samples": { + "type": "object", + "properties": { + "disease": { + "type": "array", + "items": { "type": "string" }, + "description": "see https://tinyurl.com/bdf6b23x for disease ontology" + }, + "species": { + "type": "array", + "items": { "type": "string" }, + "description": "see https://tinyurl.com/4hs8mt98 for species ontology" + } + } + }, + "contributor": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "additionalInformation": { + "type": "object" + } + } + } + } +} diff --git a/service/src/main/resources/schema/development/example.json b/service/src/main/resources/schema/development/example.json new file mode 100644 index 00000000..49c66a36 --- /dev/null +++ b/service/src/main/resources/schema/development/example.json @@ -0,0 +1,192 @@ +{ + "dct:title": "sint", + "dct:description": "officia dolor et dolor", + "dct:creator": "voluptate exercitation Ut cillum", + "dct:issued": "1996-08-17T19:54:24.0Z", + "TerraDCAT_ap:hasDataCollection": [ + { + "dct:publisher": "Duis", + "dct:issued": "1960-12-29T23:38:51.0Z", + "dct:creator": "in irure dolor in non", + "dct:modified": "1949-02-20T01:48:05.0Z", + "dct:identifier": "qui laboris in", + "dct:title": "dolore Duis" + }, + { + "dct:publisher": "proident eu in amet sed", + "dct:creator": "ut amet eu elit", + "dct:issued": "1945-04-14T01:25:37.0Z", + "dct:title": "consectetur anim adipisicing", + "dct:description": "amet labore do incididunt id", + "dct:identifier": "cupidatat", + "dct:modified": "1979-06-08T11:47:09.0Z" + }, + { + "dct:title": "adipisicing mollit qui", + "dct:identifier": "ad labore dolore enim aliquip", + "dct:issued": "1954-06-17T13:05:40.0Z", + "anim_d87": true + } + ], + "dcat:accessURL": "cillum mollit", + "storage": [ + { + "cloudPlatform": "azure", + "laboris_a": 46232158.70534593, + "ex25": -77142789.36118478 + }, + { + "deserunt_8ed": false, + "voluptate_a8": false, + "veniam_d": 16463225.891367823 + } + ], + "counts": { + "samples": -44514847, + "donors": 83785293, + "files": 36174655 + }, + "contributors": [ + { + "email": "anim in dolor", + "additionalInformation": { + "doloreb": -41708022, + "do_3": "non elit esse officia" + }, + "name": "do ut magna in", + "ida": false, + "ut8e": 74800361 + }, + { + "additionalInformation": { + "et_eef": -34070171.25837757 + }, + "email": "in ea dolore in" + }, + { + "name": "eu eiusmod labore", + "email": "magna pariatur cupidatat in", + "additionalInformation": { + "mollit_3": 46544276.01068279 + }, + "anim_9": -44261677.03337054, + "mollit_8": -48392032 + }, + { + "name": "Excepteur consequat", + "additionalInformation": { + "anim_7b8": true, + "aliquip_7": "anim labore reprehenderit quis", + "tempor_03": -84144440, + "Lorem4a": 23215743.30680622 + }, + "email": "non irure eiusmod", + "nostrud_3": "veniam", + "est_b": true, + "ut_27": -83762846.0241488, + "Duis_e": "quis" + } + ], + "TerraDCAT_ap:hasGenomicDataType": [ + "elit fugiat eu nostrud" + ], + "TerraDCAT_ap:hasOwner": "non dolor eu ut voluptate", + "TerraDCAT_ap:hasPublication": [ + { + "dcat:accessURL": "incididunt eu amet adipisicing occaecat", + "dct:title": "quis laboris" + }, + { + "dct:title": "Duis consequat dolor", + "dcat:accessURL": "quis", + "aliqua_5": "cupidatat minim ea eiusmod occaecat" + } + ], + "prov:wasAssociatedWith": [ + "velit", + "esse ea" + ], + "samples": { + "eiusmod_e1_": false, + "reprehenderit_2": true + }, + "TerraDCAT_ap:hasConsentGroup": "qui adipisicing consectetur ut", + "TerraDCAT_ap:hasCustodian": [ + "sint mollit id cupidatat dolor", + "sit non dolor ut officia" + ], + "TerraDCAT_ap:hasOriginalPublication": { + "dct:title": "ad amet", + "amet783": true, + "doloree40": 88647167 + }, + "fileAggregate": [ + { + "byteSize": 31285755, + "TerraCore:hasFileFormat": "nisi", + "count": 8911265, + "anim9": "nulla aliqua Ut sed", + "dolore83a": -50706848.01385088, + "dolor8": 73959962.60321835, + "Excepteur43": 63858776, + "in276": true + }, + { + "count": 15916179, + "TerraCore:hasFileFormat": "eiusmod", + "byteSize": -24580801, + "est_75": "Ut in amet velit" + }, + { + "TerraCore:hasFileFormat": "irure do", + "byteSize": -79723165, + "count": 36351881 + }, + { + "TerraCore:hasFileFormat": "Lorem", + "byteSize": -37260619, + "count": -26071485 + } + ], + "TerraDCAT_ap:hasDataUsePermission": "DUO:0000011", + "requestAccessURL": "commodo", + "TerraCoreValueSets:SampleType": [ + "fugiat in enim", + "pariatur ut nostrud" + ], + "prov:wasGeneratedBy": [ + { + "TerraCore:hasAssayCategory": [ + "deserunt id", + "sint aute Duis dolore", + "eu", + "dolor quis ipsum ullamco" + ], + "TerraCore:hasDataModality": [ + "consequat Duis sunt", + "laborum consequat enim eiusmod veniam", + "ea est in nisi ut", + "proident mollit Excepteur commodo occaecat", + "velit sunt exercitation ad" + ] + }, + { + "aliqua3": 81242364, + "laboris5a": "occaecat" + }, + { + "TerraCore:hasAssayCategory": [ + "cupidatat", + "consectetur proident dolor", + "velit adipisicing", + "sunt ex irure cillum", + "enim voluptate cillum" + ], + "TerraCore:hasDataModality": [ + "quis reprehenderit magna", + "ullamco in ut qui sed", + "exercitation dolore fugiat Excepteur" + ] + } + ] +} diff --git a/service/src/main/resources/schema/development/schema.json b/service/src/main/resources/schema/development/schema.json index fc250833..8ae99bca 100644 --- a/service/src/main/resources/schema/development/schema.json +++ b/service/src/main/resources/schema/development/schema.json @@ -103,7 +103,7 @@ }, "contributors": { "type": "array", - "items": { "$ref": "#/defs/contributor" } + "items": { "$ref": "#/$defs/contributor" } } }, "$defs": { From a7a890b70d44d5e79cec9356de4485248abb6bb1 Mon Sep 17 00:00:00 2001 From: Omesi Abulu Date: Wed, 14 Dec 2022 11:13:57 -0500 Subject: [PATCH 2/3] Code checkin. Methods seem to look good tests are passing. --- common/openapi.yml | 195 +------------- service/src/main/resources/api/schema.json | 243 ------------------ service/src/main/resources/application.yml | 2 +- .../src/main/resources/templates/index.html | 51 +++- 4 files changed, 51 insertions(+), 440 deletions(-) delete mode 100644 service/src/main/resources/api/schema.json diff --git a/common/openapi.yml b/common/openapi.yml index bdaeffe3..8439f7ba 100644 --- a/common/openapi.yml +++ b/common/openapi.yml @@ -109,199 +109,7 @@ paths: examples: jsonObject: summary: A sample object - value: '{ - "dct:title": "sint", - "dct:description": "officia dolor et dolor", - "dct:creator": "voluptate exercitation Ut cillum", - "dct:issued": "1996-08-17T19:54:24.0Z", - "TerraDCAT_ap:hasDataCollection": [ - { - "dct:publisher": "Duis", - "dct:issued": "1960-12-29T23:38:51.0Z", - "dct:creator": "in irure dolor in non", - "dct:modified": "1949-02-20T01:48:05.0Z", - "dct:identifier": "qui laboris in", - "dct:title": "dolore Duis" - }, - { - "dct:publisher": "proident eu in amet sed", - "dct:creator": "ut amet eu elit", - "dct:issued": "1945-04-14T01:25:37.0Z", - "dct:title": "consectetur anim adipisicing", - "dct:description": "amet labore do incididunt id", - "dct:identifier": "cupidatat", - "dct:modified": "1979-06-08T11:47:09.0Z" - }, - { - "dct:title": "adipisicing mollit qui", - "dct:identifier": "ad labore dolore enim aliquip", - "dct:issued": "1954-06-17T13:05:40.0Z", - "anim_d87": true - } - ], - "dcat:accessURL": "cillum mollit", - "storage": [ - { - "cloudPlatform": "azure", - "laboris_a": 46232158.70534593, - "ex25": -77142789.36118478 - }, - { - "deserunt_8ed": false, - "voluptate_a8": false, - "veniam_d": 16463225.891367823 - } - ], - "counts": { - "samples": -44514847, - "donors": 83785293, - "files": 36174655 - }, - "contributors": [ - { - "email": "anim in dolor", - "additionalInformation": { - "doloreb": -41708022, - "do_3": "non elit esse officia" - }, - "name": "do ut magna in", - "ida": false, - "ut8e": 74800361 - }, - { - "additionalInformation": { - "et_eef": -34070171.25837757 - }, - "email": "in ea dolore in" - }, - { - "name": "eu eiusmod labore", - "email": "magna pariatur cupidatat in", - "additionalInformation": { - "mollit_3": 46544276.01068279 - }, - "anim_9": -44261677.03337054, - "mollit_8": -48392032 - }, - { - "name": "Excepteur consequat", - "additionalInformation": { - "anim_7b8": true, - "aliquip_7": "anim labore reprehenderit quis", - "tempor_03": -84144440, - "Lorem4a": 23215743.30680622 - }, - "email": "non irure eiusmod", - "nostrud_3": "veniam", - "est_b": true, - "ut_27": -83762846.0241488, - "Duis_e": "quis" - } - ], - "TerraDCAT_ap:hasGenomicDataType": [ - "elit fugiat eu nostrud" - ], - "TerraDCAT_ap:hasOwner": "non dolor eu ut voluptate", - "TerraDCAT_ap:hasPublication": [ - { - "dcat:accessURL": "incididunt eu amet adipisicing occaecat", - "dct:title": "quis laboris" - }, - { - "dct:title": "Duis consequat dolor", - "dcat:accessURL": "quis", - "aliqua_5": "cupidatat minim ea eiusmod occaecat" - } - ], - "prov:wasAssociatedWith": [ - "velit", - "esse ea" - ], - "samples": { - "eiusmod_e1_": false, - "reprehenderit_2": true - }, - "TerraDCAT_ap:hasConsentGroup": "qui adipisicing consectetur ut", - "TerraDCAT_ap:hasCustodian": [ - "sint mollit id cupidatat dolor", - "sit non dolor ut officia" - ], - "TerraDCAT_ap:hasOriginalPublication": { - "dct:title": "ad amet", - "amet783": true, - "doloree40": 88647167 - }, - "fileAggregate": [ - { - "byteSize": 31285755, - "TerraCore:hasFileFormat": "nisi", - "count": 8911265, - "anim9": "nulla aliqua Ut sed", - "dolore83a": -50706848.01385088, - "dolor8": 73959962.60321835, - "Excepteur43": 63858776, - "in276": true - }, - { - "count": 15916179, - "TerraCore:hasFileFormat": "eiusmod", - "byteSize": -24580801, - "est_75": "Ut in amet velit" - }, - { - "TerraCore:hasFileFormat": "irure do", - "byteSize": -79723165, - "count": 36351881 - }, - { - "TerraCore:hasFileFormat": "Lorem", - "byteSize": -37260619, - "count": -26071485 - } - ], - "TerraDCAT_ap:hasDataUsePermission": "DUO:0000011", - "requestAccessURL": "commodo", - "TerraCoreValueSets:SampleType": [ - "fugiat in enim", - "pariatur ut nostrud" - ], - "prov:wasGeneratedBy": [ - { - "TerraCore:hasAssayCategory": [ - "deserunt id", - "sint aute Duis dolore", - "eu", - "dolor quis ipsum ullamco" - ], - "TerraCore:hasDataModality": [ - "consequat Duis sunt", - "laborum consequat enim eiusmod veniam", - "ea est in nisi ut", - "proident mollit Excepteur commodo occaecat", - "velit sunt exercitation ad" - ] - }, - { - "aliqua3": 81242364, - "laboris5a": "occaecat" - }, - { - "TerraCore:hasAssayCategory": [ - "cupidatat", - "consectetur proident dolor", - "velit adipisicing", - "sunt ex irure cillum", - "enim voluptate cillum" - ], - "TerraCore:hasDataModality": [ - "quis reprehenderit magna", - "ullamco in ut qui sed", - "exercitation dolore fugiat Excepteur" - ] - } - ] -} -' + externalValue: 'schema.json' required: true responses: 204: @@ -568,7 +376,6 @@ components: DatasetPreviewTablesResponse: type: object properties: - tables: type: array items: diff --git a/service/src/main/resources/api/schema.json b/service/src/main/resources/api/schema.json deleted file mode 100644 index 8ae99bca..00000000 --- a/service/src/main/resources/api/schema.json +++ /dev/null @@ -1,243 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://app.terra.bio/schemas/datacatalog.development.json", - "title": "catalog dataset", - "type": "object", - "required": ["dct:title", "dct:description", "dct:creator", "dct:issued", "TerraDCAT_ap:hasDataCollection", "dcat:accessURL", "storage", "counts", "contributors"], - "properties": { - "TerraCore:id": { - "type": "string", - "description": "A generated identifier provided by the data catalog" - }, - "dct:title": { - "type": "string", - "description": "A user provided title for the dataset" - }, - "dct:description": { - "type": "string", - "description": "A user provided description for the dataset" - }, - "dct:creator": { - "type": "string" - }, - "dct:issued": { - "type": "string", - "format": "date-time", - "description": "The date and time the dataset was created." - }, - "dct:modified": { - "type": "string", - "format": "date-time", - "description": "The date and time the dataset was last modified" - }, - "dcat:accessURL": { - "type": "string", - "description": "A URL to the dataset in the underlying storage system" - }, - "requestAccessURL": { - "type": "string" - }, - "TerraDCAT_ap:hasDataUsePermission": { - "description": "Full List taken from https://www.ebi.ac.uk/ols/ontologies/duo/terms?iri=http://purl.obolibrary.org/obo/DUO_0000001", - "enum": ["DUO:0000007", "DUO:0000042", "DUO:0000006", "DUO:0000011", "DUO:0000004"] - }, - "TerraDCAT_ap:hasOriginalPublication": { - "$ref": "#/$defs/publication" - }, - "TerraDCAT_ap:hasPublication": { - "type": "array", - "items": { "$ref": "#/$defs/publication" } - }, - "TerraDCAT_ap:hasDataCollection": { - "type": "array", - "items": { "$ref": "#/$defs/dataCollection" } - }, - "TerraDCAT_ap:hasOwner": { - "type": "string", - "description": "The entity responsible for making the item available and responsible for identifying authorized users of the Dataset or DataCollection." - }, - "TerraDCAT_ap:hasCustodian": { - "type": "array", - "items": { "type": "string" } - }, - "TerraDCAT_ap:hasConsentGroup": { - "type": "string", - "description": "A reference to the consent group for datasets not yet using the Data Use Ontology; data use permission and data use modifier supersede this value if they are present." - }, - "TerraCoreValueSets:SampleType": { - "type": "array", - "items": { "type": "string" } - }, - "prov:wasAssociatedWith": { - "type": "array", - "items": { "type": "string" } - }, - "prov:wasGeneratedBy": { - "type": "array", - "items": { "$ref": "#/$defs/generatedBy" }, - "description": "Used to determine assay and data modality." - }, - "TerraDCAT_ap:hasGenomicDataType": { - "type": "array", - "items": { "type": "string" } - }, - "TerraDCAT_ap:hasPhenotypeDataType": { - "type": "array", - "items": { "type": "string" } - }, - "storage": { - "type": "array", - "items": { "$ref": "#/$defs/storageObject" } - }, - "counts": { - "type": "object", - "$ref": "#/$defs/counts" - }, - "fileAggregate": { - "type": "array", - "items": { "$ref": "#/$defs/fileTypeCounts" } - }, - "samples": { - "type": "object", - "ref": "#/$defs/samples" - }, - "contributors": { - "type": "array", - "items": { "$ref": "#/$defs/contributor" } - } - }, - "$defs": { - "publication": { - "type": "object", - "properties": { - "dct:title": { - "type": "string", - "description": "The name of the publication" - }, - "dcat:accessURL": { - "type": "string", - "description": "The URL to access the publication" - } - } - }, - "dataCollection": { - "type": "object", - "properties": { - "dct:identifier": { - "type": "string", - "description": "The identifier for the data collection" - }, - "dct:title": { - "type": "string", - "description": "The name of the data collection" - }, - "dct:description": { - "type": "string", - "description": "A description of the data collection" - }, - "dct:creator": { - "type": "string" - }, - "dct:publisher": { - "type": "string", - "description": "The name of the publisher" - }, - "dct:issued": { - "type": "string", - "format": "date-time", - "description": "The date and time the publisher was created." - }, - "dct:modified": { - "type": "string", - "format": "date-time", - "description": "The date and time the publisher was last modified" - } - } - }, - "generatedBy": { - "type": "object", - "properties": { - "TerraCore:hasAssayCategory": { - "type": "array", - "items": { "type": "string" } - }, - "TerraCore:hasDataModality": { - "type": "array", - "items": { "type": "string" } - } - } - }, - "storageObject": { - "type": "object", - "properties": { - "region": { - "enum": ["southamerica-west1", "us-central1", "us-east1", "us-east4", "us-west1", "us-west4", "europe-north1", "europe-west1", "europe-west4", "asia-east1", "asia-southeast1"] - }, - "cloudResource": { - "enum": ["bigquery", "firestore", "bucket"] - }, - "cloudPlatform": { - "enum": ["gcp", "azure"] - } - } - }, - "counts": { - "type": "object", - "properties": { - "donors": { - "type": "integer" - }, - "samples": { - "type": "integer" - }, - "files": { - "type": "integer" - } - } - }, - "fileTypeCounts": { - "type": "object", - "properties": { - "TerraCore:hasFileFormat": { - "type": "string", - "description":"An indication of the format of an electronic file; include the full file extension including compression extensions." - }, - "byteSize": { - "type": "integer" - }, - "count": { - "type": "integer" - } - } - }, - "samples": { - "type": "object", - "properties": { - "disease": { - "type": "array", - "items": { "type": "string" }, - "description": "see https://tinyurl.com/bdf6b23x for disease ontology" - }, - "species": { - "type": "array", - "items": { "type": "string" }, - "description": "see https://tinyurl.com/4hs8mt98 for species ontology" - } - } - }, - "contributor": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "additionalInformation": { - "type": "object" - } - } - } - } -} diff --git a/service/src/main/resources/application.yml b/service/src/main/resources/application.yml index c45456de..9811c92f 100644 --- a/service/src/main/resources/application.yml +++ b/service/src/main/resources/application.yml @@ -44,7 +44,7 @@ spring: maxAge: 0 mustRevalidate: true useLastModified: false - staticLocations: classpath:/api/ + staticLocations: classpath:/api/,classpath:/schema/development/ catalog: ingress: diff --git a/service/src/main/resources/templates/index.html b/service/src/main/resources/templates/index.html index 8a1c52d7..c87983f2 100644 --- a/service/src/main/resources/templates/index.html +++ b/service/src/main/resources/templates/index.html @@ -109,7 +109,53 @@ } }; } + // Examples map + const examples = {}; + // Custom plugin for logic that happens before the response element is created + const CustomPlugin = () => { + return { + wrapComponents: { + response: (Original, { React, oas3Actions, oas3Selectors }) => (props) => { + const contentType = oas3Selectors.responseContentType(props.path, props.method) + const externalValue = props.response.getIn(['content', contentType, 'examples', props.activeExamplesKey, 'externalValue']) + console.log(props.response) + // Check if externalValue field exists + if (externalValue) { + // Check if examples map already contains externalValue key + if (examples[externalValue]) { + // Set example value directly from examples map + props.response = props.response.setIn(['content', contentType, 'examples', props.activeExamplesKey, 'value'], examples[externalValue]) + } else { + // Download external file + fetch(externalValue) + .then(res => res.text()) + .then(data => { + // Put downloaded file content into the examples map + examples[externalValue] = data + // Simulate select another example action + oas3Actions.setActiveExamplesMember({ + "name": 'fake', + "pathMethod": [props.path, props.method], + "contextType": "responses", + "contextName": props.code + }) + // Reselect this example + oas3Actions.setActiveExamplesMember({ + "name": props.activeExamplesKey, + "pathMethod": [props.path, props.method], + "contextType": "responses", + "contextName": props.code + }) + }) + .catch(e => console.error(e)) + } + } + return React.createElement(Original, props) + } + } + } + } window.onload = function() { // Begin Swagger UI call region const ui = SwaggerUIBundle({ @@ -120,10 +166,11 @@ SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset ], + plugins: [ SwaggerUIBundle.plugins.DownloadUrl, - pinLoginPlugin, - clearValidator + clearValidator, + CustomPlugin ], layout: 'StandaloneLayout', displayOperationId: true, From 93ff2b35553bc9117f75fefa2027e7bf328fc49f Mon Sep 17 00:00:00 2001 From: Omesi Abulu Date: Wed, 14 Dec 2022 16:51:27 -0500 Subject: [PATCH 3/3] Code checkin. Methods seem to look good tests are passing. --- common/openapi.yml | 2 +- service/src/main/resources/templates/index.html | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/common/openapi.yml b/common/openapi.yml index 8439f7ba..1928feb7 100644 --- a/common/openapi.yml +++ b/common/openapi.yml @@ -109,7 +109,7 @@ paths: examples: jsonObject: summary: A sample object - externalValue: 'schema.json' + externalValue: 'https://localhost:8080/schema.json' required: true responses: 204: diff --git a/service/src/main/resources/templates/index.html b/service/src/main/resources/templates/index.html index c87983f2..072f2753 100644 --- a/service/src/main/resources/templates/index.html +++ b/service/src/main/resources/templates/index.html @@ -118,8 +118,7 @@ wrapComponents: { response: (Original, { React, oas3Actions, oas3Selectors }) => (props) => { const contentType = oas3Selectors.responseContentType(props.path, props.method) - const externalValue = props.response.getIn(['content', contentType, 'examples', props.activeExamplesKey, 'externalValue']) - console.log(props.response) + const externalValue = props.response.getIn(['content', props.contentType, 'examples', props.activeExamplesKey, 'externalValue']) // Check if externalValue field exists if (externalValue) { // Check if examples map already contains externalValue key