@mintlify/validation
Version:
Validates mint.json files
16 lines (15 loc) • 696 B
JavaScript
import { v4 as uuidv4 } from 'uuid';
import { mapExample } from './mapExample.js';
export const mapExampleComponents = ({ spec, refUuidMap, uuidObjectHashMap, hashedNodeMap, }) => {
var _a;
const exampleComponents = (_a = spec.components) === null || _a === void 0 ? void 0 : _a.examples;
if (!exampleComponents)
return;
// for each example component
Object.entries(exampleComponents).forEach(([exampleName, example]) => {
// match the refId to uuid
const refId = `#/components/examples/${exampleName}`;
const uuid = refUuidMap[refId] || uuidv4();
mapExample({ example, refUuidMap, uuidObjectHashMap, hashedNodeMap, uuid });
});
};