Skip to content

Commit

Permalink
Add support for optional id in ImageObject [elifesciences/enhanced-pr…
Browse files Browse the repository at this point in the history
  • Loading branch information
nlisgo committed Oct 14, 2024
1 parent fc82142 commit b4449d2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/http-schema/http-schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ describe('httpschema (EnhancedArticleSchema)', () => {
},
{
type: 'ImageObject',
id: 'img',
contentUrl: 'https://placekitten.com/500/300',
content: [],
meta: {
Expand Down
1 change: 1 addition & 0 deletions src/http-schema/http-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
1 change: 1 addition & 0 deletions src/model/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type FigureContent = DecoratedContent & {

type ImageObjectContent = {
type: 'ImageObject',
id?: string,
contentUrl?: string,
content?: Content
meta: {
Expand Down

0 comments on commit b4449d2

Please sign in to comment.