Skip to content

Commit

Permalink
Add 'doi' field to ExternalVersionSummary [elifesciences/enhanced-pre…
Browse files Browse the repository at this point in the history
  • Loading branch information
nlisgo committed Jul 9, 2024
1 parent a2c1fb6 commit 95e0499
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/http-schema/http-schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const enhancedArticleExample = {
const externalVersionSummaryExample = {
id: 'testid2',
msid: 'testmsid1',
doi: 'doi2',
url: 'https://doi.org/doi2',
versionIdentifier: '2',
published: '2023-02-28',
Expand Down Expand Up @@ -398,6 +399,7 @@ describe('httpschema (EnhancedArticleSchema)', () => {

describe('httpschema (ExternalVersionSummarySchema)', () => {
const sampleRequiredFieldValidationMessages = [
'"doi" is required',
'"url" is required',
'"versionIdentifier" is required',
];
Expand Down Expand Up @@ -433,6 +435,7 @@ describe('httpschema (ExternalVersionSummarySchema)', () => {
const invalidateCorrections = ExternalVersionSummarySchema.validate({
id: 'id',
msid: 'msid',
doi: 'doi',
versionIdentifier: 'v42',
published: '2008-11-02',
url: 'www.google.com',
Expand All @@ -459,6 +462,7 @@ describe('httpschema (ExternalVersionSummarySchema)', () => {
const input = {
id: 'id',
msid: 'msid',
doi: 'doi',
versionIdentifier: 'v42',
published: '2008-11-02',
url: 'www.google.com',
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 @@ -236,6 +236,7 @@ export const RelatedContentSchema = Joi.array().items({
export const ExternalVersionSummarySchema = Joi.object<VersionSummary>({
id: Joi.string().required(),
msid: Joi.string().required(),
doi: Joi.string().required(),
url: Joi.string().required(),
versionIdentifier: Joi.string().required(),
published: Joi.date().required().allow(null),
Expand Down
5 changes: 3 additions & 2 deletions src/model/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,14 @@ type PreprintVersionSummary = Omit<EnhancedArticle, 'article' | 'peerReview'>;
type ExternalVersionSummary = {
id: string,
msid: string,
doi: string,
versionIdentifier: string,
published?: Date,
url: string
url: string,
corrections?: {
url: string,
date: Date,
}[]
}[],
};

export type VersionSummary = PreprintVersionSummary | ExternalVersionSummary;
Expand Down

0 comments on commit 95e0499

Please sign in to comment.