-
Notifications
You must be signed in to change notification settings - Fork 66.9k
Expand file tree
/
Copy pathlearning-tracks.ts
More file actions
40 lines (37 loc) · 1.12 KB
/
learning-tracks.ts
File metadata and controls
40 lines (37 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { schema } from '@/frame/lib/frontmatter'
// 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',
lintable: true,
},
description: {
type: 'string',
lintable: true,
},
guides: {
type: 'array',
items: {
type: 'string',
// matches Liquid tags and URLs with trailing backslash
// if this regex becomes problematic, we can remove it
pattern: '^(\\{%.*%\\})?\\s*(\\/((\\w|-|\\.))+)+\\s*(\\{%.*%\\})?$',
},
},
versions: versionsProps,
},
},
},
}