Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit 360f16a

Browse files
committed
feat(project): Agrega validación de props de OAs
1 parent fb39bb8 commit 360f16a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/project.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export const transformLearningObjectives = async (dir, opts, meta = {}) => {
113113
const known = !shouldValidate ? null : await loadYaml(`${opts.lo}/data.yml`);
114114
const knownFlattened = !shouldValidate ? null : flattenLearningObjectives(known);
115115

116+
const allowedProps = ['id', 'optional', 'exclude'];
116117
const parseLearningObjectives = (arr, isVariant = false) => {
117118
const parsed = arr.map((strOrObj) => {
118119
const obj = (
@@ -127,6 +128,12 @@ export const transformLearningObjectives = async (dir, opts, meta = {}) => {
127128
);
128129
}
129130

131+
if (Object.keys(obj).some(key => !allowedProps.includes(key))) {
132+
throw new Error(
133+
`Invalid learning objective prop: ${util.inspect(strOrObj)}`,
134+
);
135+
}
136+
130137
if (shouldValidate && !knownFlattened.includes(obj.id)) {
131138
throw Object.assign(
132139
new Error(`Unknown learning objectives: ${obj.id}.`),

0 commit comments

Comments
 (0)