import l from"@markdoc/markdoc";import{SampleFromJsonSchema as m,JsonExampleRef as n}from"../attributes/index.js";const v={schema:{attributes:{value:{type:n,required:!1},schema:{type:m,required:!1},mode:{type:String,matches:["read","write"],required:!1},title:{type:String,required:!1},valueResolved:{required:!1},valueResolvedErrors:{type:Array,default:[]},schemaResolved:{required:!1},schemaResolvedErrors:{type:Array,default:[]}},render:"JsonExample",selfClosing:!0,dynamicComponentLib:"openapi",transform:(e,r)=>{const o=e.transformAttributes(r),{valueResolved:a,schemaResolved:u,schemaResolvedErrors:i,valueResolvedErrors:t,title:s}=o;return a||t.length?new l.Tag("JsonExample",{title:s,json:a,errors:t}):new l.Tag("JsonExample",{title:s,json:u,errors:i})},validate(e){const r=[];return e.attributes.schema&&e.attributes.value&&r.push({id:"schema-and-value-attributes-are-mutually-exclusive",level:"error",message:'The "schema" and "value" attributes are mutually exclusive, you can only use one.'}),!e.attributes.schema&&!e.attributes.value&&r.push({id:"schema-or-value-attribute-required",level:"error",message:'This tag requires the "schema" or "value" attribute to render correctly.'}),r}},tagName:"json-example"};export{v as jsonExample};
