Skip to content

Commit

Permalink
Update check-schema.js
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielCliftonGuardian committed Jun 5, 2023
1 parent 1f05fd4 commit 659d079
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion dotcom-rendering/scripts/json-schema/check-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const {
getArticleSchema,
getFrontSchema,
getNewsletterPageSchema,
getBlockSchema,
} = require('./get-schema');

const existingArticleSchema = fs.readFileSync(
Expand All @@ -20,15 +21,21 @@ const existingNewsletterSchema = fs.readFileSync(
`${root}/src/model/newsletter-page-schema.json`,
{ encoding: 'utf-8' },
);
const existingBlockSchema = fs.readFileSync(
`${root}/src/model/block-schema.json`,
{ encoding: 'utf-8' },
);

const articleSchema = getArticleSchema();
const frontSchema = getFrontSchema();
const newsletterSchema = getNewsletterPageSchema();
const blockSchema = getBlockSchema();

if (
existingArticleSchema !== articleSchema ||
existingFrontSchema !== frontSchema ||
existingNewsletterSchema !== newsletterSchema
existingNewsletterSchema !== newsletterSchema ||
existingBlockSchema !== blockSchema
) {
throw new Error('Schemas do not match ... please run "make gen-schema"');
} else {
Expand Down

0 comments on commit 659d079

Please sign in to comment.