From f126896b7606906c9d8bc9fe6759f63b5e27962c Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 17 Apr 2019 12:01:59 +0200 Subject: [PATCH 1/6] update local spec files --- data/aquarius.json | 1033 ++++++++++++++++++++++---------------------- data/brizo.json | 306 +++++-------- 2 files changed, 615 insertions(+), 724 deletions(-) diff --git a/data/aquarius.json b/data/aquarius.json index d0f14b21..5288dcdb 100644 --- a/data/aquarius.json +++ b/data/aquarius.json @@ -1,532 +1,509 @@ { - "basePath":"/api/v1/aquarius", - "definitions":{ - + "definitions": {}, + "info": { + "description": "Aquarius provides an off-chain database store for metadata about data assets. When running with our Docker images, it is exposed under:`http://0.0.0.0:5000`.", + "title": "Aquarius", + "version": "0.2.2" }, - "host":"myfancyaquarius.com", - "info":{ - "description":"Aquarius provides an off-chain database store for metadata about data assets. When running with our Docker images, it is exposed under `http://localhost:5000`.", - "title":"Aquarius", - "version":"0.1.4" + "paths": { + "/api/v1/aquarius/assets": { + "get": { + "description": "", + "responses": { "200": { "description": "successful action" } }, + "summary": "Get all asset IDs.", + "tags": ["ddo"] + } + }, + "/api/v1/aquarius/assets/ddo": { + "delete": { + "description": "", + "responses": { + "200": { "description": "successfully deleted" }, + "500": { "description": "Error" } + }, + "summary": "Retire metadata of all the assets.", + "tags": ["ddo"] + }, + "get": { + "description": "", + "responses": { "200": { "description": "successful action" } }, + "summary": "Get DDO of all assets.", + "tags": ["ddo"] + }, + "post": { + "consumes": ["application/json"], + "description": "", + "parameters": [ + { + "description": "DDO of the asset.", + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "@context": { + "description": null, + "example": "https://w3id.org/future-method/v1", + "type": "string" + }, + "authentication": { + "description": "List of authentication mechanisms.", + "example": [ + { "type": "RsaSignatureAuthentication2018" }, + { "publicKey": "did:op:123456789abcdefghi#keys-1" } + ], + "type": "array" + }, + "created": { + "description": "date of ddo creation.", + "example": "2016-02-08T16:02:20Z", + "type": "string" + }, + "id": { + "description": "ID of the asset.", + "example": "did:op:123456789abcdefghi", + "type": "string" + }, + "proof": { + "description": "Information about the creation and creator of the asset.", + "example": { + "created": "2016-02-08T16:02:20Z", + "creator": "did:example:8uQhQMGzWxR8vw5P3UWH1ja", + "signatureValue": "QNB13Y7Q9...1tzjn4w==", + "type": "UUIDSignature" + }, + "type": "dictionary" + }, + "publicKey": { + "description": "List of public keys.", + "example": [ + { "id": "did:op:123456789abcdefghi#keys-1" }, + { "type": "Ed25519VerificationKey2018" }, + { "owner": "did:op:123456789abcdefghi" }, + { + "publicKeyBase58": "H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV" + } + ], + "type": "array" + }, + "service": { + "description": "List of services.", + "example": [ + { + "serviceEndpoint": "http://mybrizo.org/api/v1/brizo/services/consume?pubKey=${ pubKey}&serviceId={serviceId}&url={url}", + "type": "Access" + }, + { + "serviceEndpoint": "http://mybrizo.org/api/v1/brizo/services/compute?pubKey=${ pubKey}&serviceId={serviceId}&algo={algo}&container={container}", + "type": "Compute" + }, + { + "metadata": { + "additionalInformation": { + "structuredMarkup": [ + { + "mediaType": "application/ld+json", + "uri": "http://skos.um.es/unescothes/C01194/jsonld" + }, + { + "mediaType": "text/turtle", + "uri": "http://skos.um.es/unescothes/C01194/turtle" + } + ], + "updateFrecuency": "yearly" + }, + "base": { + "author": "Met Office", + "checksum": "38803b9e6f04fce3fba4b124524672592264d31847182c689095a081c9e85262", + "compression": "zip", + "copyrightHolder": "Met Office", + "dateCreated": "2012-02-01T10:55:11Z", + "description": "Weather information of UK including temperature and humidity", + "encryptedFiles": "0x098213xzckasdf089723hjgdasfkjgasfv", + "files": [ + { + "compression": "zip", + "contentLength": "4535431", + "contentType": "text/csv", + "encoding": "UTF-8", + "resourceId": "access-log2018-02-13-15-17-29-18386C502CAEA932" + } + ], + "inLanguage": "en", + "license": "CC-BY", + "links": [ + { + "name": "Sample of Asset Data", + "type": "sample", + "url": "https://foo.com/sample.csv" + }, + { + "AssetID": "4d517500da0acb0d65a716f61330969334630363ce4a6a9d39691026ac7908ea", + "name": "Data Format Definition", + "type": "format" + } + ], + "name": "UK Weather information 2011", + "price": 10, + "tags": "weather, uk, 2011, temperature, humidity", + "type": "dataset", + "workExample": "stationId,latitude,longitude,datetime, temperature,humidity/n423432fsd,51.509865,-0.118092, 2011-01-01T10:55:11+00:00,7.2,68" + }, + "curation": { + "numVotes": 123, + "rating": 0.93, + "schema": "Binary Voting" + } + }, + "serviceDefinitionId": "2", + "serviceEndpoint": "http://myaquarius.org/api/v1/provider/assets/metadata/{did}", + "type": "Metadata" + } + ], + "type": "array" + } + }, + "required": [ + "@context", + "id", + "created", + "publicKey", + "authentication", + "proof", + "service" + ], + "type": "object" + } + } + ], + "responses": { + "201": { "description": "Asset successfully registered." }, + "400": { + "description": "One of the required attributes is missing." + }, + "404": { "description": "Invalid asset data." }, + "500": { "description": "Error" } + }, + "summary": "Register DDO of a new asset", + "tags": ["ddo"] + } + }, + "/api/v1/aquarius/assets/ddo/query": { + "get": { + "description": "", + "parameters": [ + { + "description": "ID of the asset.", + "in": "query", + "name": "text", + "required": true, + "type": "string" + }, + { + "description": "Key or list of keys to sort the result", + "example": { "value": 1 }, + "in": "query", + "name": "sort", + "type": "object" + }, + { + "description": "Number of records per page", + "example": 100, + "in": "query", + "name": "offset", + "type": "int" + }, + { + "description": "Page showed", + "example": 1, + "in": "query", + "name": "page", + "type": "int" + } + ], + "responses": { "200": { "description": "successful action" } }, + "summary": "Get a list of DDOs that match with the given text.", + "tags": ["ddo"] + }, + "post": { + "consumes": ["application/json"], + "description": "", + "parameters": [ + { + "description": "Asset metadata.", + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "offset": { + "description": "Number of records per page", + "example": 100, + "type": "int" + }, + "page": { + "description": "Page showed", + "example": 1, + "type": "int" + }, + "query": { + "description": "Query to realize", + "example": { "value": 1 }, + "type": "string" + }, + "sort": { + "description": "Key or list of keys to sort the result", + "example": { "value": 1 }, + "type": "object" + } + }, + "type": "object" + } + } + ], + "responses": { "200": { "description": "successful action" } }, + "summary": "Get a list of DDOs that match with the executed query.", + "tags": ["ddo"] + } + }, + "/api/v1/aquarius/assets/ddo/validate": { + "post": { + "consumes": ["application/json"], + "description": "", + "parameters": [ + { + "description": "Asset metadata.", + "in": "body", + "name": "body", + "required": true, + "schema": { "type": "object" } + } + ], + "responses": { + "200": { "description": "successfully request." }, + "500": { "description": "Error" } + }, + "summary": "Validate metadata content.", + "tags": ["ddo"] + } + }, + "/api/v1/aquarius/assets/ddo/{did}": { + "delete": { + "description": "", + "parameters": [ + { + "description": "DID of the asset.", + "in": "path", + "name": "did", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { "description": "successfully deleted" }, + "404": { "description": "This asset DID is not in OceanDB" }, + "500": { "description": "Error" } + }, + "summary": "Retire metadata of an asset", + "tags": ["ddo"] + }, + "get": { + "description": "", + "parameters": [ + { + "description": "DID of the asset.", + "in": "path", + "name": "did", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { "description": "successful operation" }, + "404": { "description": "This asset DID is not in OceanDB" } + }, + "summary": "Get DDO of a particular asset.", + "tags": ["ddo"] + }, + "put": { + "consumes": ["application/json"], + "description": "", + "parameters": [ + { + "description": "DDO of the asset.", + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "@context": { + "description": null, + "example": "https://w3id.org/future-method/v1", + "type": "string" + }, + "authentication": { + "description": "List of authentication mechanisms.", + "example": [ + { "type": "RsaSignatureAuthentication2018" }, + { "publicKey": "did:op:123456789abcdefghi#keys-1" } + ], + "type": "array" + }, + "created": { + "description": "date of ddo creation.", + "example": "2016-02-08T16:02:20Z", + "type": "string" + }, + "id": { + "description": "ID of the asset.", + "example": "did:op:123456789abcdefghi", + "type": "string" + }, + "proof": { + "description": "Information about the creation and creator of the asset.", + "example": { + "created": "2016-02-08T16:02:20Z", + "creator": "did:example:8uQhQMGzWxR8vw5P3UWH1ja", + "signatureValue": "QNB13Y7Q9...1tzjn4w==", + "type": "UUIDSignature" + }, + "type": "dictionary" + }, + "publicKey": { + "description": "List of public keys.", + "example": [ + { "id": "did:op:123456789abcdefghi#keys-1" }, + { "type": "Ed25519VerificationKey2018" }, + { "owner": "did:op:123456789abcdefghi" }, + { + "publicKeyBase58": "H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV" + } + ], + "type": "array" + }, + "service": { + "description": "List of services.", + "example": [ + { + "serviceEndpoint": "http://mybrizo.org/api/v1/brizo/services/consume?pubKey=${ pubKey}&serviceId={serviceId}&url={url}", + "type": "Access" + }, + { + "serviceEndpoint": "http://mybrizo.org/api/v1/brizo/services/compute?pubKey=${ pubKey}&serviceId={serviceId}&algo={algo}&container={container}", + "type": "Compute" + }, + { + "metadata": { + "additionalInformation": { + "structuredMarkup": [ + { + "mediaType": "application/ld+json", + "uri": "http://skos.um.es/unescothes/C01194/jsonld" + }, + { + "mediaType": "text/turtle", + "uri": "http://skos.um.es/unescothes/C01194/turtle" + } + ], + "updateFrecuency": "yearly" + }, + "base": { + "author": "Met Office", + "checksum": "38803b9e6f04fce3fba4b124524672592264d31847182c689095a081c9e85262", + "compression": "zip", + "copyrightHolder": "Met Office", + "dateCreated": "2012-02-01T10:55:11Z", + "description": "Weather information of UK including temperature and humidity", + "encryptedFiles": "0x098213xzckasdf089723hjgdasfkjgasfv", + "files": [ + { + "compression": "zip", + "contentLength": "4535431", + "contentType": "text/csv", + "encoding": "UTF-8", + "resourceId": "access-log2018-02-13-15-17-29-18386C502CAEA932" + } + ], + "inLanguage": "en", + "license": "CC-BY", + "links": [ + { + "name": "Sample of Asset Data", + "type": "sample", + "url": "https://foo.com/sample.csv" + }, + { + "AssetID": "4d517500da0acb0d65a716f61330969334630363ce4a6a9d39691026ac7908ea", + "name": "Data Format Definition", + "type": "format" + } + ], + "name": "UK Weather information 2011", + "price": 10, + "tags": "weather, uk, 2011, temperature, humidity", + "type": "dataset", + "workExample": "stationId,latitude,longitude,datetime, temperature,humidity/n423432fsd,51.509865,-0.118092, 2011-01-01T10:55:11+00:00,7.2,68" + }, + "curation": { + "numVotes": 123, + "rating": 0.93, + "schema": "Binary Voting" + } + }, + "serviceDefinitionId": "2", + "serviceEndpoint": "http://myaquarius.org/api/v1/provider/assets/metadata/{did}", + "type": "Metadata" + } + ], + "type": "array" + } + }, + "required": [ + "@context", + "created", + "id", + "publicKey", + "authentication", + "proof", + "service" + ], + "type": "object" + } + } + ], + "responses": { + "200": { "description": "Asset successfully updated." }, + "201": { "description": "Asset successfully registered." }, + "400": { + "description": "One of the required attributes is missing." + }, + "404": { "description": "Invalid asset data." }, + "500": { "description": "Error" } + }, + "summary": "Update DDO of an existing asset", + "tags": ["ddo"] + } + }, + "/api/v1/aquarius/assets/metadata/{did}": { + "get": { + "description": "", + "parameters": [ + { + "description": "DID of the asset.", + "in": "path", + "name": "did", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { "description": "successful operation." }, + "404": { "description": "This asset DID is not in OceanDB." } + }, + "summary": "Get metadata of a particular asset", + "tags": ["metadata"] + } + } }, - "paths":{ - "/api/v1/aquarius/assets":{ - "get":{ - "description":"", - "responses":{ - "200":{ - "description":"successful action" - } - }, - "summary":"Get all asset IDs.", - "tags":[ - "ddo" - ] - } - }, - "/api/v1/aquarius/assets/ddo":{ - "get":{ - "description":"", - "responses":{ - "200":{ - "description":"successful action" - } - }, - "summary":"Get DDO of all assets.", - "tags":[ - "ddo" - ] - }, - "post":{ - "consumes":[ - "application/json" - ], - "description":"", - "parameters":[ - { - "description":"DDO of the asset.", - "in":"body", - "name":"body", - "required":true, - "schema":{ - "properties":{ - "@context":{ - "description":null, - "example":"https://w3id.org/future-method/v1", - "type":"string" - }, - "authentication":{ - "description":"List of authentication mechanisms.", - "example":[ - { - "type":"RsaSignatureAuthentication2018" - }, - { - "publicKey":"did:op:123456789abcdefghi#keys-1" - } - ], - "type":"array" - }, - "id":{ - "description":"ID of the asset.", - "example":"did:op:123456789abcdefghi", - "type":"string" - }, - "publicKey":{ - "description":"List of public keys.", - "example":[ - { - "id":"did:op:123456789abcdefghi#keys-1" - }, - { - "type":"Ed25519VerificationKey2018" - }, - { - "owner":"did:op:123456789abcdefghi" - }, - { - "publicKeyBase58":"H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV" - } - ], - "type":"array" - }, - "service":{ - "description":"List of services.", - "example":[ - { - "serviceEndpoint":"http://mybrizo.org/api/v1/brizo/services/consume?pubKey=${pubKey}&serviceId={serviceId}&url={url}", - "type":"Consume" - }, - { - "serviceEndpoint":"http://mybrizo.org/api/v1/brizo/services/compute?pubKey=${pubKey}&serviceId={serviceId}&algo={algo}&container={container}", - "type":"Compute" - }, - { - "metadata":{ - "additionalInformation":{ - "structuredMarkup":[ - { - "mediaType":"application/ld+json", - "uri":"http://skos.um.es/unescothes/C01194/jsonld" - }, - { - "mediaType":"text/turtle", - "uri":"http://skos.um.es/unescothes/C01194/turtle" - } - ], - "updateFrecuency":"yearly" - }, - "base":{ - "author":"Met Office", - "compression":"zip", - "contentType":"text/csv", - "contentUrls":[ - "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip" - ], - "copyrightHolder":"Met Office", - "dateCreated":"2012-10-10T17:00:000Z", - "description":"Weather information of UK including temperature and humidity", - "encoding":"UTF-8", - "inLanguage":"en", - "license":"CC-BY", - "links":[ - { - "sample1":"http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/" - }, - { - "sample2":"http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/" - }, - { - "fieldsDescription":"http://data.ceda.ac.uk/badc/ukcp09/" - } - ], - "name":"UK Weather information 2011", - "price":10, - "size":"3.1gb", - "tags":"weather, uk, 2011, temperature, humidity", - "type":"dataset", - "workExample":"423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68" - }, - "curation":{ - "numVotes":123, - "rating":0.93, - "schema":"Binary Votting" - } - }, - "serviceEndpoint":"http://myaquarius.org/api/v1/provider/assets/metadata/{did}", - "type":"Metadata" - } - ], - "type":"array" - } - }, - "required":[ - "@context", - "id", - "publicKey", - "authentication", - "service" - ], - "type":"object" - } - } - ], - "responses":{ - "201":{ - "description":"Asset successfully registered." - }, - "400":{ - "description":"One of the required attributes is missing." - }, - "404":{ - "description":"Invalid asset data." - }, - "500":{ - "description":"Error" - } - }, - "summary":"Register DDO of a new asset", - "tags":[ - "ddo" - ] - } - }, - "/api/v1/aquarius/assets/ddo/query":{ - "get":{ - "description":"", - "parameters":[ - { - "description":"ID of the asset.", - "in":"query", - "name":"text", - "required":true, - "type":"string" - }, - { - "description":"Key or list of keys to sort the result", - "example":{ - "value":1 - }, - "in":"query", - "name":"sort", - "type":"object" - }, - { - "description":"Number of records per page", - "example":100, - "in":"query", - "name":"offset", - "type":"int" - }, - { - "description":"Page showed", - "example":0, - "in":"query", - "name":"page", - "type":"int" - } - ], - "responses":{ - "200":{ - "description":"successful action" - } - }, - "summary":"Get a list of DDOs that match with the given text.", - "tags":[ - "ddo" - ] - }, - "post":{ - "consumes":[ - "application/json" - ], - "description":"", - "parameters":[ - { - "description":"Asset metadata.", - "in":"body", - "name":"body", - "required":true, - "schema":{ - "properties":{ - "offset":{ - "description":"Number of records per page", - "example":100, - "type":"int" - }, - "page":{ - "description":"Page showed", - "example":0, - "type":"int" - }, - "query":{ - "description":"Query to realize", - "example":{ - "value":1 - }, - "type":"string" - }, - "sort":{ - "description":"Key or list of keys to sort the result", - "example":{ - "value":1 - }, - "type":"object" - } - }, - "type":"object" - } - } - ], - "responses":{ - "200":{ - "description":"successful action" - } - }, - "summary":"Get a list of DDOs that match with the executed query.", - "tags":[ - "ddo" - ] - } - }, - "/api/v1/aquarius/assets/ddo/{did}":{ - "put":{ - "consumes":[ - "application/json" - ], - "description":"", - "parameters":[ - { - "description":"DDO of the asset.", - "in":"body", - "name":"body", - "required":true, - "schema":{ - "properties":{ - "@context":{ - "description":null, - "example":"https://w3id.org/future-method/v1", - "type":"string" - }, - "authentication":{ - "description":"List of authentication mechanisms.", - "example":[ - { - "type":"RsaSignatureAuthentication2018" - }, - { - "publicKey":"did:op:123456789abcdefghi#keys-1" - } - ], - "type":"array" - }, - "id":{ - "description":"ID of the asset.", - "example":"did:op:123456789abcdefghi", - "type":"string" - }, - "publicKey":{ - "description":"List of public keys.", - "example":[ - { - "id":"did:op:123456789abcdefghi#keys-1" - }, - { - "type":"Ed25519VerificationKey2018" - }, - { - "owner":"did:op:123456789abcdefghi" - }, - { - "publicKeyBase58":"H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV" - } - ], - "type":"array" - }, - "service":{ - "description":"List of services.", - "example":[ - { - "serviceEndpoint":"http://mybrizo.org/api/v1/brizo/services/consume?pubKey=${pubKey}&serviceId={serviceId}&url={url}", - "type":"Consume" - }, - { - "serviceEndpoint":"http://mybrizo.org/api/v1/brizo/services/compute?pubKey=${pubKey}&serviceId={serviceId}&algo={algo}&container={container}", - "type":"Compute" - }, - { - "metadata":{ - "additionalInformation":{ - "structuredMarkup":[ - { - "mediaType":"application/ld+json", - "uri":"http://skos.um.es/unescothes/C01194/jsonld" - }, - { - "mediaType":"text/turtle", - "uri":"http://skos.um.es/unescothes/C01194/turtle" - } - ], - "updateFrecuency":"yearly" - }, - "base":{ - "author":"Met Office", - "compression":"zip", - "contentType":"text/csv", - "contentUrls":[ - "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip" - ], - "copyrightHolder":"Met Office", - "dateCreated":"2012-10-10T17:00:000Z", - "description":"Weather information of UK including temperature and humidity", - "encoding":"UTF-8", - "inLanguage":"en", - "license":"CC-BY", - "links":[ - { - "name":"Sample of Asset Data", - "type":"sample", - "url":"https://foo.com/sample.csv" - }, - { - "AssetID":"4d517500da0acb0d65a716f61330969334630363ce4a6a9d39691026ac7908ea", - "name":"Data Format Definition", - "type":"format" - } - ], - "name":"UK Weather information 2011", - "price":10, - "size":"3.1gb", - "tags":"weather, uk, 2011, temperature, humidity", - "type":"dataset", - "workExample":"423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68" - }, - "curation":{ - "numVotes":123, - "rating":0.93, - "schema":"Binary Voting" - } - }, - "serviceEndpoint":"http://myaquarius.org/api/v1/aquarius/assets/metadata/{did}", - "type":"Metadata" - } - ], - "type":"array" - } - }, - "required":[ - "@context", - "id", - "publicKey", - "authentication", - "service" - ], - "type":"object" - } - } - ], - "responses":{ - "200":{ - "description":"Asset successfully updated." - }, - "201":{ - "description":"Asset successfully registered." - }, - "400":{ - "description":"One of the required attributes is missing." - }, - "404":{ - "description":"Invalid asset data." - }, - "500":{ - "description":"Error" - } - }, - "summary":"Update DDO of an existing asset", - "tags":[ - "ddo" - ] - } - }, - "/api/v1/aquarius/assets/ddo/{id}":{ - "delete":{ - "description":"", - "parameters":[ - { - "description":"ID of the asset.", - "in":"path", - "name":"id", - "required":true, - "type":"string" - } - ], - "responses":{ - "200":{ - "description":"successfully deleted" - }, - "404":{ - "description":"This asset ID is not in OceanDB" - }, - "500":{ - "description":"Error" - } - }, - "summary":"Retire metadata of an asset", - "tags":[ - "ddo" - ] - }, - "get":{ - "description":"", - "parameters":[ - { - "description":"ID of the asset.", - "in":"path", - "name":"id", - "required":true, - "type":"string" - } - ], - "responses":{ - "200":{ - "description":"successful operation" - }, - "404":{ - "description":"This asset ID is not in OceanDB" - } - }, - "summary":"Get DDO of a particular asset.", - "tags":[ - "ddo" - ] - } - }, - "/api/v1/aquarius/assets/metadata/{id}":{ - "get":{ - "description":"", - "parameters":[ - { - "description":"ID of the asset.", - "in":"path", - "name":"id", - "required":true, - "type":"string" - } - ], - "responses":{ - "200":{ - "description":"successful operation." - }, - "404":{ - "description":"This asset ID is not in OceanDB." - } - }, - "summary":"Get metadata of a particular asset", - "tags":[ - "metadata" - ] - } - } - }, - "swagger":"2.0" + "swagger": "2.0" } diff --git a/data/brizo.json b/data/brizo.json index bb43ee47..b6285a6b 100644 --- a/data/brizo.json +++ b/data/brizo.json @@ -1,200 +1,114 @@ { - "basePath":"/api/v1/brizo", - "definitions":{ - + "definitions": {}, + "info": { + "description": "Brizo is the technical component executed by Publishers allowing them to provide extended data services. When running with our Docker images, it is exposed under `http://localhost:8030`.", + "title": "Brizo", + "version": "0.3.5" }, - "host":"myfancybrizo.com", - "info":{ - "description":"Brizo is the technical component executed by Publishers allowing them to provide extended data services. When running with our Docker images, it is exposed under `http://localhost:8030`.", - "title":"Brizo", - "version":"0.1.2" + "paths": { + "/api/v1/brizo/services/access/initialize": { + "post": { + "consumes": ["application/json"], + "description": "", + "parameters": [ + { + "description": "Service agreement initialization.", + "in": "body", + "name": "body", + "required": true, + "schema": { + "properties": { + "consumerAddress": { + "description": "Consumer address.", + "example": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", + "type": "string" + }, + "did": { + "description": "Identifier of the asset registered in ocean.", + "example": "did:op:08a429b8529856d59867503f8056903a680935a76950bb9649785cc97869a43d", + "type": "string" + }, + "serviceAgreementId": { + "description": "Identifier of the service agreement.", + "example": "bb23s87856d59867503f80a690357406857698570b964ac8dcc9d86da4ada010", + "type": "string" + }, + "serviceDefinitionId": { + "description": "Identifier of the service definition.", + "example": "0", + "type": "string" + }, + "signature": { + "description": "Signature", + "example": "cade376598342cdae231321a0097876aeda656a567a67c6767fd8710129a9dc1", + "type": "string" + } + }, + "required": [ + "did", + "serviceAgreementId", + "serviceDefinitionId", + "signature", + { "consumerAddress": null } + ], + "type": "object" + } + } + ], + "responses": { + "201": { + "description": "Service agreement successfully initialized." + }, + "400": { + "description": "One of the required attributes is missing." + }, + "401": { "description": "Error executing the service agreement." }, + "422": { "description": "Ocean DID not found on chain." }, + "500": { "description": "Error" } + }, + "summary": "Initialize the service agreement between the publisher and the consumer.", + "tags": ["services"] + } + }, + "/api/v1/brizo/services/consume": { + "get": { + "consumes": ["application/json"], + "description": "", + "parameters": [ + { + "description": "The consumer address.", + "in": "query", + "name": "consumerAddress", + "required": true, + "type": "string" + }, + { + "description": "The ID of the service agreement.", + "in": "query", + "name": "serviceAgreementId", + "required": true, + "type": "string" + }, + { + "description": "This URL is only valid if Brizo acts as a proxy. Consumer can't download using the URL if it's not through Brizo.", + "in": "query", + "name": "url", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { "description": "Redirect to valid asset url." }, + "400": { + "description": "One of the required attributes is missing." + }, + "401": { "description": "Invalid asset data." }, + "500": { "description": "Error" } + }, + "summary": "Allows download of asset data file.", + "tags": ["services"] + } + } }, - "paths":{ - "/api/v1/brizo/services/access/initialize":{ - "post":{ - "consumes":[ - "application/json" - ], - "description":"", - "parameters":[ - { - "description":"Service agreement initialization.", - "in":"body", - "name":"body", - "required":true, - "schema":{ - "properties":{ - "consumerAddress":{ - "description":"Consumer address.", - "example":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72", - "type":"string" - }, - "did":{ - "description":"Identifier of the asset registered in ocean.", - "example":"did:op:08a429b8529856d59867503f8056903a680935a76950bb9649785cc97869a43d", - "type":"string" - }, - "serviceAgreementId":{ - "description":"Identifier of the service agreement.", - "example":"bb23s87856d59867503f80a690357406857698570b964ac8dcc9d86da4ada010", - "type":"string" - }, - "serviceDefinitionId":{ - "description":"Identifier of the service definition.", - "example":"0", - "type":"string" - }, - "signature":{ - "description":"Signature", - "example":"cade376598342cdae231321a0097876aeda656a567a67c6767fd8710129a9dc1", - "type":"string" - } - }, - "required":[ - "did", - "serviceAgreementId", - "serviceDefinitionId", - "signature", - { - "consumerAddress":null - } - ], - "type":"object" - } - } - ], - "responses":{ - "201":{ - "description":"Service agreement successfully initialized." - }, - "400":{ - "description":"One of the required attributes is missing." - }, - "404":{ - "description":"Invalid signature." - }, - "500":{ - "description":"Error" - } - }, - "summary":"Initialize the SLA between the publisher and the consumer.", - "tags":[ - "services" - ] - } - }, - "/api/v1/brizo/services/compute":{ - "post":{ - "consumes":[ - "application/json" - ], - "description":"", - "parameters":[ - { - "description":"Asset metadata.", - "in":"body", - "name":"body", - "required":true, - "schema":{ - "properties":{ - "algorithm_did":{ - "description":"Identifier of the algorithm to execute", - "example":"0x0234242345", - "type":"string" - }, - "asset_did":{ - "description":"Identifier of the asset registered in Ocean", - "example":"0x0234242345", - "type":"string" - }, - "consumer_wallet":{ - "description":"Address of the wallet of the asset consumer. Ex. data-science...", - "example":"0x0234242345", - "type":"string" - }, - "cpu":{ - "description":"Number of CPUs to execute the algorithm.", - "example":1, - "type":"integer" - }, - "docker_image":{ - "description":"Docker image where the algorithm is going to be executed. Docker image must include all the libraries needed to run it.", - "example":"python:3.6-alpine", - "type":"string" - }, - "memory":{ - "description":"Ammout of memory in GB to run the algorithm", - "example":1.5, - "type":"number" - } - }, - "required":[ - "asset_did", - "algorithm_did", - "consumer_wallet" - ], - "type":"object" - } - } - ], - "responses":{ - - }, - "summary":"Allows to execute an algorithm inside a Docker instance in the cloud. Requires the publisher of the assets to provide this service in the service agreement related with the requested `asset_did`.", - "tags":[ - "services" - ] - } - }, - "/api/v1/brizo/services/consume":{ - "get":{ - "consumes":[ - "application/json" - ], - "description":"", - "parameters":[ - { - "description":"The consumer address.", - "in":"query", - "name":"consumerAddress", - "required":true, - "type":"string" - }, - { - "description":"The ID of the service agreement.", - "in":"query", - "name":"serviceAgreementId", - "required":true, - "type":"string" - }, - { - "description":"This URL is only valid if Brizo acts as a proxy. Consumer can't download using the URL if it's not through Brizo.", - "in":"query", - "name":"url", - "required":true, - "type":"string" - } - ], - "responses":{ - "302":{ - "description":"Redirect to valid asset url." - }, - "400":{ - "description":"One of the required attributes is missing." - }, - "404":{ - "description":"Invalid asset data." - }, - "500":{ - "description":"Error" - } - }, - "summary":"Allows download of asset data file.", - "tags":[ - "services" - ] - } - } - }, - "swagger":"2.0" + "swagger": "2.0" } From 880dcc8fc78b706d2f16446fb77192d945e31444 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 17 Apr 2019 12:44:51 +0200 Subject: [PATCH 2/6] fetch remote swagger specs --- data/aquarius.json | 509 --------------------------------------------- data/brizo.json | 114 ---------- gatsby-node.js | 97 +++++---- 3 files changed, 55 insertions(+), 665 deletions(-) delete mode 100644 data/aquarius.json delete mode 100644 data/brizo.json diff --git a/data/aquarius.json b/data/aquarius.json deleted file mode 100644 index 5288dcdb..00000000 --- a/data/aquarius.json +++ /dev/null @@ -1,509 +0,0 @@ -{ - "definitions": {}, - "info": { - "description": "Aquarius provides an off-chain database store for metadata about data assets. When running with our Docker images, it is exposed under:`http://0.0.0.0:5000`.", - "title": "Aquarius", - "version": "0.2.2" - }, - "paths": { - "/api/v1/aquarius/assets": { - "get": { - "description": "", - "responses": { "200": { "description": "successful action" } }, - "summary": "Get all asset IDs.", - "tags": ["ddo"] - } - }, - "/api/v1/aquarius/assets/ddo": { - "delete": { - "description": "", - "responses": { - "200": { "description": "successfully deleted" }, - "500": { "description": "Error" } - }, - "summary": "Retire metadata of all the assets.", - "tags": ["ddo"] - }, - "get": { - "description": "", - "responses": { "200": { "description": "successful action" } }, - "summary": "Get DDO of all assets.", - "tags": ["ddo"] - }, - "post": { - "consumes": ["application/json"], - "description": "", - "parameters": [ - { - "description": "DDO of the asset.", - "in": "body", - "name": "body", - "required": true, - "schema": { - "properties": { - "@context": { - "description": null, - "example": "https://w3id.org/future-method/v1", - "type": "string" - }, - "authentication": { - "description": "List of authentication mechanisms.", - "example": [ - { "type": "RsaSignatureAuthentication2018" }, - { "publicKey": "did:op:123456789abcdefghi#keys-1" } - ], - "type": "array" - }, - "created": { - "description": "date of ddo creation.", - "example": "2016-02-08T16:02:20Z", - "type": "string" - }, - "id": { - "description": "ID of the asset.", - "example": "did:op:123456789abcdefghi", - "type": "string" - }, - "proof": { - "description": "Information about the creation and creator of the asset.", - "example": { - "created": "2016-02-08T16:02:20Z", - "creator": "did:example:8uQhQMGzWxR8vw5P3UWH1ja", - "signatureValue": "QNB13Y7Q9...1tzjn4w==", - "type": "UUIDSignature" - }, - "type": "dictionary" - }, - "publicKey": { - "description": "List of public keys.", - "example": [ - { "id": "did:op:123456789abcdefghi#keys-1" }, - { "type": "Ed25519VerificationKey2018" }, - { "owner": "did:op:123456789abcdefghi" }, - { - "publicKeyBase58": "H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV" - } - ], - "type": "array" - }, - "service": { - "description": "List of services.", - "example": [ - { - "serviceEndpoint": "http://mybrizo.org/api/v1/brizo/services/consume?pubKey=${ pubKey}&serviceId={serviceId}&url={url}", - "type": "Access" - }, - { - "serviceEndpoint": "http://mybrizo.org/api/v1/brizo/services/compute?pubKey=${ pubKey}&serviceId={serviceId}&algo={algo}&container={container}", - "type": "Compute" - }, - { - "metadata": { - "additionalInformation": { - "structuredMarkup": [ - { - "mediaType": "application/ld+json", - "uri": "http://skos.um.es/unescothes/C01194/jsonld" - }, - { - "mediaType": "text/turtle", - "uri": "http://skos.um.es/unescothes/C01194/turtle" - } - ], - "updateFrecuency": "yearly" - }, - "base": { - "author": "Met Office", - "checksum": "38803b9e6f04fce3fba4b124524672592264d31847182c689095a081c9e85262", - "compression": "zip", - "copyrightHolder": "Met Office", - "dateCreated": "2012-02-01T10:55:11Z", - "description": "Weather information of UK including temperature and humidity", - "encryptedFiles": "0x098213xzckasdf089723hjgdasfkjgasfv", - "files": [ - { - "compression": "zip", - "contentLength": "4535431", - "contentType": "text/csv", - "encoding": "UTF-8", - "resourceId": "access-log2018-02-13-15-17-29-18386C502CAEA932" - } - ], - "inLanguage": "en", - "license": "CC-BY", - "links": [ - { - "name": "Sample of Asset Data", - "type": "sample", - "url": "https://foo.com/sample.csv" - }, - { - "AssetID": "4d517500da0acb0d65a716f61330969334630363ce4a6a9d39691026ac7908ea", - "name": "Data Format Definition", - "type": "format" - } - ], - "name": "UK Weather information 2011", - "price": 10, - "tags": "weather, uk, 2011, temperature, humidity", - "type": "dataset", - "workExample": "stationId,latitude,longitude,datetime, temperature,humidity/n423432fsd,51.509865,-0.118092, 2011-01-01T10:55:11+00:00,7.2,68" - }, - "curation": { - "numVotes": 123, - "rating": 0.93, - "schema": "Binary Voting" - } - }, - "serviceDefinitionId": "2", - "serviceEndpoint": "http://myaquarius.org/api/v1/provider/assets/metadata/{did}", - "type": "Metadata" - } - ], - "type": "array" - } - }, - "required": [ - "@context", - "id", - "created", - "publicKey", - "authentication", - "proof", - "service" - ], - "type": "object" - } - } - ], - "responses": { - "201": { "description": "Asset successfully registered." }, - "400": { - "description": "One of the required attributes is missing." - }, - "404": { "description": "Invalid asset data." }, - "500": { "description": "Error" } - }, - "summary": "Register DDO of a new asset", - "tags": ["ddo"] - } - }, - "/api/v1/aquarius/assets/ddo/query": { - "get": { - "description": "", - "parameters": [ - { - "description": "ID of the asset.", - "in": "query", - "name": "text", - "required": true, - "type": "string" - }, - { - "description": "Key or list of keys to sort the result", - "example": { "value": 1 }, - "in": "query", - "name": "sort", - "type": "object" - }, - { - "description": "Number of records per page", - "example": 100, - "in": "query", - "name": "offset", - "type": "int" - }, - { - "description": "Page showed", - "example": 1, - "in": "query", - "name": "page", - "type": "int" - } - ], - "responses": { "200": { "description": "successful action" } }, - "summary": "Get a list of DDOs that match with the given text.", - "tags": ["ddo"] - }, - "post": { - "consumes": ["application/json"], - "description": "", - "parameters": [ - { - "description": "Asset metadata.", - "in": "body", - "name": "body", - "required": true, - "schema": { - "properties": { - "offset": { - "description": "Number of records per page", - "example": 100, - "type": "int" - }, - "page": { - "description": "Page showed", - "example": 1, - "type": "int" - }, - "query": { - "description": "Query to realize", - "example": { "value": 1 }, - "type": "string" - }, - "sort": { - "description": "Key or list of keys to sort the result", - "example": { "value": 1 }, - "type": "object" - } - }, - "type": "object" - } - } - ], - "responses": { "200": { "description": "successful action" } }, - "summary": "Get a list of DDOs that match with the executed query.", - "tags": ["ddo"] - } - }, - "/api/v1/aquarius/assets/ddo/validate": { - "post": { - "consumes": ["application/json"], - "description": "", - "parameters": [ - { - "description": "Asset metadata.", - "in": "body", - "name": "body", - "required": true, - "schema": { "type": "object" } - } - ], - "responses": { - "200": { "description": "successfully request." }, - "500": { "description": "Error" } - }, - "summary": "Validate metadata content.", - "tags": ["ddo"] - } - }, - "/api/v1/aquarius/assets/ddo/{did}": { - "delete": { - "description": "", - "parameters": [ - { - "description": "DID of the asset.", - "in": "path", - "name": "did", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { "description": "successfully deleted" }, - "404": { "description": "This asset DID is not in OceanDB" }, - "500": { "description": "Error" } - }, - "summary": "Retire metadata of an asset", - "tags": ["ddo"] - }, - "get": { - "description": "", - "parameters": [ - { - "description": "DID of the asset.", - "in": "path", - "name": "did", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { "description": "successful operation" }, - "404": { "description": "This asset DID is not in OceanDB" } - }, - "summary": "Get DDO of a particular asset.", - "tags": ["ddo"] - }, - "put": { - "consumes": ["application/json"], - "description": "", - "parameters": [ - { - "description": "DDO of the asset.", - "in": "body", - "name": "body", - "required": true, - "schema": { - "properties": { - "@context": { - "description": null, - "example": "https://w3id.org/future-method/v1", - "type": "string" - }, - "authentication": { - "description": "List of authentication mechanisms.", - "example": [ - { "type": "RsaSignatureAuthentication2018" }, - { "publicKey": "did:op:123456789abcdefghi#keys-1" } - ], - "type": "array" - }, - "created": { - "description": "date of ddo creation.", - "example": "2016-02-08T16:02:20Z", - "type": "string" - }, - "id": { - "description": "ID of the asset.", - "example": "did:op:123456789abcdefghi", - "type": "string" - }, - "proof": { - "description": "Information about the creation and creator of the asset.", - "example": { - "created": "2016-02-08T16:02:20Z", - "creator": "did:example:8uQhQMGzWxR8vw5P3UWH1ja", - "signatureValue": "QNB13Y7Q9...1tzjn4w==", - "type": "UUIDSignature" - }, - "type": "dictionary" - }, - "publicKey": { - "description": "List of public keys.", - "example": [ - { "id": "did:op:123456789abcdefghi#keys-1" }, - { "type": "Ed25519VerificationKey2018" }, - { "owner": "did:op:123456789abcdefghi" }, - { - "publicKeyBase58": "H3C2AVvLMv6gmMNam3uVAjZpfkcJCwDwnZn6z3wXmqPV" - } - ], - "type": "array" - }, - "service": { - "description": "List of services.", - "example": [ - { - "serviceEndpoint": "http://mybrizo.org/api/v1/brizo/services/consume?pubKey=${ pubKey}&serviceId={serviceId}&url={url}", - "type": "Access" - }, - { - "serviceEndpoint": "http://mybrizo.org/api/v1/brizo/services/compute?pubKey=${ pubKey}&serviceId={serviceId}&algo={algo}&container={container}", - "type": "Compute" - }, - { - "metadata": { - "additionalInformation": { - "structuredMarkup": [ - { - "mediaType": "application/ld+json", - "uri": "http://skos.um.es/unescothes/C01194/jsonld" - }, - { - "mediaType": "text/turtle", - "uri": "http://skos.um.es/unescothes/C01194/turtle" - } - ], - "updateFrecuency": "yearly" - }, - "base": { - "author": "Met Office", - "checksum": "38803b9e6f04fce3fba4b124524672592264d31847182c689095a081c9e85262", - "compression": "zip", - "copyrightHolder": "Met Office", - "dateCreated": "2012-02-01T10:55:11Z", - "description": "Weather information of UK including temperature and humidity", - "encryptedFiles": "0x098213xzckasdf089723hjgdasfkjgasfv", - "files": [ - { - "compression": "zip", - "contentLength": "4535431", - "contentType": "text/csv", - "encoding": "UTF-8", - "resourceId": "access-log2018-02-13-15-17-29-18386C502CAEA932" - } - ], - "inLanguage": "en", - "license": "CC-BY", - "links": [ - { - "name": "Sample of Asset Data", - "type": "sample", - "url": "https://foo.com/sample.csv" - }, - { - "AssetID": "4d517500da0acb0d65a716f61330969334630363ce4a6a9d39691026ac7908ea", - "name": "Data Format Definition", - "type": "format" - } - ], - "name": "UK Weather information 2011", - "price": 10, - "tags": "weather, uk, 2011, temperature, humidity", - "type": "dataset", - "workExample": "stationId,latitude,longitude,datetime, temperature,humidity/n423432fsd,51.509865,-0.118092, 2011-01-01T10:55:11+00:00,7.2,68" - }, - "curation": { - "numVotes": 123, - "rating": 0.93, - "schema": "Binary Voting" - } - }, - "serviceDefinitionId": "2", - "serviceEndpoint": "http://myaquarius.org/api/v1/provider/assets/metadata/{did}", - "type": "Metadata" - } - ], - "type": "array" - } - }, - "required": [ - "@context", - "created", - "id", - "publicKey", - "authentication", - "proof", - "service" - ], - "type": "object" - } - } - ], - "responses": { - "200": { "description": "Asset successfully updated." }, - "201": { "description": "Asset successfully registered." }, - "400": { - "description": "One of the required attributes is missing." - }, - "404": { "description": "Invalid asset data." }, - "500": { "description": "Error" } - }, - "summary": "Update DDO of an existing asset", - "tags": ["ddo"] - } - }, - "/api/v1/aquarius/assets/metadata/{did}": { - "get": { - "description": "", - "parameters": [ - { - "description": "DID of the asset.", - "in": "path", - "name": "did", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { "description": "successful operation." }, - "404": { "description": "This asset DID is not in OceanDB." } - }, - "summary": "Get metadata of a particular asset", - "tags": ["metadata"] - } - } - }, - "swagger": "2.0" -} diff --git a/data/brizo.json b/data/brizo.json deleted file mode 100644 index b6285a6b..00000000 --- a/data/brizo.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "definitions": {}, - "info": { - "description": "Brizo is the technical component executed by Publishers allowing them to provide extended data services. When running with our Docker images, it is exposed under `http://localhost:8030`.", - "title": "Brizo", - "version": "0.3.5" - }, - "paths": { - "/api/v1/brizo/services/access/initialize": { - "post": { - "consumes": ["application/json"], - "description": "", - "parameters": [ - { - "description": "Service agreement initialization.", - "in": "body", - "name": "body", - "required": true, - "schema": { - "properties": { - "consumerAddress": { - "description": "Consumer address.", - "example": "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", - "type": "string" - }, - "did": { - "description": "Identifier of the asset registered in ocean.", - "example": "did:op:08a429b8529856d59867503f8056903a680935a76950bb9649785cc97869a43d", - "type": "string" - }, - "serviceAgreementId": { - "description": "Identifier of the service agreement.", - "example": "bb23s87856d59867503f80a690357406857698570b964ac8dcc9d86da4ada010", - "type": "string" - }, - "serviceDefinitionId": { - "description": "Identifier of the service definition.", - "example": "0", - "type": "string" - }, - "signature": { - "description": "Signature", - "example": "cade376598342cdae231321a0097876aeda656a567a67c6767fd8710129a9dc1", - "type": "string" - } - }, - "required": [ - "did", - "serviceAgreementId", - "serviceDefinitionId", - "signature", - { "consumerAddress": null } - ], - "type": "object" - } - } - ], - "responses": { - "201": { - "description": "Service agreement successfully initialized." - }, - "400": { - "description": "One of the required attributes is missing." - }, - "401": { "description": "Error executing the service agreement." }, - "422": { "description": "Ocean DID not found on chain." }, - "500": { "description": "Error" } - }, - "summary": "Initialize the service agreement between the publisher and the consumer.", - "tags": ["services"] - } - }, - "/api/v1/brizo/services/consume": { - "get": { - "consumes": ["application/json"], - "description": "", - "parameters": [ - { - "description": "The consumer address.", - "in": "query", - "name": "consumerAddress", - "required": true, - "type": "string" - }, - { - "description": "The ID of the service agreement.", - "in": "query", - "name": "serviceAgreementId", - "required": true, - "type": "string" - }, - { - "description": "This URL is only valid if Brizo acts as a proxy. Consumer can't download using the URL if it's not through Brizo.", - "in": "query", - "name": "url", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { "description": "Redirect to valid asset url." }, - "400": { - "description": "One of the required attributes is missing." - }, - "401": { "description": "Invalid asset data." }, - "500": { "description": "Error" } - }, - "summary": "Allows download of asset data file.", - "tags": ["services"] - } - } - }, - "swagger": "2.0" -} diff --git a/gatsby-node.js b/gatsby-node.js index 08250dad..59d482c9 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -37,26 +37,6 @@ exports.onCreateNode = ({ node, getNode, actions }) => { } } -// https://github.com/swagger-api/swagger-js -const getSpec = async () => { - const spec = await Swagger( - 'http://petstore.swagger.io/v2/swagger.json' - ).then(client => { - return client.spec // The resolved spec - - // client.originalSpec // In case you need it - // client.errors // Any resolver errors - - // Tags interface - // client.apis.pet.addPet({id: 1, name: "bobby"}).then(...) - - // TryItOut Executor, with the `spec` already provided - // client.execute({operationId: 'addPet', parameters: {id: 1, name: "bobby") }).then(...) - }) - - return spec -} - exports.createPages = ({ graphql, actions }) => { const { createPage, createRedirect } = actions @@ -152,44 +132,77 @@ exports.createPages = ({ graphql, actions }) => { // // Create pages from swagger json files // - const swaggerSpecs = [ - './data/aquarius.json', - './data/brizo.json' - ] + const swaggerComponents = ['aquarius', 'brizo'] const apiSwaggerTemplate = path.resolve( './src/templates/Swagger/index.jsx' ) - swaggerSpecs.forEach(spec => { - const api = require(spec) // eslint-disable-line - const name = path - .basename(spec) - .split('.json') - .join('') - const slug = `/references/${name}/` + // https://github.com/swagger-api/swagger-js + const fetchSwaggerSpec = async name => { + try { + const client = await Swagger( + `https://nginx-${name}.dev-ocean.com/spec` + ) + return client.spec // The resolved spec - createPage({ - path: slug, - component: apiSwaggerTemplate, - context: { - slug, - api - } - }) + // client.originalSpec // In case you need it + // client.errors // Any resolver errors + + // Tags interface + // client.apis.pet.addPet({id: 1, name: "bobby"}).then(...) + + // TryItOut Executor, with the `spec` already provided + // client.execute({operationId: 'addPet', parameters: {id: 1, name: "bobby") }).then(...) + } catch (error) { + console.log(error) + } + } + + const getSlug = name => { + const slug = `/references/${name}/` + return slug + } + + const specAquarius = await fetchSwaggerSpec( + swaggerComponents[0] + ) + const slugAquarius = getSlug(swaggerComponents[0]) + + createPage({ + path: slugAquarius, + component: apiSwaggerTemplate, + context: { + slug: slugAquarius, + api: specAquarius + } }) - // Swagger Pet Store example, fetch from remote + const specBrizo = await fetchSwaggerSpec(swaggerComponents[1]) + const slugBrizo = getSlug(swaggerComponents[1]) + + createPage({ + path: slugBrizo, + component: apiSwaggerTemplate, + context: { + slug: slugBrizo, + api: specBrizo + } + }) + + // Swagger Pet Store example const petStoreSlug = '/references/petstore/' try { - const api = await getSpec() + const client = await Swagger( + `http://petstore.swagger.io/v2/swagger.json` + ) createPage({ path: petStoreSlug, component: apiSwaggerTemplate, context: { slug: petStoreSlug, - api + api: client.spec } }) } catch (error) { From 8fef5459f7f32bcd9ae5b846577c2e806b3fc3ef Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 17 Apr 2019 12:58:02 +0200 Subject: [PATCH 3/6] update copy --- README.md | 10 ++++------ content/references/introduction.md | 8 +++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c0311b52..bd9ea862 100644 --- a/README.md +++ b/README.md @@ -194,14 +194,12 @@ The sidebar for those generated reference pages will automatically switch to inc #### Swagger specs -Reference pages based on Swagger specs are sourced from a Swagger spec `json` file, at the moment they simply live as manual copies under `/data/`: +Reference pages based on Swagger specs are sourced from remotely hosted Swagger specs: -- [`aquarius.json`](./data/aquarius.json) -- [`brizo.json`](./data/brizo.json) +- [`https://nginx-aquarius.dev-ocean.com/spec`](https://nginx-aquarius.dev-ocean.com/spec) +- [`https://nginx-brizo.dev-ocean.com/spec`](https://nginx-brizo.dev-ocean.com/spec) -There's no automation setup around updating those files so [until this is setup](https://github.com/oceanprotocol/docs/issues/74), they need to be manually updated with copy & paste, like they did in the middle ages. You can copy them from a running instance of Aquarius or Brizo which will expose those spec files, e.g. under `localhost:5000/spec` for Aquarius and `localhost:8030/spec` for Brizo. - -For more information about stylistic issues, take a look at the section in the test page: +They are fetched and updated automatically upon every site build. For more information about stylistic issues, take a look at the section in the test page: - [Swagger spec references](https://docs.oceanprotocol.com/test#swagger-spec-references) diff --git a/content/references/introduction.md b/content/references/introduction.md index 62f9c810..4f275add 100644 --- a/content/references/introduction.md +++ b/content/references/introduction.md @@ -1,11 +1,9 @@ --- -title: API & Library References -description: All the references for Ocean Protocol components. +title: API References +description: All the API reference docs for Ocean Protocol components and libraries. --- -**Heads Up! This reference section is in heavy development and updated as we integrate data from various code reference tools into this site.** - -The following components expose a consumable REST API which are documented on this site: +This section has API reference docs (or links to external ones) for the following Ocean Protocol components and libraries: From 78f91aea44e7b411bfcaef64643490219a79ef24 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 17 Apr 2019 13:05:56 +0200 Subject: [PATCH 4/6] API & Library References -> API References --- README.md | 6 +++--- data/sections.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bd9ea862..ba5edd98 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ - [Repositories](#repositories) - [Add Links to a Repository](#add-links-to-a-repository) - [Release Versions](#release-versions) - - [API & Library References](#api--library-references) + - [API References](#api-references) - [Swagger specs](#swagger-specs) - [TypeDoc specs](#typedoc-specs) - [Development](#development) @@ -49,7 +49,7 @@ The documentation is split in multiple sections whose content lives in this repo - **Core concepts**: high-level explanation of concepts, assumptions, and components - **Setup**: getting started for various stakeholders and use cases - **Tutorials**: detailed tutorials -- **API & Library References**: docs for the Aquarius & Brizo REST APIs, and docs for various Squid libraries +- **API References**: docs for the Aquarius & Brizo REST APIs, and docs for various Squid libraries Those sections are defined in the [`/data/sections.yml`](data/sections.yml) file. @@ -184,7 +184,7 @@ The GitHub link is automatically added for every repository and will always be d The displayed version number is based on the tag name of the latest release for a given repository. That means only GitHub releases will trigger a version number update, creating a new Git tag alone is not sufficient. -### API & Library References +### API References You can add more Markdown documents under `/content/references/`, link to them from the [`/data/sidebars/references.yml`](./data/sidebars/references.yml), and they will appear just like in all the other sections. diff --git a/data/sections.yml b/data/sections.yml index 4593830f..d408aafe 100644 --- a/data/sections.yml +++ b/data/sections.yml @@ -13,7 +13,7 @@ link: /tutorials/introduction/ color: orange -- title: API & Library References +- title: API References description: Get the references for REST APIs and library methods for all relevant components. link: /references/introduction/ color: green From dfe712516bc946aff070d6c35dfade3cf06e1c75 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 17 Apr 2019 13:09:36 +0200 Subject: [PATCH 5/6] mention swaggerhub in intro --- content/references/introduction.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/references/introduction.md b/content/references/introduction.md index 4f275add..2e387b35 100644 --- a/content/references/introduction.md +++ b/content/references/introduction.md @@ -10,6 +10,11 @@ This section has API reference docs (or links to external ones) for the followin Those are sourced from their respective Swagger specs. On this site you can't execute the documented API calls yet. If you need this, you can run a component's local Swagger UI as outlined in the repository instructions on GitHub. +Additionally, if you need API docs for a past version of Aquarius or Brizo, check out their specs on SwaggerHub: + +- [SwaggerHub: Aquarius](https://app.swaggerhub.com/apis/Ocean-Protocol/aquarius) +- [SwaggerHub: Brizo](https://app.swaggerhub.com/apis/Ocean-Protocol/brizo) + References of all the functions and methods used in our libraries: From c5c143f2aec0e5f7ceceff8c655784578d2dbfba Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 17 Apr 2019 13:36:30 +0200 Subject: [PATCH 6/6] add past versions linking to swaggerhub --- gatsby-node.js | 2 ++ src/templates/Doc.module.scss | 10 +++++++++- src/templates/Swagger/index.jsx | 9 +++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index 59d482c9..60b3264e 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -173,6 +173,7 @@ exports.createPages = ({ graphql, actions }) => { component: apiSwaggerTemplate, context: { slug: slugAquarius, + name: swaggerComponents[0], api: specAquarius } }) @@ -185,6 +186,7 @@ exports.createPages = ({ graphql, actions }) => { component: apiSwaggerTemplate, context: { slug: slugBrizo, + name: swaggerComponents[1], api: specBrizo } }) diff --git a/src/templates/Doc.module.scss b/src/templates/Doc.module.scss index e5e7eb6d..e8ae0c3c 100644 --- a/src/templates/Doc.module.scss +++ b/src/templates/Doc.module.scss @@ -50,9 +50,17 @@ } .version { + color: $brand-grey-light; font-size: $font-size-base; font-family: $font-family-monospace; - color: $brand-grey-light; + + a { + font-size: $font-size-mini; + font-family: $font-family-base; + font-weight: $font-weight-base; + display: inline-block; + margin-left: .5rem; + } } .pathName { diff --git a/src/templates/Swagger/index.jsx b/src/templates/Swagger/index.jsx index 4cd75ad5..0845dbd0 100644 --- a/src/templates/Swagger/index.jsx +++ b/src/templates/Swagger/index.jsx @@ -69,7 +69,7 @@ export default class ApiSwaggerTemplate extends Component { render() { const { location, pageContext } = this.props - const { api } = pageContext + const { api, name } = pageContext const { host, basePath, info, paths } = api const { title, description, version, license, contact } = info @@ -106,7 +106,12 @@ export default class ApiSwaggerTemplate extends Component { description={description} prepend={ - {version} + v{version} + + past versions + } />