import{entityFileSchema as r,entityRelationFileSchema as d,entityBaseProperties as l}from"@redocly/config";import{createValidator as n}from"../utils/ajv-validator.js";const s=n(d,{errorPrefix:"Entity relation validation failed:",dataVar:"relation"});function p(t){s(t)}function m(t,e){const i=o(e);return n(i,{errorPrefix:"Entity validation failed:",dataVar:"entity"})(t)}function f(t,e){const i={type:"array",items:o(e)};return n(i,{errorPrefix:"Entity validation failed:",dataVar:"entity"})(t)}function o(t){const e=Object.entries(t.entityTypes??{}).map(([i,a])=>({type:"object",properties:{...l,type:{const:i},metadata:{additionalProperties:!0,...a.metadataSchema}},required:["key","title","type"],additionalProperties:!1}));return{...r,oneOf:[...r.oneOf,...e]}}export{f as parseAndValidateEntities,m as parseAndValidateEntity,p as validateEntityRelation};
