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