From c2ba7e576d65c9fddd4a1b0ddd42cb41add9681c Mon Sep 17 00:00:00 2001 From: serafettin Date: Tue, 21 May 2024 15:10:54 +0300 Subject: [PATCH] Update composedb.js --- api/src/libs/composedb.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/api/src/libs/composedb.js b/api/src/libs/composedb.js index 35e0b3e7..9838d806 100644 --- a/api/src/libs/composedb.js +++ b/api/src/libs/composedb.js @@ -290,18 +290,20 @@ export const jsonSchemaToGraphQLFragment = (schema, prefix = false) => { const parentDefs = schema.schema.$defs; const prefixName = schema.name; - schema.schema.$defs.GraphQLDID = { - type: "object", - title: "GraphQLDID", - required: ["id"], - properties: { - id: { - type: "string", - maxLength: 100, + if (schema.schema.$defs) { + schema.schema.$defs.GraphQLDID = { + type: "object", + title: "GraphQLDID", + required: ["id"], + properties: { + id: { + type: "string", + maxLength: 100, + }, }, - }, - additionalProperties: false, - }; + additionalProperties: false, + }; + } schema.schema.properties.id = { type: "string", @@ -415,12 +417,12 @@ export const setIndexedModelParams = async (app) => { const modelFragments = await Promise.all( modelList.map(async (m) => { const stream = await ceramic.loadStream(m); - //const fragment = jsonSchemaToGraphQLFragment(stream.content); + const fragment = jsonSchemaToGraphQLFragment(stream.content); return { id: m, name: stream.content.name, - //fragment, - //prefixedFragment: jsonSchemaToGraphQLFragment(stream.content, true), + fragment, + prefixedFragment: jsonSchemaToGraphQLFragment(stream.content, true), }; }), );