@mintlify/validation
Version:
Validates mint.json files
15 lines (14 loc) • 628 B
JavaScript
import { v4 as uuidv4 } from 'uuid';
import { mapPath } from './mapPath.js';
export const mapPathComponents = ({ spec, refUuidMap, uuidObjectHashMap, hashedNodeMap, }) => {
if (!spec.components || !('pathItems' in spec.components))
return;
const pathComponents = spec.components.pathItems;
if (!pathComponents)
return;
Object.entries(pathComponents).forEach(([name, pathItem]) => {
const refId = `#/components/pathItems/${name}`;
const uuid = refUuidMap[refId] || uuidv4();
mapPath({ pathItem, refUuidMap, uuidObjectHashMap, hashedNodeMap, uuid, path: name });
});
};