1
0
mirror of synced 2026-01-07 18:01:41 -05:00
Files
docs/tests/helpers/schemas/learning-tracks-schema.js
Robert Sese 47b53add9f ajv lib/frontmatter (#35487)
Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com>
2023-03-28 19:12:59 +00:00

37 lines
936 B
JavaScript

import { schema } from '../../../lib/frontmatter.js'
// Some learning tracks have `versions` blocks that match `versions` frontmatter,
// so we can import that part of the FM schema.
const versionsProps = Object.assign({}, schema.properties.versions)
// `versions` are not required in learning tracks the way they are in FM.
delete versionsProps.required
export default {
type: 'object',
additionalProperties: false,
patternProperties: {
'^[a-zA-Z-_]+$': {
type: 'object',
required: ['title', 'description', 'guides'],
additionalProperties: false,
properties: {
title: {
type: 'string',
},
description: {
type: 'string',
},
guides: {
type: 'array',
items: { type: 'string' },
},
featured_track: {
type: ['boolean', 'string'],
},
versions: versionsProps,
},
},
},
}