Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
Add the generateFrom call
Browse files Browse the repository at this point in the history
  • Loading branch information
ptgott committed Jul 1, 2024
1 parent b36bfac commit 8393641
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions server/config-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const validator = ajv.compile({
properties: {
icon: { type: "string" },
title: { type: "string" },
generateFrom: { type: "string" },
// Entries must be empty if generateFrom is present.
entries: {
type: "array",
items: {
Expand Down Expand Up @@ -327,5 +329,18 @@ export const loadConfig = (version: string) => {

validateConfig<Config>(validator, config);

config.navigation.items.forEach((item, i) => {
if (!!item.generateFrom && item.entries.length > 0) {
throw "a navigation item cannot contain both generateFrom and entries";
}

if (!!item.generateFrom) {
config.navigation.items[i].entries = generateNavPaths(
fs,
item.generateFrom
);
}
});

return normalize(config, version);
};

0 comments on commit 8393641

Please sign in to comment.