[{"data":1,"prerenderedAt":4035,"buildId":4036},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fast":3},{"id":4,"title":5,"body":6,"description":4017,"extension":4018,"frontmatter":4019,"heading":5,"meta":4026,"navigation":4028,"order":4022,"path":4029,"seo":4030,"sitemap":4031,"source":4032,"stem":4033,"__hash__":4034},"docs\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fast.md","AST and node builders",{"type":7,"value":8,"toc":3989},"minimark",[9,16,38,185,189,214,218,225,228,232,246,384,409,414,419,512,601,606,640,698,712,721,1076,1082,1107,1247,1253,1265,1309,1511,1523,1565,1570,1599,1752,1758,1772,1809,1883,1907,1920,1926,1989,2000,2121,2127,2132,2188,2319,2325,2472,2612,2935,2945,2951,2954,2995,3047,3053,3081,3146,3150,3189,3213,3228,3232,3240,3331,3361,3442,3455,3542,3556,3674,3687,3695,3702,3706,3709,3725,3886,3890,3899],[10,11,13],"h2",{"id":12},"ast",[14,15,12],"code",{},[17,18,19,21,22,25,26,29,30,33,34,37],"p",{},[14,20,12],{}," from ",[14,23,24],{},"kubb\u002Fkit"," gives you the whole AST API in one namespace, like ",[14,27,28],{},"ts.factory"," for TypeScript. ",[14,31,32],{},"ast.factory"," builds nodes, and ",[14,35,36],{},"ast.node"," walks them. Each other group reads one subject, such as refs.",[39,40,45],"pre",{"language":41,"filename":42,"code":43,"class":44},"typescript","ast-namespace.ts","import { ast } from 'kubb\u002Fkit'\n\nconst root = ast.factory.createInput({\n schemas: [ast.factory.createSchema({ name: 'Pet', type: 'object', properties: [] })],\n operations: [],\n})","highlights",[14,46,48,75,76,75,78,75,106,75,166,75,180],{"class":47},"language-typescript",[49,50,53,57,61,65,68,71],"span",{"class":51,"style":52},"line","display: inline",[49,54,56],{"style":55},"color:#d73a49;--hls-dark:#f97583","import ",[49,58,60],{"style":59},"color:#005cc5;--hls-dark:#79b8ff","{ ",[49,62,64],{"style":63},"color:#24292e;--hls-dark:#e1e4e8","ast ",[49,66,67],{"style":59},"} ",[49,69,70],{"style":55},"from ",[49,72,74],{"style":73},"color:#032f62;--hls-dark:#9ecbff","'kubb\u002Fkit'","\n",[49,77],{"class":51,"style":52},[49,79,80,83,86,89,91,94,97,99,103],{"class":51,"style":52},[49,81,82],{"style":55},"const ",[49,84,85],{"style":63},"root ",[49,87,88],{"style":55},"= ",[49,90,12],{"style":63},[49,92,93],{"style":55},".",[49,95,96],{"style":59},"factory",[49,98,93],{"style":55},[49,100,102],{"style":101},"color:#6f42c1;--hls-dark:#b392f0","createInput",[49,104,105],{"style":59},"({",[49,107,108,111,114,117,120,122,124,126,128,131,134,137,139,142,145,148,150,153,155,158,160,163],{"class":51,"style":52},[49,109,110],{"style":59}," ",[49,112,113],{"style":59},"schemas",[49,115,116],{"style":55},": ",[49,118,119],{"style":59},"[",[49,121,12],{"style":63},[49,123,93],{"style":55},[49,125,96],{"style":59},[49,127,93],{"style":55},[49,129,130],{"style":101},"createSchema",[49,132,133],{"style":59},"({ ",[49,135,136],{"style":59},"name",[49,138,116],{"style":55},[49,140,141],{"style":73},"'Pet'",[49,143,144],{"style":55},", ",[49,146,147],{"style":59},"type",[49,149,116],{"style":55},[49,151,152],{"style":73},"'object'",[49,154,144],{"style":55},[49,156,157],{"style":59},"properties",[49,159,116],{"style":55},[49,161,162],{"style":59},"[] })]",[49,164,165],{"style":55},",",[49,167,168,170,173,175,178],{"class":51,"style":52},[49,169,110],{"style":55},[49,171,172],{"style":59},"operations",[49,174,116],{"style":55},[49,176,177],{"style":59},"[]",[49,179,165],{"style":55},[49,181,182],{"class":51,"style":52},[49,183,184],{"style":59},"})",[10,186,188],{"id":187},"node-tree","Node tree",[17,190,191,192,195,196,199,200,203,204,206,207,210,211,213],{},"An adapter returns one ",[14,193,194],{},"InputNode",". Every node has a ",[14,197,198],{},"kind",", such as ",[14,201,202],{},"'Schema'",". A schema also has a ",[14,205,147],{},". A ",[14,208,209],{},"ref"," schema points at a schema in ",[14,212,113],{}," instead of copying it.",[215,216],"mermaid",{"svg":217},"\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" class=\"pele pele-flowchart\" viewBox=\"0 0 843 484\" width=\"843\" height=\"484\" style=\"--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,monospace);font:16px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,sans-serif)\" fill=\"var(--_fg)\" role=\"graphics-document document\" aria-roledescription=\"flowchart\">\u003Cg class=\"pele-edges\" fill=\"none\" stroke=\"var(--_l)\" stroke-linecap=\"round\">\u003Cg class=\"pele-edge\" data-id=\"L_input_schemas_0\">\u003Cpath d=\"M538.6,56C538.6,74.49 119.82,81.51 119.82,100L119.82,106\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M119.82,113L116.46,105L123.18,105Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_input_operations_0\">\u003Cpath d=\"M554.6,56L554.6,97\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M554.6,104L551.24,96L557.96,96Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_input_meta_0\">\u003Cpath d=\"M570.6,56C570.6,78 747.1,78 747.1,100L747.1,106\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M747.1,113L743.74,105L750.46,105Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_operations_parameters_0\">\u003Cpath d=\"M529.9,170C529.9,187.5 350.54,187.5 350.54,205L350.54,211\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M350.54,218L347.18,210L353.9,210Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_operations_requestBody_0\">\u003Cpath d=\"M554.6,170L554.6,211\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M554.6,218L551.24,210L557.96,210Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_operations_responses_0\">\u003Cpath d=\"M579.3,170C579.3,187.5 757.33,187.5 757.33,205L757.33,211\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M757.33,218L753.97,210L760.69,210Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_requestBody_content_0\">\u003Cpath d=\"M554.6,284L554.6,325\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M554.6,332L551.24,324L557.96,324Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_responses_content_0\">\u003Cpath d=\"M757.33,284C757.33,301.5 624.22,301.5 624.22,319L624.22,325\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M624.22,332L620.86,324L627.58,324Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_schemas_properties_0\">\u003Cpath d=\"M119.82,161L119.82,220\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M119.82,227L116.46,219L123.18,219Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_parameters_schema_0\">\u003Cpath d=\"M350.54,284L350.54,380C350.54,397.5 325.99,397.5 325.99,415L325.99,421\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M325.99,428L322.63,420L329.35,420Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_properties_schema_0\">\u003Cpath d=\"M119.82,275L119.82,380C119.82,397.5 223.6,397.5 223.6,415L223.6,421\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M223.6,428L220.24,420L226.96,420Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_content_schema_0\">\u003Cpath d=\"M575.94,380C575.94,397.5 341.99,397.5 341.99,415L341.99,421\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M341.99,428L338.63,420L345.35,420Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"pele-nodes\">\u003Cg class=\"pele-node pele-shape-rect core\" data-id=\"input\" transform=\"translate(554.6,32)\">\u003Crect x=\"-54.91\" y=\"-24\" width=\"109.82\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">InputNode\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"schemas\" transform=\"translate(119.82,137)\">\u003Crect x=\"-107.37\" y=\"-24\" width=\"214.74\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">schemas: SchemaNode[]\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"operations\" transform=\"translate(554.6,137)\">\u003Crect x=\"-76.7\" y=\"-33\" width=\"153.39\" height=\"66\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-4.9\">operations:\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"16.1\">OperationNode[]\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"meta\" transform=\"translate(747.1,137)\">\u003Crect x=\"-75.81\" y=\"-24\" width=\"151.62\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">meta: InputMeta\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"parameters\" transform=\"translate(350.54,251)\">\u003Crect x=\"-78.91\" y=\"-33\" width=\"157.82\" height=\"66\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-4.9\">parameters:\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"16.1\">ParameterNode[]\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"requestBody\" transform=\"translate(554.6,251)\">\u003Crect x=\"-85.14\" y=\"-33\" width=\"170.29\" height=\"66\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-4.9\">requestBody:\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"16.1\">RequestBodyNode\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"responses\" transform=\"translate(757.33,251)\">\u003Crect x=\"-77.58\" y=\"-33\" width=\"155.17\" height=\"66\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-4.9\">responses:\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"16.1\">ResponseNode[]\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"content\" transform=\"translate(575.94,356)\">\u003Crect x=\"-100.27\" y=\"-24\" width=\"200.54\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">content: ContentNode[]\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"properties\" transform=\"translate(119.82,251)\">\u003Crect x=\"-111.82\" y=\"-24\" width=\"223.63\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">properties: PropertyNode[]\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"schema\" transform=\"translate(270.52,452)\">\u003Crect x=\"-98.92\" y=\"-24\" width=\"197.84\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">schema: SchemaNode\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003C\u002Fsvg>",[17,219,220,221,224],{},"A template returns ",[14,222,223],{},"FileNode","s, a second tree:",[215,226],{"svg":227},"\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" class=\"pele pele-flowchart\" viewBox=\"0 0 630 260\" width=\"630\" height=\"260\" style=\"--_bg:var(--pele-bg,#fff);--_fg:var(--pele-fg,#1f1f1f);--_m:var(--pele-muted,#6e6e6e);--_l:var(--pele-line,#1f1f1f);--_s:var(--pele-surface,#f3f3f3);--_a:var(--pele-surface-alt,#e6e6e6);--_b:var(--pele-border,#8a8a8a);--_c:var(--pele-accent,#5b7bd5);color:var(--_fg);--_r:var(--pele-radius,4px);--_fm:var(--pele-font-mono,monospace);font:16px sans-serif;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;font-family:var(--pele-font,sans-serif)\" fill=\"var(--_fg)\" role=\"graphics-document document\" aria-roledescription=\"flowchart\">\u003Cg class=\"pele-edges\" fill=\"none\" stroke=\"var(--_l)\" stroke-linecap=\"round\">\u003Cg class=\"pele-edge\" data-id=\"L_file_sources_0\">\u003Cpath d=\"M108.02,127.5C125.52,127.5 125.52,51.5 143.02,51.5L149.02,51.5\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M156.02,51.5L148.02,54.86L148.02,48.14Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_file_imports_0\">\u003Cpath d=\"M108.02,139.5L153.47,139.5\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M160.47,139.5L152.47,142.86L152.47,136.14Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_file_exports_0\">\u003Cpath d=\"M108.02,151.5C127.52,151.5 127.52,227.5 147.02,227.5L153.02,227.5\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M160.02,227.5L152.02,230.86L152.02,224.14Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"pele-edge\" data-id=\"L_sources_nodes_0\">\u003Cpath d=\"M354.75,51.5L395.75,51.5\"\u002F>\u003Cpath class=\"pele-marker\" d=\"M402.75,51.5L394.75,54.86L394.75,48.14Z\" fill=\"var(--_l)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"pele-nodes\">\u003Cg class=\"pele-node pele-shape-rect core\" data-id=\"file\" transform=\"translate(58.01,139.5)\">\u003Crect x=\"-50.01\" y=\"-24\" width=\"100.02\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">FileNode\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"sources\" transform=\"translate(255.38,51.5)\">\u003Crect x=\"-99.37\" y=\"-24\" width=\"198.74\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">sources: SourceNode[]\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"imports\" transform=\"translate(255.38,139.5)\">\u003Crect x=\"-94.91\" y=\"-24\" width=\"189.82\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">imports: ImportNode[]\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"exports\" transform=\"translate(255.38,227.5)\">\u003Crect x=\"-95.37\" y=\"-24\" width=\"190.74\" height=\"48\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" x=\"0\" y=\"5.6\" text-anchor=\"middle\">exports: ExportNode[]\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"pele-node pele-shape-rect\" data-id=\"nodes\" transform=\"translate(512.35,51.5)\">\u003Crect x=\"-109.6\" y=\"-43.5\" width=\"219.2\" height=\"87\" fill=\"var(--_s)\" stroke=\"var(--_b)\" style=\"rx:var(--_r)\"\u002F>\u003Ctext class=\"pele-label\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-15.4\">nodes: Text, Const, Type,\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"5.6\">Function, ArrowFunction,\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"26.6\">Jsx, Break\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003C\u002Fsvg>",[10,229,231],{"id":230},"schema-node-types","Schema node types",[17,233,234,235,238,239,241,242,245],{},"You narrow a ",[14,236,237],{},"SchemaNode"," by its ",[14,240,147],{},". ",[14,243,244],{},"ast.schema.types"," lists every value.",[247,248,249,265],"table",{},[250,251,252],"thead",{},[253,254,255,259,262],"tr",{},[256,257,258],"th",{},"Family",[256,260,261],{},"Types",[256,263,264],{},"Notes",[266,267,268,299,343],"tbody",{},[253,269,270,274,297],{},[271,272,273],"td",{},"Structural",[271,275,276,144,279,144,282,144,285,144,288,144,291,144,294],{},[14,277,278],{},"object",[14,280,281],{},"array",[14,283,284],{},"tuple",[14,286,287],{},"union",[14,289,290],{},"intersection",[14,292,293],{},"enum",[14,295,296],{},"not",[271,298],{},[253,300,301,304,336],{},[271,302,303],{},"Scalar",[271,305,306,144,309,144,312,144,315,144,318,144,321,144,324,144,327,144,330,144,333],{},[14,307,308],{},"string",[14,310,311],{},"number",[14,313,314],{},"integer",[14,316,317],{},"bigint",[14,319,320],{},"boolean",[14,322,323],{},"null",[14,325,326],{},"any",[14,328,329],{},"unknown",[14,331,332],{},"void",[14,334,335],{},"never",[271,337,338,340,341,93],{},[14,339,314],{}," prints as ",[14,342,311],{},[253,344,345,348,379],{},[271,346,347],{},"Special",[271,349,350,144,352,144,355,144,358,144,361,144,364,144,367,144,370,144,373,144,376],{},[14,351,209],{},[14,353,354],{},"date",[14,356,357],{},"datetime",[14,359,360],{},"time",[14,362,363],{},"uuid",[14,365,366],{},"email",[14,368,369],{},"url",[14,371,372],{},"ipv4",[14,374,375],{},"ipv6",[14,377,378],{},"blob",[271,380,381,383],{},[14,382,378],{}," is binary data",[17,385,386,387,390,391,394,395,397,398,401,402,405,406,93],{},"Schema, parameter, request body, response and content nodes keep the source object's vendor extensions (",[14,388,389],{},"x-*"," keys) in ",[14,392,393],{},"extensions",", as input and operation nodes do. A ",[14,396,378],{}," node keeps ",[14,399,400],{},"contentMediaType"," and ",[14,403,404],{},"contentEncoding"," in ",[14,407,408],{},"content",[10,410,412],{"id":411},"factory-functions",[14,413,32],{},[17,415,416,418],{},[14,417,32],{}," builds typed nodes with the defaults filled in. Use it instead of object literals.",[247,420,421,431],{},[250,422,423],{},[253,424,425,428],{},[256,426,427],{},"Tree",[256,429,430],{},"Factories",[266,432,433,465,484],{},[253,434,435,438],{},[271,436,437],{},"Input",[271,439,440,144,442,144,444,144,447,144,450,144,453,144,456,144,459,144,462],{},[14,441,102],{},[14,443,130],{},[14,445,446],{},"createOperation",[14,448,449],{},"createOperations",[14,451,452],{},"createParameter",[14,454,455],{},"createProperty",[14,457,458],{},"createResponse",[14,460,461],{},"createRequestBody",[14,463,464],{},"createContent",[253,466,467,470],{},[271,468,469],{},"File",[271,471,472,144,475,144,478,144,481],{},[14,473,474],{},"createFile",[14,476,477],{},"createSource",[14,479,480],{},"createImport",[14,482,483],{},"createExport",[253,485,486,489],{},[271,487,488],{},"Code nodes",[271,490,491,144,494,144,497,144,500,144,503,144,506,144,509],{},[14,492,493],{},"createText",[14,495,496],{},"createConst",[14,498,499],{},"createType",[14,501,502],{},"createFunction",[14,504,505],{},"createArrowFunction",[14,507,508],{},"createJsx",[14,510,511],{},"createBreak",[39,513,516],{"language":41,"filename":514,"code":515,"class":44},"factory.ts","import { ast } from 'kubb\u002Fkit'\n\nast.factory.createSchema({ type: 'string', format: 'email' })\n\u002F\u002F { kind: 'Schema', type: 'string', primitive: 'string', format: 'email' }\n\nast.factory.createText('export const a = 1')\n\u002F\u002F { kind: 'Text', value: 'export const a = 1' }",[14,517,518,75,532,75,534,75,567,75,573,75,575,75,596],{"class":47},[49,519,520,522,524,526,528,530],{"class":51,"style":52},[49,521,56],{"style":55},[49,523,60],{"style":59},[49,525,64],{"style":63},[49,527,67],{"style":59},[49,529,70],{"style":55},[49,531,74],{"style":73},[49,533],{"class":51,"style":52},[49,535,536,538,540,542,544,546,548,550,552,555,557,560,562,565],{"class":51,"style":52},[49,537,12],{"style":63},[49,539,93],{"style":55},[49,541,96],{"style":59},[49,543,93],{"style":55},[49,545,130],{"style":101},[49,547,133],{"style":59},[49,549,147],{"style":59},[49,551,116],{"style":55},[49,553,554],{"style":73},"'string'",[49,556,144],{"style":55},[49,558,559],{"style":59},"format",[49,561,116],{"style":55},[49,563,564],{"style":73},"'email' ",[49,566,184],{"style":59},[49,568,569],{"class":51,"style":52},[49,570,572],{"style":571},"color:#6a737d;--hls-dark:#6a737d","\u002F\u002F { kind: 'Schema', type: 'string', primitive: 'string', format: 'email' }",[49,574],{"class":51,"style":52},[49,576,577,579,581,583,585,587,590,593],{"class":51,"style":52},[49,578,12],{"style":63},[49,580,93],{"style":55},[49,582,96],{"style":59},[49,584,93],{"style":55},[49,586,493],{"style":101},[49,588,589],{"style":59},"(",[49,591,592],{"style":73},"'export const a = 1'",[49,594,595],{"style":59},")",[49,597,598],{"class":51,"style":52},[49,599,600],{"style":571},"\u002F\u002F { kind: 'Text', value: 'export const a = 1' }",[10,602,604],{"id":603},"visitors",[14,605,36],{},[17,607,608,610,611,144,614,144,617,144,620,144,623,626,627,630,631,636,637,93],{},[14,609,36],{}," walks a tree with a visitor, which has a callback per kind: ",[14,612,613],{},"input",[14,615,616],{},"operation",[14,618,619],{},"schema",[14,621,622],{},"property",[14,624,625],{},"parameter",", and ",[14,628,629],{},"response",". In a plugin, use a ",[632,633,635],"a",{"href":634},"#macros","macro"," instead of ",[14,638,639],{},"transform",[247,641,642,652],{},[250,643,644],{},[253,645,646,649],{},[256,647,648],{},"Helper",[256,650,651],{},"Returns",[266,653,654,664,674,688],{},[253,655,656,661],{},[271,657,658],{},[14,659,660],{},"ast.node.transform",[271,662,663],{},"A new tree with the visitor's replacements",[253,665,666,671],{},[271,667,668],{},[14,669,670],{},"ast.node.collect",[271,672,673],{},"The visitor's non-null results, depth-first",[253,675,676,681],{},[271,677,678],{},[14,679,680],{},"ast.node.kinds",[271,682,683,684,199,686],{},"Every node ",[14,685,198],{},[14,687,202],{},[253,689,690,695],{},[271,691,692],{},[14,693,694],{},"ast.node.getText",[271,696,697],{},"Code node text, joined by newlines",[17,699,700,701,704,705,707,708,711],{},"Pass ",[14,702,703],{},"depth: 'shallow'"," to ",[14,706,639],{}," or ",[14,709,710],{},"collect"," to skip nested schemas.",[17,713,700,714,717,718,720],{},[14,715,716],{},"parent"," to give the root of a subtree the parent the visitor sees, such as the ",[14,719,194],{}," that holds a schema. Nested nodes always get their real parent.",[39,722,725],{"language":41,"filename":723,"code":724,"class":44},"node.ts","import { ast } from 'kubb\u002Fkit'\n\nconst root = ast.factory.createInput({ schemas: [], operations: [] })\n\nconst strict = ast.node.transform(root, {\n schema(node) {\n return node.type === 'object' && node.additionalProperties === undefined ? { ...node, additionalProperties: false } : node\n },\n})\n\nconst mutations = ast.node.collect\u003Cast.OperationNode>(root, {\n operation(node) {\n return node.method === 'POST' ? node : undefined\n },\n})\n\u002F\u002F Array\u003COperationNode>\n\nast.node.kinds.schema \u002F\u002F 'Schema'\nast.node.getText([ast.factory.createText('const a = 1'), ast.factory.createText('const b = 2')]) \u002F\u002F 'const a = 1\\nconst b = 2'",[14,726,727,75,741,75,743,75,778,75,780,75,810,75,823,75,885,75,894,75,898,75,900,75,940,75,952,75,980,75,988,75,992,75,997,75,999,75,1020],{"class":47},[49,728,729,731,733,735,737,739],{"class":51,"style":52},[49,730,56],{"style":55},[49,732,60],{"style":59},[49,734,64],{"style":63},[49,736,67],{"style":59},[49,738,70],{"style":55},[49,740,74],{"style":73},[49,742],{"class":51,"style":52},[49,744,745,747,749,751,753,755,757,759,761,763,765,767,769,771,773,775],{"class":51,"style":52},[49,746,82],{"style":55},[49,748,85],{"style":63},[49,750,88],{"style":55},[49,752,12],{"style":63},[49,754,93],{"style":55},[49,756,96],{"style":59},[49,758,93],{"style":55},[49,760,102],{"style":101},[49,762,133],{"style":59},[49,764,113],{"style":59},[49,766,116],{"style":55},[49,768,177],{"style":59},[49,770,144],{"style":55},[49,772,172],{"style":59},[49,774,116],{"style":55},[49,776,777],{"style":59},"[] })",[49,779],{"class":51,"style":52},[49,781,782,784,787,789,791,793,796,798,800,802,805,807],{"class":51,"style":52},[49,783,82],{"style":55},[49,785,786],{"style":63},"strict ",[49,788,88],{"style":55},[49,790,12],{"style":63},[49,792,93],{"style":55},[49,794,795],{"style":59},"node",[49,797,93],{"style":55},[49,799,639],{"style":101},[49,801,589],{"style":59},[49,803,804],{"style":63},"root",[49,806,144],{"style":55},[49,808,809],{"style":59},"{",[49,811,812,814,816,818,820],{"class":51,"style":52},[49,813,110],{"style":59},[49,815,619],{"style":101},[49,817,589],{"style":59},[49,819,795],{"style":63},[49,821,822],{"style":59},") {",[49,824,825,828,831,833,835,838,841,844,847,849,851,854,856,859,862,864,867,869,871,874,876,879,881,883],{"class":51,"style":52},[49,826,827],{"style":59}," ",[49,829,830],{"style":55},"return ",[49,832,795],{"style":63},[49,834,93],{"style":55},[49,836,837],{"style":59},"type ",[49,839,840],{"style":55},"=== ",[49,842,843],{"style":73},"'object' ",[49,845,846],{"style":55},"&& ",[49,848,795],{"style":63},[49,850,93],{"style":55},[49,852,853],{"style":59},"additionalProperties ",[49,855,840],{"style":55},[49,857,858],{"style":59},"undefined ",[49,860,861],{"style":55},"? ",[49,863,60],{"style":59},[49,865,866],{"style":55},"...",[49,868,795],{"style":63},[49,870,144],{"style":55},[49,872,873],{"style":59},"additionalProperties",[49,875,116],{"style":55},[49,877,878],{"style":59},"false ",[49,880,67],{"style":59},[49,882,116],{"style":55},[49,884,795],{"style":63},[49,886,887,889,892],{"class":51,"style":52},[49,888,110],{"style":63},[49,890,891],{"style":59},"}",[49,893,165],{"style":55},[49,895,896],{"class":51,"style":52},[49,897,184],{"style":59},[49,899],{"class":51,"style":52},[49,901,902,904,907,909,911,913,915,917,919,922,924,926,929,932,934,936,938],{"class":51,"style":52},[49,903,82],{"style":55},[49,905,906],{"style":63},"mutations ",[49,908,88],{"style":55},[49,910,12],{"style":63},[49,912,93],{"style":55},[49,914,795],{"style":59},[49,916,93],{"style":55},[49,918,710],{"style":59},[49,920,921],{"style":55},"\u003C",[49,923,12],{"style":63},[49,925,93],{"style":55},[49,927,928],{"style":59},"OperationNode",[49,930,931],{"style":55},">",[49,933,589],{"style":59},[49,935,804],{"style":63},[49,937,144],{"style":55},[49,939,809],{"style":59},[49,941,942,944,946,948,950],{"class":51,"style":52},[49,943,110],{"style":59},[49,945,616],{"style":101},[49,947,589],{"style":59},[49,949,795],{"style":63},[49,951,822],{"style":59},[49,953,954,956,958,960,962,965,967,970,972,975,977],{"class":51,"style":52},[49,955,827],{"style":59},[49,957,830],{"style":55},[49,959,795],{"style":63},[49,961,93],{"style":55},[49,963,964],{"style":59},"method ",[49,966,840],{"style":55},[49,968,969],{"style":73},"'POST' ",[49,971,861],{"style":55},[49,973,974],{"style":63},"node ",[49,976,116],{"style":55},[49,978,979],{"style":59},"undefined",[49,981,982,984,986],{"class":51,"style":52},[49,983,110],{"style":59},[49,985,891],{"style":59},[49,987,165],{"style":55},[49,989,990],{"class":51,"style":52},[49,991,184],{"style":59},[49,993,994],{"class":51,"style":52},[49,995,996],{"style":571},"\u002F\u002F Array\u003COperationNode>",[49,998],{"class":51,"style":52},[49,1000,1001,1003,1005,1007,1009,1012,1014,1017],{"class":51,"style":52},[49,1002,12],{"style":63},[49,1004,93],{"style":55},[49,1006,795],{"style":59},[49,1008,93],{"style":55},[49,1010,1011],{"style":59},"kinds",[49,1013,93],{"style":55},[49,1015,1016],{"style":59},"schema ",[49,1018,1019],{"style":571},"\u002F\u002F 'Schema'",[49,1021,1022,1024,1026,1028,1030,1033,1036,1038,1040,1042,1044,1046,1048,1051,1053,1055,1057,1059,1061,1063,1065,1067,1070,1073],{"class":51,"style":52},[49,1023,12],{"style":63},[49,1025,93],{"style":55},[49,1027,795],{"style":59},[49,1029,93],{"style":55},[49,1031,1032],{"style":101},"getText",[49,1034,1035],{"style":59},"([",[49,1037,12],{"style":63},[49,1039,93],{"style":55},[49,1041,96],{"style":59},[49,1043,93],{"style":55},[49,1045,493],{"style":101},[49,1047,589],{"style":59},[49,1049,1050],{"style":73},"'const a = 1'",[49,1052,595],{"style":59},[49,1054,144],{"style":55},[49,1056,12],{"style":63},[49,1058,93],{"style":55},[49,1060,96],{"style":59},[49,1062,93],{"style":55},[49,1064,493],{"style":101},[49,1066,589],{"style":59},[49,1068,1069],{"style":73},"'const b = 2'",[49,1071,1072],{"style":59},")]) ",[49,1074,1075],{"style":571},"\u002F\u002F 'const a = 1\\nconst b = 2'",[10,1077,1079],{"id":1078},"ast-file",[14,1080,1081],{},"ast.file",[247,1083,1084,1092],{},[250,1085,1086],{},[253,1087,1088,1090],{},[256,1089,648],{},[256,1091,651],{},[266,1093,1094],{},[253,1095,1096,1101],{},[271,1097,1098],{},[14,1099,1100],{},"ast.file.inline",[271,1102,1103,1106],{},[14,1104,1105],{},"{ files, virtualPaths, problems }",", with virtual-file imports inlined",[39,1108,1111],{"language":41,"filename":1109,"code":1110,"class":44},"file.ts","import { ast } from 'kubb\u002Fkit'\n\n\u002F\u002F Array\u003CFileNode>, Array\u003Cstring>, Array\u003C{ path: string, message: string }>\nconst {\n files: inlined,\n virtualPaths,\n problems,\n} = ast.file.inline(files, {\n language: (file) => parsers.get(file.extname)?.inline,\n})",[14,1112,1113,75,1127,75,1129,75,1134,75,1140,75,1154,75,1163,75,1172,75,1198,75,1243],{"class":47},[49,1114,1115,1117,1119,1121,1123,1125],{"class":51,"style":52},[49,1116,56],{"style":55},[49,1118,60],{"style":59},[49,1120,64],{"style":63},[49,1122,67],{"style":59},[49,1124,70],{"style":55},[49,1126,74],{"style":73},[49,1128],{"class":51,"style":52},[49,1130,1131],{"class":51,"style":52},[49,1132,1133],{"style":571},"\u002F\u002F Array\u003CFileNode>, Array\u003Cstring>, Array\u003C{ path: string, message: string }>",[49,1135,1136,1138],{"class":51,"style":52},[49,1137,82],{"style":55},[49,1139,809],{"style":59},[49,1141,1142,1144,1147,1149,1152],{"class":51,"style":52},[49,1143,110],{"style":59},[49,1145,1146],{"style":59},"files",[49,1148,116],{"style":55},[49,1150,1151],{"style":63},"inlined",[49,1153,165],{"style":55},[49,1155,1156,1158,1161],{"class":51,"style":52},[49,1157,110],{"style":55},[49,1159,1160],{"style":63},"virtualPaths",[49,1162,165],{"style":55},[49,1164,1165,1167,1170],{"class":51,"style":52},[49,1166,110],{"style":55},[49,1168,1169],{"style":63},"problems",[49,1171,165],{"style":55},[49,1173,1174,1176,1178,1180,1182,1185,1187,1190,1192,1194,1196],{"class":51,"style":52},[49,1175,67],{"style":59},[49,1177,88],{"style":55},[49,1179,12],{"style":63},[49,1181,93],{"style":55},[49,1183,1184],{"style":59},"file",[49,1186,93],{"style":55},[49,1188,1189],{"style":101},"inline",[49,1191,589],{"style":59},[49,1193,1146],{"style":63},[49,1195,144],{"style":55},[49,1197,809],{"style":59},[49,1199,1200,1202,1205,1207,1209,1211,1214,1217,1220,1222,1225,1227,1229,1231,1234,1236,1239,1241],{"class":51,"style":52},[49,1201,110],{"style":59},[49,1203,1204],{"style":59},"language",[49,1206,116],{"style":55},[49,1208,589],{"style":59},[49,1210,1184],{"style":63},[49,1212,1213],{"style":59},") ",[49,1215,1216],{"style":55},"=> ",[49,1218,1219],{"style":63},"parsers",[49,1221,93],{"style":55},[49,1223,1224],{"style":101},"get",[49,1226,589],{"style":59},[49,1228,1184],{"style":63},[49,1230,93],{"style":55},[49,1232,1233],{"style":59},"extname",[49,1235,595],{"style":59},[49,1237,1238],{"style":55},"?.",[49,1240,1189],{"style":59},[49,1242,165],{"style":55},[49,1244,1245],{"class":51,"style":52},[49,1246,184],{"style":59},[10,1248,1250],{"id":1249},"macros",[14,1251,1252],{},"ast.macro",[17,1254,1255,1256,1259,1260,1264],{},"A macro is a named transform that rewrites nodes before printing. Define one with ",[14,1257,1258],{},"defineMacro",", as ",[632,1261,1263],{"href":1262},"\u002Fdocs\u002F5.x\u002Fhow-to\u002Fcustomize#macros","Macros"," shows.",[247,1266,1267,1275],{},[250,1268,1269],{},[253,1270,1271,1273],{},[256,1272,648],{},[256,1274,651],{},[266,1276,1277,1287],{},[253,1278,1279,1284],{},[271,1280,1281],{},[14,1282,1283],{},"ast.macro.apply",[271,1285,1286],{},"The tree after running the macros",[253,1288,1289,1294],{},[271,1290,1291],{},[14,1292,1293],{},"ast.macro.compareOrder",[271,1295,1296,1297,1300,1301,1304,1305,1308],{},"Sorts ",[14,1298,1299],{},"enforce"," values: ",[14,1302,1303],{},"'pre'"," first, ",[14,1306,1307],{},"'post'"," last",[39,1310,1313],{"language":41,"filename":1311,"code":1312,"class":44},"macro.ts","import { ast, defineMacro } from 'kubb\u002Fkit'\n\nconst macroUntagged = defineMacro({\n name: 'untagged',\n operation: (node) => (node.tags?.length ? undefined : { ...node, tags: ['untagged'] }),\n})\n\nast.macro.apply(operation, [macroUntagged]).tags \u002F\u002F ['untagged']\nast.macro.compareOrder('pre', 'post') \u002F\u002F -2\nast.macro.compareOrder(undefined, 'post') \u002F\u002F -1",[14,1314,1315,75,1334,75,1336,75,1349,75,1362,75,1419,75,1423,75,1425,75,1460,75,1486],{"class":47},[49,1316,1317,1319,1321,1323,1325,1328,1330,1332],{"class":51,"style":52},[49,1318,56],{"style":55},[49,1320,60],{"style":59},[49,1322,12],{"style":63},[49,1324,144],{"style":55},[49,1326,1327],{"style":63},"defineMacro ",[49,1329,67],{"style":59},[49,1331,70],{"style":55},[49,1333,74],{"style":73},[49,1335],{"class":51,"style":52},[49,1337,1338,1340,1343,1345,1347],{"class":51,"style":52},[49,1339,82],{"style":55},[49,1341,1342],{"style":63},"macroUntagged ",[49,1344,88],{"style":55},[49,1346,1258],{"style":101},[49,1348,105],{"style":59},[49,1350,1351,1353,1355,1357,1360],{"class":51,"style":52},[49,1352,110],{"style":59},[49,1354,136],{"style":59},[49,1356,116],{"style":55},[49,1358,1359],{"style":73},"'untagged'",[49,1361,165],{"style":55},[49,1363,1364,1366,1368,1370,1372,1374,1376,1378,1380,1382,1384,1387,1389,1392,1394,1396,1398,1400,1402,1404,1406,1408,1410,1412,1414,1417],{"class":51,"style":52},[49,1365,110],{"style":55},[49,1367,616],{"style":59},[49,1369,116],{"style":55},[49,1371,589],{"style":59},[49,1373,795],{"style":63},[49,1375,1213],{"style":59},[49,1377,1216],{"style":55},[49,1379,589],{"style":59},[49,1381,795],{"style":63},[49,1383,93],{"style":55},[49,1385,1386],{"style":59},"tags",[49,1388,1238],{"style":55},[49,1390,1391],{"style":59},"length ",[49,1393,861],{"style":55},[49,1395,858],{"style":59},[49,1397,116],{"style":55},[49,1399,60],{"style":59},[49,1401,866],{"style":55},[49,1403,795],{"style":63},[49,1405,144],{"style":55},[49,1407,1386],{"style":59},[49,1409,116],{"style":55},[49,1411,119],{"style":59},[49,1413,1359],{"style":73},[49,1415,1416],{"style":59},"] })",[49,1418,165],{"style":55},[49,1420,1421],{"class":51,"style":52},[49,1422,184],{"style":59},[49,1424],{"class":51,"style":52},[49,1426,1427,1429,1431,1433,1435,1438,1440,1442,1444,1446,1449,1452,1454,1457],{"class":51,"style":52},[49,1428,12],{"style":63},[49,1430,93],{"style":55},[49,1432,635],{"style":59},[49,1434,93],{"style":55},[49,1436,1437],{"style":101},"apply",[49,1439,589],{"style":59},[49,1441,616],{"style":63},[49,1443,144],{"style":55},[49,1445,119],{"style":59},[49,1447,1448],{"style":63},"macroUntagged",[49,1450,1451],{"style":59},"])",[49,1453,93],{"style":55},[49,1455,1456],{"style":59},"tags ",[49,1458,1459],{"style":571},"\u002F\u002F ['untagged']",[49,1461,1462,1464,1466,1468,1470,1473,1475,1477,1479,1481,1483],{"class":51,"style":52},[49,1463,12],{"style":63},[49,1465,93],{"style":55},[49,1467,635],{"style":59},[49,1469,93],{"style":55},[49,1471,1472],{"style":101},"compareOrder",[49,1474,589],{"style":59},[49,1476,1303],{"style":73},[49,1478,144],{"style":55},[49,1480,1307],{"style":73},[49,1482,1213],{"style":59},[49,1484,1485],{"style":571},"\u002F\u002F -2",[49,1487,1488,1490,1492,1494,1496,1498,1500,1502,1504,1506,1508],{"class":51,"style":52},[49,1489,12],{"style":63},[49,1491,93],{"style":55},[49,1493,635],{"style":59},[49,1495,93],{"style":55},[49,1497,1472],{"style":101},[49,1499,589],{"style":59},[49,1501,979],{"style":59},[49,1503,144],{"style":55},[49,1505,1307],{"style":73},[49,1507,1213],{"style":59},[49,1509,1510],{"style":571},"\u002F\u002F -1",[17,1512,1513,1515,1516,401,1519,1522],{},[14,1514,24],{}," also exports built-in macros. Call ",[14,1517,1518],{},"macroDiscriminatorEnum",[14,1520,1521],{},"macroEnumName"," with options to get the macro.",[247,1524,1525,1535],{},[250,1526,1527],{},[253,1528,1529,1532],{},[256,1530,1531],{},"Macro",[256,1533,1534],{},"Purpose",[266,1536,1537,1547,1556],{},[253,1538,1539,1544],{},[271,1540,1541],{},[14,1542,1543],{},"macroDedupeUnion",[271,1545,1546],{},"Drops repeated union members, ignoring the source pointer",[253,1548,1549,1553],{},[271,1550,1551],{},[14,1552,1518],{},[271,1554,1555],{},"Turns a discriminator property into an enum of its values",[253,1557,1558,1562],{},[271,1559,1560],{},[14,1561,1521],{},[271,1563,1564],{},"Names an inline enum from its parent and property",[1566,1567,1569],"h3",{"id":1568},"macro-options-and-callbacks","Macro options and callbacks",[17,1571,1572,1573,1578,1579,1581,1582,401,1584,1587,1588,1259,1590,1593,1594,707,1596,1598],{},"A macro has the callbacks of an ",[632,1574,1576],{"href":1575},"#visitors",[14,1577,36],{}," visitor, a ",[14,1580,136],{},", and optional ",[14,1583,1299],{},[14,1585,1586],{},"match",". Each callback gets the visitor context, with the node's ",[14,1589,716],{},[14,1591,1592],{},"this"," and as its second argument. It returns a replacement node, or ",[14,1595,979],{},[14,1597,323],{}," to keep the original.",[39,1600,1603],{"language":41,"filename":1601,"code":1602,"class":44},"Type definition","type Macro = {\n name: string\n enforce?: 'pre' | 'post'\n match?: (node: Node) => boolean\n schema?(node: SchemaNode, context): SchemaNode | null | undefined\n operation?(node: OperationNode, context): OperationNode | null | undefined\n \u002F\u002F input, property, parameter, response\n}",[14,1604,1605,75,1616,75,1626,75,1645,75,1670,75,1706,75,1741,75,1748],{"class":47},[49,1606,1607,1609,1612,1614],{"class":51,"style":52},[49,1608,837],{"style":55},[49,1610,1611],{"style":101},"Macro ",[49,1613,88],{"style":55},[49,1615,809],{"style":59},[49,1617,1618,1620,1622,1624],{"class":51,"style":52},[49,1619,110],{"style":59},[49,1621,136],{"style":59},[49,1623,116],{"style":63},[49,1625,308],{"style":101},[49,1627,1628,1630,1632,1635,1637,1640,1643],{"class":51,"style":52},[49,1629,110],{"style":101},[49,1631,1299],{"style":63},[49,1633,1634],{"style":63},"?",[49,1636,116],{"style":55},[49,1638,1639],{"style":73},"'pre' ",[49,1641,1642],{"style":55},"| ",[49,1644,1307],{"style":73},[49,1646,1647,1649,1651,1653,1655,1657,1659,1661,1664,1666,1668],{"class":51,"style":52},[49,1648,110],{"style":73},[49,1650,1586],{"style":63},[49,1652,1634],{"style":63},[49,1654,116],{"style":55},[49,1656,589],{"style":59},[49,1658,795],{"style":63},[49,1660,116],{"style":63},[49,1662,1663],{"style":101},"Node",[49,1665,1213],{"style":59},[49,1667,1216],{"style":55},[49,1669,320],{"style":63},[49,1671,1672,1675,1677,1679,1681,1683,1685,1687,1690,1692,1694,1697,1699,1702,1704],{"class":51,"style":52},[49,1673,1674],{"style":63}," schema",[49,1676,1634],{"style":55},[49,1678,589],{"style":59},[49,1680,795],{"style":63},[49,1682,116],{"style":63},[49,1684,237],{"style":101},[49,1686,144],{"style":55},[49,1688,1689],{"style":63},"context",[49,1691,595],{"style":59},[49,1693,116],{"style":63},[49,1695,1696],{"style":101},"SchemaNode ",[49,1698,1642],{"style":55},[49,1700,1701],{"style":59},"null ",[49,1703,1642],{"style":55},[49,1705,979],{"style":59},[49,1707,1708,1710,1712,1714,1716,1718,1720,1722,1724,1726,1728,1730,1733,1735,1737,1739],{"class":51,"style":52},[49,1709,110],{"style":59},[49,1711,616],{"style":63},[49,1713,1634],{"style":55},[49,1715,589],{"style":59},[49,1717,795],{"style":63},[49,1719,116],{"style":63},[49,1721,928],{"style":101},[49,1723,144],{"style":55},[49,1725,1689],{"style":63},[49,1727,595],{"style":59},[49,1729,116],{"style":63},[49,1731,1732],{"style":101},"OperationNode ",[49,1734,1642],{"style":55},[49,1736,1701],{"style":59},[49,1738,1642],{"style":55},[49,1740,979],{"style":59},[49,1742,1743,1745],{"class":51,"style":52},[49,1744,110],{"style":59},[49,1746,1747],{"style":571},"\u002F\u002F input, property, parameter, response",[49,1749,1750],{"class":51,"style":52},[49,1751,891],{"style":59},[10,1753,1755],{"id":1754},"ast-json",[14,1756,1757],{},"ast.json",[17,1759,1760,1761,1763,1764,1767,1768,1771],{},"Use ",[14,1762,1757],{}," to cache a parsed spec or to send one to another thread or process. A plain ",[14,1765,1766],{},"JSON.stringify(root)"," writes the whole target schema again at every ref. ",[14,1769,1770],{},"ast.json.stringify"," writes each target once.",[247,1773,1774,1782],{},[250,1775,1776],{},[253,1777,1778,1780],{},[256,1779,648],{},[256,1781,651],{},[266,1783,1784,1796],{},[253,1785,1786,1790],{},[271,1787,1788],{},[14,1789,1770],{},[271,1791,1792,1793,1795],{},"JSON text for an ",[14,1794,194],{},", with every ref target written once",[253,1797,1798,1803],{},[271,1799,1800],{},[14,1801,1802],{},"ast.json.parse",[271,1804,1805,1806,1808],{},"The ",[14,1807,194],{}," from that text. Refs to one schema share one object again.",[39,1810,1813],{"language":41,"filename":1811,"code":1812,"class":44},"json.ts","import { ast } from 'kubb\u002Fkit'\n\nconst text = ast.json.stringify(root)\n\nast.json.parse(text) \u002F\u002F InputNode, equal to root",[14,1814,1815,75,1829,75,1831,75,1858,75,1860],{"class":47},[49,1816,1817,1819,1821,1823,1825,1827],{"class":51,"style":52},[49,1818,56],{"style":55},[49,1820,60],{"style":59},[49,1822,64],{"style":63},[49,1824,67],{"style":59},[49,1826,70],{"style":55},[49,1828,74],{"style":73},[49,1830],{"class":51,"style":52},[49,1832,1833,1835,1838,1840,1842,1844,1847,1849,1852,1854,1856],{"class":51,"style":52},[49,1834,82],{"style":55},[49,1836,1837],{"style":63},"text ",[49,1839,88],{"style":55},[49,1841,12],{"style":63},[49,1843,93],{"style":55},[49,1845,1846],{"style":59},"json",[49,1848,93],{"style":55},[49,1850,1851],{"style":101},"stringify",[49,1853,589],{"style":59},[49,1855,804],{"style":63},[49,1857,595],{"style":59},[49,1859],{"class":51,"style":52},[49,1861,1862,1864,1866,1868,1870,1873,1875,1878,1880],{"class":51,"style":52},[49,1863,12],{"style":63},[49,1865,93],{"style":55},[49,1867,1846],{"style":59},[49,1869,93],{"style":55},[49,1871,1872],{"style":101},"parse",[49,1874,589],{"style":59},[49,1876,1877],{"style":63},"text",[49,1879,1213],{"style":59},[49,1881,1882],{"style":571},"\u002F\u002F InputNode, equal to root",[17,1884,1885,1887,1888,1891,1892,1894,1895,1897,1898,401,1900,1902,1903,1906],{},[14,1886,1802],{}," throws ",[14,1889,1890],{},"Cannot read this AST JSON"," when the text has another format version, when ",[14,1893,613],{}," is not an ",[14,1896,437],{}," node with ",[14,1899,113],{},[14,1901,172],{}," arrays, when ",[14,1904,1905],{},"targets"," is not an array of objects, or when a ref points at a missing target.",[17,1908,1909,1910,1912,1913,401,1916,1919],{},"A ",[14,1911,223],{}," holds no refs, so plain ",[14,1914,1915],{},"JSON.stringify(file)",[14,1917,1918],{},"JSON.parse"," are enough for files.",[10,1921,1923],{"id":1922},"ast-ref",[14,1924,1925],{},"ast.ref",[247,1927,1928,1936],{},[250,1929,1930],{},[253,1931,1932,1934],{},[256,1933,648],{},[256,1935,651],{},[266,1937,1938,1955,1965,1975],{},[253,1939,1940,1945],{},[271,1941,1942],{},[14,1943,1944],{},"ast.ref.getName",[271,1946,1947,1948,1951,1952,93],{},"The target name, ",[14,1949,1950],{},"targetName"," first. Pass the node, not ",[14,1953,1954],{},"node.ref",[253,1956,1957,1962],{},[271,1958,1959],{},[14,1960,1961],{},"ast.ref.getSchema",[271,1963,1964],{},"The schema a ref points at, or the node itself",[253,1966,1967,1972],{},[271,1968,1969],{},[14,1970,1971],{},"ast.ref.isAlias",[271,1973,1974],{},"Whether a ref adds nothing and prints as its target name",[253,1976,1977,1982],{},[271,1978,1979],{},[14,1980,1981],{},"ast.ref.mergeSchema",[271,1983,1984,1985,1988],{},"The ref merged with its schema, ref fields such as ",[14,1986,1987],{},"description"," winning",[17,1990,1991,1993,1994,401,1997,93],{},[14,1992,24],{}," also exports the name builders ",[14,1995,1996],{},"childName",[14,1998,1999],{},"enumPropName",[39,2001,2004],{"language":41,"filename":2002,"code":2003,"class":44},"ref.ts","import { ast } from 'kubb\u002Fkit'\n\nast.ref.getName('#\u002Fcomponents\u002Fschemas\u002FPet') \u002F\u002F 'Pet'\nast.ref.getSchema(petRef).type \u002F\u002F 'object'\nast.ref.isAlias(petRef) \u002F\u002F true\nast.ref.mergeSchema(petRef).description \u002F\u002F 'The owner pet', from the ref",[14,2005,2006,75,2020,75,2022,75,2045,75,2072,75,2094],{"class":47},[49,2007,2008,2010,2012,2014,2016,2018],{"class":51,"style":52},[49,2009,56],{"style":55},[49,2011,60],{"style":59},[49,2013,64],{"style":63},[49,2015,67],{"style":59},[49,2017,70],{"style":55},[49,2019,74],{"style":73},[49,2021],{"class":51,"style":52},[49,2023,2024,2026,2028,2030,2032,2035,2037,2040,2042],{"class":51,"style":52},[49,2025,12],{"style":63},[49,2027,93],{"style":55},[49,2029,209],{"style":59},[49,2031,93],{"style":55},[49,2033,2034],{"style":101},"getName",[49,2036,589],{"style":59},[49,2038,2039],{"style":73},"'#\u002Fcomponents\u002Fschemas\u002FPet'",[49,2041,1213],{"style":59},[49,2043,2044],{"style":571},"\u002F\u002F 'Pet'",[49,2046,2047,2049,2051,2053,2055,2058,2060,2063,2065,2067,2069],{"class":51,"style":52},[49,2048,12],{"style":63},[49,2050,93],{"style":55},[49,2052,209],{"style":59},[49,2054,93],{"style":55},[49,2056,2057],{"style":101},"getSchema",[49,2059,589],{"style":59},[49,2061,2062],{"style":63},"petRef",[49,2064,595],{"style":59},[49,2066,93],{"style":55},[49,2068,837],{"style":59},[49,2070,2071],{"style":571},"\u002F\u002F 'object'",[49,2073,2074,2076,2078,2080,2082,2085,2087,2089,2091],{"class":51,"style":52},[49,2075,12],{"style":63},[49,2077,93],{"style":55},[49,2079,209],{"style":59},[49,2081,93],{"style":55},[49,2083,2084],{"style":101},"isAlias",[49,2086,589],{"style":59},[49,2088,2062],{"style":63},[49,2090,1213],{"style":59},[49,2092,2093],{"style":571},"\u002F\u002F true",[49,2095,2096,2098,2100,2102,2104,2107,2109,2111,2113,2115,2118],{"class":51,"style":52},[49,2097,12],{"style":63},[49,2099,93],{"style":55},[49,2101,209],{"style":59},[49,2103,93],{"style":55},[49,2105,2106],{"style":101},"mergeSchema",[49,2108,589],{"style":59},[49,2110,2062],{"style":63},[49,2112,595],{"style":59},[49,2114,93],{"style":55},[49,2116,2117],{"style":59},"description ",[49,2119,2120],{"style":571},"\u002F\u002F 'The owner pet', from the ref",[10,2122,2124],{"id":2123},"ast-graph",[14,2125,2126],{},"ast.graph",[17,2128,1760,2129,2131],{},[14,2130,2126],{}," to drop unused schemas or to wrap circular ones in a lazy getter.",[247,2133,2134,2142],{},[250,2135,2136],{},[253,2137,2138,2140],{},[256,2139,648],{},[256,2141,651],{},[266,2143,2144,2154,2168,2178],{},[253,2145,2146,2151],{},[271,2147,2148],{},[14,2149,2150],{},"ast.graph.getRefNames",[271,2152,2153],{},"Every schema name a node refers to, at any depth",[253,2155,2156,2161],{},[271,2157,2158],{},[14,2159,2160],{},"ast.graph.getImportedNames",[271,2162,2163,2164,2167],{},"The ref names a printed schema imports. ",[14,2165,2166],{},"{ checks: true }"," adds refs in checks.",[253,2169,2170,2175],{},[271,2171,2172],{},[14,2173,2174],{},"ast.graph.getUsedNames",[271,2176,2177],{},"The schema names operations reach, also through other schemas",[253,2179,2180,2185],{},[271,2181,2182],{},[14,2183,2184],{},"ast.graph.getCircularNames",[271,2186,2187],{},"The schemas in a circular chain",[39,2189,2192],{"language":41,"filename":2190,"code":2191,"class":44},"graph.ts","import { ast } from 'kubb\u002Fkit'\n\nast.graph.getRefNames(ownerSchema) \u002F\u002F Set { 'Pet' }\nast.graph.getImportedNames(petListSchema) \u002F\u002F ['Pet']\nast.graph.getUsedNames(root.operations, root.schemas) \u002F\u002F Set { 'Pet' }\nast.graph.getCircularNames([nodeSchema, tagSchema]) \u002F\u002F Set { 'Node' }",[14,2193,2194,75,2208,75,2210,75,2234,75,2257,75,2290],{"class":47},[49,2195,2196,2198,2200,2202,2204,2206],{"class":51,"style":52},[49,2197,56],{"style":55},[49,2199,60],{"style":59},[49,2201,64],{"style":63},[49,2203,67],{"style":59},[49,2205,70],{"style":55},[49,2207,74],{"style":73},[49,2209],{"class":51,"style":52},[49,2211,2212,2214,2216,2219,2221,2224,2226,2229,2231],{"class":51,"style":52},[49,2213,12],{"style":63},[49,2215,93],{"style":55},[49,2217,2218],{"style":59},"graph",[49,2220,93],{"style":55},[49,2222,2223],{"style":101},"getRefNames",[49,2225,589],{"style":59},[49,2227,2228],{"style":63},"ownerSchema",[49,2230,1213],{"style":59},[49,2232,2233],{"style":571},"\u002F\u002F Set { 'Pet' }",[49,2235,2236,2238,2240,2242,2244,2247,2249,2252,2254],{"class":51,"style":52},[49,2237,12],{"style":63},[49,2239,93],{"style":55},[49,2241,2218],{"style":59},[49,2243,93],{"style":55},[49,2245,2246],{"style":101},"getImportedNames",[49,2248,589],{"style":59},[49,2250,2251],{"style":63},"petListSchema",[49,2253,1213],{"style":59},[49,2255,2256],{"style":571},"\u002F\u002F ['Pet']",[49,2258,2259,2261,2263,2265,2267,2270,2272,2274,2276,2278,2280,2282,2284,2286,2288],{"class":51,"style":52},[49,2260,12],{"style":63},[49,2262,93],{"style":55},[49,2264,2218],{"style":59},[49,2266,93],{"style":55},[49,2268,2269],{"style":101},"getUsedNames",[49,2271,589],{"style":59},[49,2273,804],{"style":63},[49,2275,93],{"style":55},[49,2277,172],{"style":59},[49,2279,144],{"style":55},[49,2281,804],{"style":63},[49,2283,93],{"style":55},[49,2285,113],{"style":59},[49,2287,1213],{"style":59},[49,2289,2233],{"style":571},[49,2291,2292,2294,2296,2298,2300,2303,2305,2308,2310,2313,2316],{"class":51,"style":52},[49,2293,12],{"style":63},[49,2295,93],{"style":55},[49,2297,2218],{"style":59},[49,2299,93],{"style":55},[49,2301,2302],{"style":101},"getCircularNames",[49,2304,1035],{"style":59},[49,2306,2307],{"style":63},"nodeSchema",[49,2309,144],{"style":55},[49,2311,2312],{"style":63},"tagSchema",[49,2314,2315],{"style":59},"]) ",[49,2317,2318],{"style":571},"\u002F\u002F Set { 'Node' }",[10,2320,2322],{"id":2321},"ast-schema",[14,2323,2324],{},"ast.schema",[247,2326,2327,2335],{},[250,2328,2329],{},[253,2330,2331,2333],{},[256,2332,648],{},[256,2334,651],{},[266,2336,2337,2350,2365,2379,2397,2407,2417,2427,2443],{},[253,2338,2339,2343],{},[271,2340,2341],{},[14,2342,244],{},[271,2344,2345,2346,199,2348],{},"Every schema ",[14,2347,147],{},[14,2349,554],{},[253,2351,2352,2357],{},[271,2353,2354],{},[14,2355,2356],{},"ast.schema.narrow",[271,2358,2359,2360,2362,2363],{},"The schema typed as a given ",[14,2361,147],{},", or ",[14,2364,323],{},[253,2366,2367,2372],{},[271,2368,2369],{},[14,2370,2371],{},"ast.schema.find",[271,2373,2374,2375,2378],{},"The first matching schema. ",[14,2376,2377],{},"follow: ['ref']"," also searches resolved refs.",[253,2380,2381,2386],{},[271,2382,2383],{},[14,2384,2385],{},"ast.schema.applyOptionality",[271,2387,2388,2389,2392,2393,2396],{},"Marks the schema ",[14,2390,2391],{},"optional"," if not required, ",[14,2394,2395],{},"nullish"," if also nullable",[253,2398,2399,2404],{},[271,2400,2401],{},[14,2402,2403],{},"ast.schema.findProperties",[271,2405,2406],{},"The named properties on an object, resolved ref, or intersection, not a union",[253,2408,2409,2414],{},[271,2410,2411],{},[14,2412,2413],{},"ast.schema.getLiterals",[271,2415,2416],{},"The literals an enum, resolved ref, or literal union allows",[253,2418,2419,2424],{},[271,2420,2421],{},[14,2422,2423],{},"ast.schema.inferDiscriminator",[271,2425,2426],{},"The property each member pins to its own literal",[253,2428,2429,2434],{},[271,2430,2431],{},[14,2432,2433],{},"ast.schema.getEmbeddedJson",[271,2435,2436,2437,2439,2440,595],{},"The schema of JSON inside a string (",[14,2438,400],{}," with ",[14,2441,2442],{},"contentSchema",[253,2444,2445,2450],{},[271,2446,2447],{},[14,2448,2449],{},"ast.schema.is",[271,2451,2452,2453,144,2456,144,2458,144,2460,144,2463,144,2466,2362,2469],{},"Whether a schema is ",[14,2454,2455],{},"binary",[14,2457,308],{},[14,2459,1877],{},[14,2461,2462],{},"scalar",[14,2464,2465],{},"const",[14,2467,2468],{},"enumLike",[14,2470,2471],{},"untyped",[39,2473,2477],{"language":41,"meta":2474,"code":2475,"filename":2476,"class":44},"twoslash","import { ast } from 'kubb\u002Fkit'\n\nconst root = ast.factory.createInput({ schemas: [], operations: [] })\n\nconst dateSchema = ast.schema.find(root, {\n follow: ['ref'],\n predicate: (schema) => schema.type === 'date',\n})","schema.ts",[14,2478,2479,75,2493,75,2495,75,2529,75,2531,75,2559,75,2578,75,2608],{"class":47},[49,2480,2481,2483,2485,2487,2489,2491],{"class":51,"style":52},[49,2482,56],{"style":55},[49,2484,60],{"style":59},[49,2486,64],{"style":63},[49,2488,67],{"style":59},[49,2490,70],{"style":55},[49,2492,74],{"style":73},[49,2494],{"class":51,"style":52},[49,2496,2497,2499,2501,2503,2505,2507,2509,2511,2513,2515,2517,2519,2521,2523,2525,2527],{"class":51,"style":52},[49,2498,82],{"style":55},[49,2500,85],{"style":63},[49,2502,88],{"style":55},[49,2504,12],{"style":63},[49,2506,93],{"style":55},[49,2508,96],{"style":59},[49,2510,93],{"style":55},[49,2512,102],{"style":101},[49,2514,133],{"style":59},[49,2516,113],{"style":59},[49,2518,116],{"style":55},[49,2520,177],{"style":59},[49,2522,144],{"style":55},[49,2524,172],{"style":59},[49,2526,116],{"style":55},[49,2528,777],{"style":59},[49,2530],{"class":51,"style":52},[49,2532,2533,2535,2538,2540,2542,2544,2546,2548,2551,2553,2555,2557],{"class":51,"style":52},[49,2534,82],{"style":55},[49,2536,2537],{"style":63},"dateSchema ",[49,2539,88],{"style":55},[49,2541,12],{"style":63},[49,2543,93],{"style":55},[49,2545,619],{"style":59},[49,2547,93],{"style":55},[49,2549,2550],{"style":101},"find",[49,2552,589],{"style":59},[49,2554,804],{"style":63},[49,2556,144],{"style":55},[49,2558,809],{"style":59},[49,2560,2561,2563,2566,2568,2570,2573,2576],{"class":51,"style":52},[49,2562,110],{"style":59},[49,2564,2565],{"style":59},"follow",[49,2567,116],{"style":55},[49,2569,119],{"style":59},[49,2571,2572],{"style":73},"'ref'",[49,2574,2575],{"style":59},"]",[49,2577,165],{"style":55},[49,2579,2580,2582,2585,2587,2589,2591,2593,2595,2597,2599,2601,2603,2606],{"class":51,"style":52},[49,2581,110],{"style":55},[49,2583,2584],{"style":59},"predicate",[49,2586,116],{"style":55},[49,2588,589],{"style":59},[49,2590,619],{"style":63},[49,2592,1213],{"style":59},[49,2594,1216],{"style":55},[49,2596,619],{"style":63},[49,2598,93],{"style":55},[49,2600,837],{"style":59},[49,2602,840],{"style":55},[49,2604,2605],{"style":73},"'date'",[49,2607,165],{"style":55},[49,2609,2610],{"class":51,"style":52},[49,2611,184],{"style":59},[39,2613,2616],{"language":41,"filename":2614,"code":2615,"class":44},"schema-values.ts","ast.schema.types.string \u002F\u002F 'string'\nast.schema.narrow(node, 'object')?.properties.length \u002F\u002F number | undefined\nast.schema.applyOptionality(nullableName, false).nullish \u002F\u002F true\nast.schema.findProperties({ node: petSchema, propertyName: 'id' }).map((property) => property.schema.type) \u002F\u002F ['integer']\nast.schema.getLiterals(petKind) \u002F\u002F ['cat', 'dog']\nast.schema.inferDiscriminator([catSchema, dogSchema]) \u002F\u002F 'kind'\nast.schema.getEmbeddedJson(jsonStringSchema)?.name \u002F\u002F 'Pet'\nast.schema.is(ast.factory.createSchema({ type: 'uuid' }), 'string') \u002F\u002F true\nast.schema.is(uploadSchema, 'binary', { follow: ['ref', 'array'] }) \u002F\u002F true for Blob or Blob[] behind refs",[14,2617,2618,75,2639,75,2673,75,2705,75,2768,75,2791,75,2819,75,2846,75,2890],{"class":47},[49,2619,2620,2622,2624,2626,2628,2631,2633,2636],{"class":51,"style":52},[49,2621,12],{"style":63},[49,2623,93],{"style":55},[49,2625,619],{"style":59},[49,2627,93],{"style":55},[49,2629,2630],{"style":59},"types",[49,2632,93],{"style":55},[49,2634,2635],{"style":59},"string ",[49,2637,2638],{"style":571},"\u002F\u002F 'string'",[49,2640,2641,2643,2645,2647,2649,2652,2654,2656,2658,2660,2662,2664,2666,2668,2670],{"class":51,"style":52},[49,2642,12],{"style":63},[49,2644,93],{"style":55},[49,2646,619],{"style":59},[49,2648,93],{"style":55},[49,2650,2651],{"style":101},"narrow",[49,2653,589],{"style":59},[49,2655,795],{"style":63},[49,2657,144],{"style":55},[49,2659,152],{"style":73},[49,2661,595],{"style":59},[49,2663,1238],{"style":55},[49,2665,157],{"style":59},[49,2667,93],{"style":55},[49,2669,1391],{"style":59},[49,2671,2672],{"style":571},"\u002F\u002F number | undefined",[49,2674,2675,2677,2679,2681,2683,2686,2688,2691,2693,2696,2698,2700,2703],{"class":51,"style":52},[49,2676,12],{"style":63},[49,2678,93],{"style":55},[49,2680,619],{"style":59},[49,2682,93],{"style":55},[49,2684,2685],{"style":101},"applyOptionality",[49,2687,589],{"style":59},[49,2689,2690],{"style":63},"nullableName",[49,2692,144],{"style":55},[49,2694,2695],{"style":59},"false",[49,2697,595],{"style":59},[49,2699,93],{"style":55},[49,2701,2702],{"style":59},"nullish ",[49,2704,2093],{"style":571},[49,2706,2707,2709,2711,2713,2715,2718,2720,2722,2724,2727,2729,2732,2734,2737,2739,2741,2744,2747,2749,2751,2753,2755,2757,2759,2761,2763,2765],{"class":51,"style":52},[49,2708,12],{"style":63},[49,2710,93],{"style":55},[49,2712,619],{"style":59},[49,2714,93],{"style":55},[49,2716,2717],{"style":101},"findProperties",[49,2719,133],{"style":59},[49,2721,795],{"style":59},[49,2723,116],{"style":55},[49,2725,2726],{"style":63},"petSchema",[49,2728,144],{"style":55},[49,2730,2731],{"style":59},"propertyName",[49,2733,116],{"style":55},[49,2735,2736],{"style":73},"'id' ",[49,2738,184],{"style":59},[49,2740,93],{"style":55},[49,2742,2743],{"style":101},"map",[49,2745,2746],{"style":59},"((",[49,2748,622],{"style":63},[49,2750,1213],{"style":59},[49,2752,1216],{"style":55},[49,2754,622],{"style":63},[49,2756,93],{"style":55},[49,2758,619],{"style":59},[49,2760,93],{"style":55},[49,2762,147],{"style":59},[49,2764,1213],{"style":59},[49,2766,2767],{"style":571},"\u002F\u002F ['integer']",[49,2769,2770,2772,2774,2776,2778,2781,2783,2786,2788],{"class":51,"style":52},[49,2771,12],{"style":63},[49,2773,93],{"style":55},[49,2775,619],{"style":59},[49,2777,93],{"style":55},[49,2779,2780],{"style":101},"getLiterals",[49,2782,589],{"style":59},[49,2784,2785],{"style":63},"petKind",[49,2787,1213],{"style":59},[49,2789,2790],{"style":571},"\u002F\u002F ['cat', 'dog']",[49,2792,2793,2795,2797,2799,2801,2804,2806,2809,2811,2814,2816],{"class":51,"style":52},[49,2794,12],{"style":63},[49,2796,93],{"style":55},[49,2798,619],{"style":59},[49,2800,93],{"style":55},[49,2802,2803],{"style":101},"inferDiscriminator",[49,2805,1035],{"style":59},[49,2807,2808],{"style":63},"catSchema",[49,2810,144],{"style":55},[49,2812,2813],{"style":63},"dogSchema",[49,2815,2315],{"style":59},[49,2817,2818],{"style":571},"\u002F\u002F 'kind'",[49,2820,2821,2823,2825,2827,2829,2832,2834,2837,2839,2841,2844],{"class":51,"style":52},[49,2822,12],{"style":63},[49,2824,93],{"style":55},[49,2826,619],{"style":59},[49,2828,93],{"style":55},[49,2830,2831],{"style":101},"getEmbeddedJson",[49,2833,589],{"style":59},[49,2835,2836],{"style":63},"jsonStringSchema",[49,2838,595],{"style":59},[49,2840,1238],{"style":55},[49,2842,2843],{"style":59},"name ",[49,2845,2044],{"style":571},[49,2847,2848,2850,2852,2854,2856,2859,2861,2863,2865,2867,2869,2871,2873,2875,2877,2880,2882,2884,2886,2888],{"class":51,"style":52},[49,2849,12],{"style":63},[49,2851,93],{"style":55},[49,2853,619],{"style":59},[49,2855,93],{"style":55},[49,2857,2858],{"style":101},"is",[49,2860,589],{"style":59},[49,2862,12],{"style":63},[49,2864,93],{"style":55},[49,2866,96],{"style":59},[49,2868,93],{"style":55},[49,2870,130],{"style":101},[49,2872,133],{"style":59},[49,2874,147],{"style":59},[49,2876,116],{"style":55},[49,2878,2879],{"style":73},"'uuid' ",[49,2881,184],{"style":59},[49,2883,144],{"style":55},[49,2885,554],{"style":73},[49,2887,1213],{"style":59},[49,2889,2093],{"style":571},[49,2891,2892,2894,2896,2898,2900,2902,2904,2907,2909,2912,2914,2916,2918,2920,2922,2924,2926,2929,2932],{"class":51,"style":52},[49,2893,12],{"style":63},[49,2895,93],{"style":55},[49,2897,619],{"style":59},[49,2899,93],{"style":55},[49,2901,2858],{"style":101},[49,2903,589],{"style":59},[49,2905,2906],{"style":63},"uploadSchema",[49,2908,144],{"style":55},[49,2910,2911],{"style":73},"'binary'",[49,2913,144],{"style":55},[49,2915,60],{"style":59},[49,2917,2565],{"style":59},[49,2919,116],{"style":55},[49,2921,119],{"style":59},[49,2923,2572],{"style":73},[49,2925,144],{"style":55},[49,2927,2928],{"style":73},"'array'",[49,2930,2931],{"style":59},"] }) ",[49,2933,2934],{"style":571},"\u002F\u002F true for Blob or Blob[] behind refs",[17,2936,2937,2938,2940,2941,93],{},"To reuse ",[14,2939,2550],{}," results, see ",[632,2942,2944],{"href":2943},"#schema-search-cache","Schema search cache",[10,2946,2948],{"id":2947},"ast-media-type",[14,2949,2950],{},"ast.mediaType",[17,2952,2953],{},"Each helper takes a media type string or a content entry.",[247,2955,2956,2964],{},[250,2957,2958],{},[253,2959,2960,2962],{},[256,2961,648],{},[256,2963,651],{},[266,2965,2966,2976],{},[253,2967,2968,2973],{},[271,2969,2970],{},[14,2971,2972],{},"ast.mediaType.getBase",[271,2974,2975],{},"The lowercase media type without parameters",[253,2977,2978,2983],{},[271,2979,2980],{},[14,2981,2982],{},"ast.mediaType.isJson",[271,2984,2985,2986,144,2989,2362,2992],{},"Whether it is ",[14,2987,2988],{},"application\u002Fjson",[14,2990,2991],{},"text\u002Fjson",[14,2993,2994],{},"+json",[39,2996,2999],{"language":41,"filename":2997,"code":2998,"class":44},"media-type.ts","ast.mediaType.getBase('Application\u002FJSON; charset=utf-8') \u002F\u002F 'application\u002Fjson'\nast.mediaType.isJson('application\u002Fproblem+json') \u002F\u002F true",[14,3000,3001,75,3025],{"class":47},[49,3002,3003,3005,3007,3010,3012,3015,3017,3020,3022],{"class":51,"style":52},[49,3004,12],{"style":63},[49,3006,93],{"style":55},[49,3008,3009],{"style":59},"mediaType",[49,3011,93],{"style":55},[49,3013,3014],{"style":101},"getBase",[49,3016,589],{"style":59},[49,3018,3019],{"style":73},"'Application\u002FJSON; charset=utf-8'",[49,3021,1213],{"style":59},[49,3023,3024],{"style":571},"\u002F\u002F 'application\u002Fjson'",[49,3026,3027,3029,3031,3033,3035,3038,3040,3043,3045],{"class":51,"style":52},[49,3028,12],{"style":63},[49,3030,93],{"style":55},[49,3032,3009],{"style":59},[49,3034,93],{"style":55},[49,3036,3037],{"style":101},"isJson",[49,3039,589],{"style":59},[49,3041,3042],{"style":73},"'application\u002Fproblem+json'",[49,3044,1213],{"style":59},[49,3046,2093],{"style":571},[10,3048,3050],{"id":3049},"ast-http",[14,3051,3052],{},"ast.http",[247,3054,3055,3063],{},[250,3056,3057],{},[253,3058,3059,3061],{},[256,3060,648],{},[256,3062,651],{},[266,3064,3065],{},[253,3066,3067,3072],{},[271,3068,3069],{},[14,3070,3071],{},"ast.http.isOperation",[271,3073,3074,3075,401,3078],{},"Whether an operation is HTTP, narrowing it to have ",[14,3076,3077],{},"method",[14,3079,3080],{},"path",[39,3082,3085],{"language":41,"filename":3083,"code":3084,"class":44},"http.ts","import { ast } from 'kubb\u002Fkit'\n\nif (ast.http.isOperation(node)) {\n node.method \u002F\u002F 'GET'\n}",[14,3086,3087,75,3101,75,3103,75,3129,75,3142],{"class":47},[49,3088,3089,3091,3093,3095,3097,3099],{"class":51,"style":52},[49,3090,56],{"style":55},[49,3092,60],{"style":59},[49,3094,64],{"style":63},[49,3096,67],{"style":59},[49,3098,70],{"style":55},[49,3100,74],{"style":73},[49,3102],{"class":51,"style":52},[49,3104,3105,3108,3110,3112,3114,3117,3119,3122,3124,3126],{"class":51,"style":52},[49,3106,3107],{"style":55},"if ",[49,3109,589],{"style":59},[49,3111,12],{"style":63},[49,3113,93],{"style":55},[49,3115,3116],{"style":59},"http",[49,3118,93],{"style":55},[49,3120,3121],{"style":101},"isOperation",[49,3123,589],{"style":59},[49,3125,795],{"style":63},[49,3127,3128],{"style":59},")) {",[49,3130,3131,3133,3135,3137,3139],{"class":51,"style":52},[49,3132,110],{"style":59},[49,3134,795],{"style":63},[49,3136,93],{"style":55},[49,3138,964],{"style":59},[49,3140,3141],{"style":571},"\u002F\u002F 'GET'",[49,3143,3144],{"class":51,"style":52},[49,3145,891],{"style":59},[10,3147,3149],{"id":3148},"printers","Printers",[247,3151,3152,3163],{},[250,3153,3154],{},[253,3155,3156,3161],{},[256,3157,3158,3160],{},[14,3159,24],{}," export",[256,3162,651],{},[266,3164,3165,3178],{},[253,3166,3167,3172],{},[271,3168,3169],{},[14,3170,3171],{},"createPrinter",[271,3173,3174,3175],{},"A factory from printer options to a ",[14,3176,3177],{},"Printer",[253,3179,3180,3184],{},[271,3181,3182],{},[14,3183,1258],{},[271,3185,3186,3187],{},"The same macro object, typed as a ",[14,3188,1531],{},[17,3190,3191,3192,3195,3196,3199,3200,144,3203,626,3206,3209,3210,1264],{},"A printer's ",[14,3193,3194],{},"overrides"," map replaces the handlers of single schema types. The ",[14,3197,3198],{},"printer.nodes"," option of ",[14,3201,3202],{},"@kubb\u002Fplugin-ts",[14,3204,3205],{},"@kubb\u002Fplugin-zod",[14,3207,3208],{},"@kubb\u002Fplugin-faker"," fills it, as ",[632,3211,3149],{"href":3212},"\u002Fdocs\u002F5.x\u002Fhow-to\u002Fcustomize#printers",[3214,3215,3217,3218,3220,3221,144,3224,3227],"blockquote",{"as":3216},"warning","Pass overrides through ",[14,3219,3194],{},". If you spread them into ",[14,3222,3223],{},"nodes",[14,3225,3226],{},"this.base"," cannot find the original handler.",[1566,3229,3231],{"id":3230},"printer-handlers-and-context","Printer handlers and context",[17,3233,3234,3235,199,3237,3239],{},"Key the map by schema ",[14,3236,147],{},[14,3238,554],{},". A type without a handler keeps the built-in one.",[39,3241,3243],{"language":41,"filename":1601,"code":3242,"class":44},"type PrinterNodes = Partial\u003C{\n [K in SchemaType]: (this: Context, node: SchemaNodeByType[K], ctx?: Context) => Output | null\n}>",[14,3244,3245,75,3261,75,3325],{"class":47},[49,3246,3247,3249,3252,3254,3257,3259],{"class":51,"style":52},[49,3248,837],{"style":55},[49,3250,3251],{"style":101},"PrinterNodes ",[49,3253,88],{"style":55},[49,3255,3256],{"style":101},"Partial",[49,3258,921],{"style":55},[49,3260,809],{"style":59},[49,3262,3263,3266,3269,3272,3275,3277,3279,3281,3283,3285,3288,3290,3292,3294,3297,3299,3302,3304,3306,3309,3312,3314,3316,3318,3321,3323],{"class":51,"style":52},[49,3264,3265],{"style":59}," [",[49,3267,3268],{"style":101},"K ",[49,3270,3271],{"style":55},"in ",[49,3273,3274],{"style":101},"SchemaType",[49,3276,2575],{"style":59},[49,3278,116],{"style":55},[49,3280,589],{"style":59},[49,3282,1592],{"style":63},[49,3284,116],{"style":63},[49,3286,3287],{"style":101},"Context",[49,3289,144],{"style":55},[49,3291,795],{"style":59},[49,3293,116],{"style":63},[49,3295,3296],{"style":101},"SchemaNodeByType",[49,3298,119],{"style":59},[49,3300,3301],{"style":59},"K",[49,3303,2575],{"style":59},[49,3305,144],{"style":55},[49,3307,3308],{"style":59},"ctx",[49,3310,3311],{"style":63},"?: ",[49,3313,3287],{"style":101},[49,3315,1213],{"style":59},[49,3317,1216],{"style":55},[49,3319,3320],{"style":101},"Output ",[49,3322,1642],{"style":55},[49,3324,323],{"style":59},[49,3326,3327,3329],{"class":51,"style":52},[49,3328,891],{"style":59},[49,3330,931],{"style":55},[17,3332,3333,3334,3336,3337,199,3339,3342,3343,3346,3347,3349,3350,3352,3353,3356,3357,3360],{},"A handler gets the context as ",[14,3335,1592],{}," and as its second argument, so an arrow function can read it as ",[14,3338,3308],{},[14,3340,3341],{},"array: (node, ctx) => ctx!.transform(node.items[0])",". The second argument is typed as optional, and its ",[14,3344,3345],{},"options"," as ",[14,3348,278],{},", so handler types written for ",[14,3351,1592],{}," alone keep compiling. Read typed options from ",[14,3354,3355],{},"this.options",". The root ",[14,3358,3359],{},"print"," override gets the root context the same way.",[247,3362,3363,3375],{},[250,3364,3365],{},[253,3366,3367,3372],{},[256,3368,3369,3371],{},[14,3370,1592],{}," member",[256,3373,3374],{},"Does",[266,3376,3377,3387,3397,3412,3428],{},[253,3378,3379,3384],{},[271,3380,3381],{},[14,3382,3383],{},"this.transform(node, options?)",[271,3385,3386],{},"Prints a nested schema with every handler, overrides included",[253,3388,3389,3394],{},[271,3390,3391],{},[14,3392,3393],{},"this.base(node, options?)",[271,3395,3396],{},"Runs the replaced built-in handler, to wrap its output",[253,3398,3399,3403],{},[271,3400,3401],{},[14,3402,3355],{},[271,3404,3405,3406,3409,3410],{},"The resolved printer options, such as ",[14,3407,3408],{},"arrayType"," on ",[14,3411,3202],{},[253,3413,3414,3419],{},[271,3415,3416],{},[14,3417,3418],{},"this.parent",[271,3420,3421,3422,144,3425,3427],{},"The schema node whose handler called ",[14,3423,3424],{},"this.transform",[14,3426,979],{}," at the root",[253,3429,3430,3435],{},[271,3431,3432],{},[14,3433,3434],{},"this.import(node)",[271,3436,3437,3438,3441],{},"Declares an import, as an ",[14,3439,3440],{},"ast.factory.createImport()"," node",[17,3443,1805,3444,3446,3447,707,3449,3451,3452,3454],{},[14,3445,3345],{}," you pass to ",[14,3448,3424],{},[14,3450,3226],{}," are merged over ",[14,3453,3355],{}," for that child and what it prints, and leave the caller's options unchanged:",[39,3456,3458],{"language":41,"code":3457,"class":44},"string(node) {\n const contentNode = ast.schema.getEmbeddedJson(node)\n return contentNode ? this.transform(contentNode, { direction: 'decode' }) : 'z.string()'\n}",[14,3459,3460,75,3470,75,3497,75,3538],{"class":47},[49,3461,3462,3464,3466,3468],{"class":51,"style":52},[49,3463,308],{"style":101},[49,3465,589],{"style":59},[49,3467,795],{"style":63},[49,3469,822],{"style":59},[49,3471,3472,3474,3476,3479,3481,3483,3485,3487,3489,3491,3493,3495],{"class":51,"style":52},[49,3473,110],{"style":59},[49,3475,82],{"style":55},[49,3477,3478],{"style":63},"contentNode ",[49,3480,88],{"style":55},[49,3482,12],{"style":63},[49,3484,93],{"style":55},[49,3486,619],{"style":59},[49,3488,93],{"style":55},[49,3490,2831],{"style":101},[49,3492,589],{"style":59},[49,3494,795],{"style":63},[49,3496,595],{"style":59},[49,3498,3499,3501,3503,3505,3507,3509,3511,3513,3515,3518,3520,3522,3525,3527,3530,3533,3535],{"class":51,"style":52},[49,3500,110],{"style":59},[49,3502,830],{"style":55},[49,3504,3478],{"style":63},[49,3506,861],{"style":55},[49,3508,1592],{"style":63},[49,3510,93],{"style":55},[49,3512,639],{"style":101},[49,3514,589],{"style":59},[49,3516,3517],{"style":63},"contentNode",[49,3519,144],{"style":55},[49,3521,60],{"style":59},[49,3523,3524],{"style":59},"direction",[49,3526,116],{"style":55},[49,3528,3529],{"style":73},"'decode' ",[49,3531,3532],{"style":59},"}) ",[49,3534,116],{"style":55},[49,3536,3537],{"style":73},"'z.string()'",[49,3539,3540],{"class":51,"style":52},[49,3541,891],{"style":59},[17,3543,3544,3545,3551,3552,3555],{},"A handler that runs during a build, from a template that calls the printer, can call ",[632,3546,3548],{"href":3547},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Ftemplates#from",[14,3549,3550],{},"from()"," for another plugin's names and their imports. So a printer needs no ",[14,3553,3554],{},"resolver"," in its options:",[39,3557,3559],{"language":41,"code":3558,"class":44},"ref(node) {\n const type = from('plugin-ts').resolver.name(ast.ref.getName(node) ?? '')\n if (type.import) this.import(type.import)\n return type.name\n}",[14,3560,3561,75,3571,75,3625,75,3658,75,3670],{"class":47},[49,3562,3563,3565,3567,3569],{"class":51,"style":52},[49,3564,209],{"style":101},[49,3566,589],{"style":59},[49,3568,795],{"style":63},[49,3570,822],{"style":59},[49,3572,3573,3575,3577,3579,3581,3584,3586,3589,3591,3593,3595,3597,3599,3601,3603,3605,3607,3609,3611,3613,3615,3617,3620,3623],{"class":51,"style":52},[49,3574,110],{"style":59},[49,3576,82],{"style":55},[49,3578,837],{"style":63},[49,3580,88],{"style":55},[49,3582,3583],{"style":101},"from",[49,3585,589],{"style":59},[49,3587,3588],{"style":73},"'plugin-ts'",[49,3590,595],{"style":59},[49,3592,93],{"style":55},[49,3594,3554],{"style":59},[49,3596,93],{"style":55},[49,3598,136],{"style":101},[49,3600,589],{"style":59},[49,3602,12],{"style":63},[49,3604,93],{"style":55},[49,3606,209],{"style":59},[49,3608,93],{"style":55},[49,3610,2034],{"style":101},[49,3612,589],{"style":59},[49,3614,795],{"style":63},[49,3616,1213],{"style":59},[49,3618,3619],{"style":55},"?? ",[49,3621,3622],{"style":73},"''",[49,3624,595],{"style":59},[49,3626,3627,3629,3631,3633,3635,3637,3640,3642,3644,3646,3648,3650,3652,3654,3656],{"class":51,"style":52},[49,3628,110],{"style":59},[49,3630,3107],{"style":55},[49,3632,589],{"style":59},[49,3634,147],{"style":63},[49,3636,93],{"style":55},[49,3638,3639],{"style":59},"import",[49,3641,1213],{"style":59},[49,3643,1592],{"style":63},[49,3645,93],{"style":55},[49,3647,3639],{"style":101},[49,3649,589],{"style":59},[49,3651,147],{"style":63},[49,3653,93],{"style":55},[49,3655,3639],{"style":59},[49,3657,595],{"style":59},[49,3659,3660,3662,3664,3666,3668],{"class":51,"style":52},[49,3661,110],{"style":59},[49,3663,830],{"style":55},[49,3665,147],{"style":63},[49,3667,93],{"style":55},[49,3669,136],{"style":59},[49,3671,3672],{"class":51,"style":52},[49,3673,891],{"style":59},[17,3675,3676,3678,3679,3682,3683,3686],{},[14,3677,3550],{}," reports ",[14,3680,3681],{},"KUBB_NO_CONTEXT"," when the printer runs outside a build, such as in a test that calls it directly. Run that call inside ",[14,3684,3685],{},"withContext"," with a mocked context.",[3214,3688,3690,3691,3694],{"as":3689},"important","The built-in templates collect those imports. In your own template, call ",[14,3692,3693],{},"printer.drainImports()"," after printing.",[17,3696,3697,3701],{},[632,3698,3700],{"href":3699},"\u002Fdocs\u002F5.x\u002Fintroduction\u002Farchitecture#ast","Architecture"," explains why the AST exists.",[10,3703,3705],{"id":3704},"less-common-cases","Less common cases",[1566,3707,2944],{"id":3708},"schema-search-cache",[17,3710,3711,3712,3714,3715,3718,3719,3721,3722,3724],{},"When you call ",[14,3713,2371],{}," across many schemas, reuse its answers with a ",[14,3716,3717],{},"cache",". Keep one ",[14,3720,3717],{}," per predicate and ",[14,3723,2565],{}," value, so later calls skip what earlier ones searched.",[39,3726,3729],{"language":41,"filename":3727,"code":3728,"class":44},"find-cache.ts","import { ast } from 'kubb\u002Fkit'\n\nconst dateCache = new WeakMap\u003Cast.SchemaNode, ast.SchemaNode | null>()\nconst hasDate = (schema: ast.SchemaNode) =>\n ast.schema.find(schema, { follow: ['ref'], cache: dateCache, predicate: (node) => node.type === 'date' }) !== undefined",[14,3730,3731,75,3745,75,3747,75,3787,75,3813],{"class":47},[49,3732,3733,3735,3737,3739,3741,3743],{"class":51,"style":52},[49,3734,56],{"style":55},[49,3736,60],{"style":59},[49,3738,64],{"style":63},[49,3740,67],{"style":59},[49,3742,70],{"style":55},[49,3744,74],{"style":73},[49,3746],{"class":51,"style":52},[49,3748,3749,3751,3754,3756,3759,3762,3764,3766,3768,3770,3772,3774,3776,3778,3780,3782,3784],{"class":51,"style":52},[49,3750,82],{"style":55},[49,3752,3753],{"style":63},"dateCache ",[49,3755,88],{"style":55},[49,3757,3758],{"style":55},"new ",[49,3760,3761],{"style":101},"WeakMap",[49,3763,921],{"style":55},[49,3765,12],{"style":63},[49,3767,93],{"style":55},[49,3769,237],{"style":59},[49,3771,144],{"style":55},[49,3773,12],{"style":63},[49,3775,93],{"style":55},[49,3777,1696],{"style":59},[49,3779,1642],{"style":55},[49,3781,323],{"style":59},[49,3783,931],{"style":55},[49,3785,3786],{"style":59},"()",[49,3788,3789,3791,3794,3796,3798,3800,3802,3804,3806,3808,3810],{"class":51,"style":52},[49,3790,82],{"style":55},[49,3792,3793],{"style":63},"hasDate ",[49,3795,88],{"style":55},[49,3797,589],{"style":59},[49,3799,619],{"style":63},[49,3801,116],{"style":55},[49,3803,12],{"style":63},[49,3805,93],{"style":55},[49,3807,237],{"style":59},[49,3809,1213],{"style":59},[49,3811,3812],{"style":55},"=>",[49,3814,3815,3817,3819,3821,3823,3825,3827,3829,3831,3833,3835,3837,3839,3841,3843,3845,3847,3849,3851,3854,3856,3858,3860,3862,3864,3866,3868,3870,3872,3874,3876,3879,3881,3884],{"class":51,"style":52},[49,3816,110],{"style":55},[49,3818,12],{"style":63},[49,3820,93],{"style":55},[49,3822,619],{"style":59},[49,3824,93],{"style":55},[49,3826,2550],{"style":101},[49,3828,589],{"style":59},[49,3830,619],{"style":63},[49,3832,144],{"style":55},[49,3834,60],{"style":59},[49,3836,2565],{"style":59},[49,3838,116],{"style":55},[49,3840,119],{"style":59},[49,3842,2572],{"style":73},[49,3844,2575],{"style":59},[49,3846,144],{"style":55},[49,3848,3717],{"style":59},[49,3850,116],{"style":55},[49,3852,3853],{"style":63},"dateCache",[49,3855,144],{"style":55},[49,3857,2584],{"style":59},[49,3859,116],{"style":55},[49,3861,589],{"style":59},[49,3863,795],{"style":63},[49,3865,1213],{"style":59},[49,3867,1216],{"style":55},[49,3869,795],{"style":63},[49,3871,93],{"style":55},[49,3873,837],{"style":59},[49,3875,840],{"style":55},[49,3877,3878],{"style":73},"'date' ",[49,3880,3532],{"style":59},[49,3882,3883],{"style":55},"!== ",[49,3885,979],{"style":59},[1566,3887,3889],{"id":3888},"ast-helper-details","AST helper details",[17,3891,3892,3893,3895,3896,3898],{},"Helper names are a verb plus what they return (",[14,3894,2034],{},") or a question (",[14,3897,3037],{},").",[247,3900,3901,3910],{},[250,3902,3903],{},[253,3904,3905,3907],{},[256,3906,648],{},[256,3908,3909],{},"Detail",[266,3911,3912,3931,3951,3973],{},[253,3913,3914,3921],{},[271,3915,3916],{},[632,3917,3919],{"href":3918},"#printers",[14,3920,3171],{},[271,3922,3923,3927,3928,3930],{},[632,3924,3926],{"href":3925},"\u002Fextensions\u002Fkubb-labs\u002Fplugin-zod\u002Fguides\u002Fcustomization#import-a-custom-codec","Import a custom codec"," shows an ",[14,3929,3194],{}," map in practice.",[253,3932,3933,3940],{},[271,3934,3935],{},[632,3936,3938],{"href":3937},"#ast-schema",[14,3939,2449],{},[271,3941,3942,3944,3945,3947,3948,3950],{},[14,3943,2565],{}," adds links on top of the node itself: ",[14,3946,2572],{}," jumps to a resolved ref's target, and ",[14,3949,2928],{}," matches when some item matches. Following repeats and stops on a ref cycle.",[253,3952,3953,3960],{},[271,3954,3955],{},[632,3956,3958],{"href":3957},"#ast-graph",[14,3959,2160],{},[271,3961,700,3962,3964,3965,144,3968,626,3971,93],{},[14,3963,2166],{}," to include refs inside ",[14,3966,3967],{},"conditionals",[14,3969,3970],{},"contains",[14,3972,408],{},[253,3974,3975,3981],{},[271,3976,3977],{},[632,3978,3979],{"href":634},[14,3980,1252],{},[271,3982,3983,3984,3986,3987,93],{},"A macro is a named transform that rewrites nodes before printing, with ordering through ",[14,3985,1299],{}," and gating through ",[14,3988,1586],{},{"title":3990,"searchDepth":3991,"depth":3991,"links":3992},"",5,[3993,3995,3996,3997,3998,3999,4000,4004,4005,4006,4007,4008,4009,4010,4013],{"id":12,"depth":3994,"text":12},2,{"id":187,"depth":3994,"text":188},{"id":230,"depth":3994,"text":231},{"id":411,"depth":3994,"text":32},{"id":603,"depth":3994,"text":36},{"id":1078,"depth":3994,"text":1081},{"id":1249,"depth":3994,"text":1252,"children":4001},[4002],{"id":1568,"depth":4003,"text":1569},3,{"id":1754,"depth":3994,"text":1757},{"id":1922,"depth":3994,"text":1925},{"id":2123,"depth":3994,"text":2126},{"id":2321,"depth":3994,"text":2324},{"id":2947,"depth":3994,"text":2950},{"id":3049,"depth":3994,"text":3052},{"id":3148,"depth":3994,"text":3149,"children":4011},[4012],{"id":3230,"depth":4003,"text":3231},{"id":3704,"depth":3994,"text":3705,"children":4014},[4015,4016],{"id":3708,"depth":4003,"text":2944},{"id":3888,"depth":4003,"text":3889},"The ast namespace from kubb\u002Fkit. Covers the node tree, schema types, and every helper group, each with what it returns and a sample call.","md",{"layout":4020,"title":5,"description":4017,"outline":4021,"order":4022,"navigation":4023},"doc",[3994,4003],8,{"title":4024,"icon":4025},"AST & node builders","i-iconoir-code-brackets",{"layout":4020,"outline":4027},[3994,4003],{"title":4024,"icon":4025},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fast",{"title":5,"description":4017},{"loc":4029},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fast.md","docs\u002F5.x\u002Freference\u002Fkit\u002Fast","Ap5BwY7FF74DVIqzmR1uCkWwRO09m_FL2Cun3geCThQ",1795989036663,"2e8b4c62-5b8c-4587-97c0-530d08a9bd53"]