import{DefinitionPath as a}from"../attributes/index.js";import{getNodeAttribute as o}from"../helpers/get-node-attribute.js";import{getResolvedSampleCodeBlock as p}from"../helpers/get-resolved-sample-code-block.js";const u={schema:{attributes:{descriptionFile:{type:a,required:!0},pointer:{type:String,required:!1},operationId:{type:String,required:!1},exampleKey:{type:String,required:!1},mimeType:{type:String,required:!1},language:{type:String,required:!1},parameters:{type:Object,default:{},required:!1},requestBody:{type:Object,required:!1},environments:{type:Object,default:{},required:!1},environment:{type:String,required:!1},codeSamplesResolved:{type:Array,required:!1,resolver:"openapiCodeSamples"}},validate(r){const e=[];return r.attributes.pointer&&r.attributes.operationId&&e.push({id:"pointer-and-operationId-attributes-are-mutually-exclusive",level:"error",message:'The "pointer" and "operationId" attributes are mutually exclusive, you can only use one.'}),!r.attributes.pointer&&!r.attributes.operationId&&e.push({id:"pointer-or-operationId-attribute-required",level:"error",message:'This tag requires the "pointer" or "operationId" attribute to render correctly.'}),e},render:"OpenApiCodeSample",selfClosing:!0,dynamicComponentLib:"openapi",renderForLlms(r){const e=o(r,"codeSamplesResolved");if(!Array.isArray(e)||e.length===0)return"";const t=e.find(({lang:i})=>i==="shell")??e[0];return p(t)}},tagName:"openapi-code-sample"};export{u as openApiCodeSample};
