From b4449d261b66bbb2f7fb9020c58d2d2babc89999 Mon Sep 17 00:00:00 2001 From: Nathan Lisgo Date: Mon, 14 Oct 2024 18:18:00 +0100 Subject: [PATCH] Add support for optional id in ImageObject [elifesciences/enhanced-preprints-issues#654] --- src/http-schema/http-schema.test.ts | 1 + src/http-schema/http-schema.ts | 1 + src/model/content.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/http-schema/http-schema.test.ts b/src/http-schema/http-schema.test.ts index 77e9b2e5..5a10e37a 100644 --- a/src/http-schema/http-schema.test.ts +++ b/src/http-schema/http-schema.test.ts @@ -149,6 +149,7 @@ describe('httpschema (EnhancedArticleSchema)', () => { }, { type: 'ImageObject', + id: 'img', contentUrl: 'https://placekitten.com/500/300', content: [], meta: { diff --git a/src/http-schema/http-schema.ts b/src/http-schema/http-schema.ts index 822392fa..39fd8ac4 100644 --- a/src/http-schema/http-schema.ts +++ b/src/http-schema/http-schema.ts @@ -94,6 +94,7 @@ const FigureContentSchema = Joi.object({ const ImageObjectContent = Joi.object({ type: Joi.string().valid('ImageObject').required(), + id: Joi.string().optional(), contentUrl: Joi.string().optional(), content: Joi.link('#Content').optional(), meta: Joi.object({ diff --git a/src/model/content.ts b/src/model/content.ts index ee49f86a..8bd1b076 100644 --- a/src/model/content.ts +++ b/src/model/content.ts @@ -49,6 +49,7 @@ type FigureContent = DecoratedContent & { type ImageObjectContent = { type: 'ImageObject', + id?: string, contentUrl?: string, content?: Content meta: {