From 20ad9e8d245752c00d669833644ae97fd22aa7fb Mon Sep 17 00:00:00 2001 From: Aitor <1726644+aaitor@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:30:52 +0200 Subject: [PATCH] fix: adding openapi endpoint when there is one --- package.json | 2 +- src/nevermined/api/RegistryBaseApi.ts | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 473b18cd9..c19b1f986 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nevermined-io/sdk", - "version": "3.0.39", + "version": "3.0.40", "description": "Javascript SDK for connecting with Nevermined Data Platform ", "main": "./dist/node/sdk.js", "typings": "./dist/node/sdk.d.ts", diff --git a/src/nevermined/api/RegistryBaseApi.ts b/src/nevermined/api/RegistryBaseApi.ts index 1d07cfa3f..e6ef12fd6 100644 --- a/src/nevermined/api/RegistryBaseApi.ts +++ b/src/nevermined/api/RegistryBaseApi.ts @@ -165,12 +165,16 @@ export abstract class RegistryBaseApi extends Instantiable { ddo.id, ) - assetAttributes.metadata.additionalInformation = { - ...assetAttributes.metadata.additionalInformation, - customData: { - openApi: assetAttributes.metadata.main.webService?.openEndpoints[0], - }, - } + if ( + assetAttributes.metadata.main.webService?.openEndpoints && + assetAttributes.metadata.main.webService?.openEndpoints.length > 0 + ) + assetAttributes.metadata.additionalInformation = { + ...assetAttributes.metadata.additionalInformation, + customData: { + openApi: assetAttributes.metadata.main.webService?.openEndpoints[0], + }, + } const encryptedServiceAttributesResponse = await this.nevermined.services.node.encrypt( ddo.id,