diff --git a/.changeset/slow-eggs-relax.md b/.changeset/slow-eggs-relax.md new file mode 100644 index 000000000..f0b5c6f5b --- /dev/null +++ b/.changeset/slow-eggs-relax.md @@ -0,0 +1,5 @@ +--- +'myst-frontmatter': patch +--- + +Simplify error message suppression in numbering diff --git a/packages/myst-frontmatter/src/numbering/validators.ts b/packages/myst-frontmatter/src/numbering/validators.ts index 99ff91c5a..f18baaa6b 100644 --- a/packages/myst-frontmatter/src/numbering/validators.ts +++ b/packages/myst-frontmatter/src/numbering/validators.ts @@ -3,8 +3,7 @@ import { defined, incrementOptions, validateBoolean, - validateKeys, - validateObject, + validateObjectKeys, validateString, } from 'simple-validators'; import type { Numbering } from './types.js'; @@ -34,13 +33,10 @@ export const NUMBERING_ALIAS = { * Validate Numbering object */ export function validateNumbering(input: any, opts: ValidationOptions): Numbering | undefined { - const obj = validateObject(input, opts); - if (obj === undefined) return undefined; - const value = validateKeys( - obj, + const value = validateObjectKeys( + input, { optional: [...NUMBERING_KEYS, ...NUMBERING_OPTIONS], alias: NUMBERING_ALIAS }, - // Do not add warnings on this filter process - { property: '', messages: { errors: [], warnings: [] }, keepExtraKeys: true }, + { ...opts, suppressWarnings: true, keepExtraKeys: true }, ); if (value === undefined) return undefined; const output: Record = {};