[{"data":1,"prerenderedAt":2602,"buildId":2603},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Fhow-to\u002Frecipes":3},{"id":4,"title":5,"body":6,"description":2585,"extension":2586,"frontmatter":2587,"heading":2591,"meta":2593,"navigation":2595,"order":2569,"path":2596,"seo":2597,"sitemap":2598,"source":2599,"stem":2600,"__hash__":2601},"docs\u002Fdocs\u002F5.x\u002Fhow-to\u002Frecipes.md","Configure generation - Common Kubb recipes",{"type":7,"value":8,"toc":2564},"minimark",[9,61,74,79,918,939,943,984,1152,1156,1170,1180,1190,1427,1435,1439,1449,1467,1483,1487,1504,1575,1582,1781,1797,1811,1815,1829,1928,1945,1949,1973,2096,2109,2114,2157,2160,2164,2205,2222,2226,2279,2285,2289,2339,2342,2346,2410,2413,2417,2455,2470,2485,2489],[10,11,12,13,17,18,23,24,27,28,31,32,35,36,42,43,47,48,50,51,53,54,60],"p",{},"Each recipe is a complete ",[14,15,16],"code",{},"kubb.config.ts",". After ",[19,20,22],"a",{"href":21},"\u002Fdocs\u002F5.x\u002Fintroduction\u002Finstallation","Installation",", replace ",[14,25,26],{},".\u002FpetStore.yaml"," with your spec, install the listed packages, and run ",[14,29,30],{},"npx kubb generate",". The ",[14,33,34],{},"kubb"," tab installs each plugin with ",[19,37,39],{"href":38},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fadd",[14,40,41],{},"kubb add"," at the version the ",[19,44,46],{"href":45},"\u002Fextensions","extension registry"," pins. ",[14,49,41],{}," needs an existing ",[14,52,16],{},", so run ",[19,55,57],{"href":56},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Finit",[14,58,59],{},"npx kubb init"," first if you have none.",[62,63,65,66,69,70,73],"blockquote",{"as":64},"warning","With ",[14,67,68],{},"clean: true",", Kubb removes ",[14,71,72],{},".\u002Fsrc\u002Fgen"," before it generates, so keep your own files elsewhere.",[75,76,78],"h2",{"id":77},"pick-a-stack","Pick a stack",[80,81,82,382,618],"tabs",{},[83,84,86,94,186],"tabs-item",{"label":85},"React Query",[10,87,88,89,93],{},"Types, an Axios client, and ",[19,90,92],{"href":91},"https:\u002F\u002Ftanstack.com\u002Fquery","TanStack Query"," hooks for React.",[95,96,97,148],"code-group",{},[98,99,103],"pre",{"language":100,"filename":34,"code":101,"class":102},"shell","npx kubb add plugin-ts\nnpx kubb add plugin-axios\nnpx kubb add plugin-react-query\nnpm install axios react @tanstack\u002Freact-query","highlights",[14,104,106,119,120,119,127,119,134],{"class":105},"language-shell",[107,108,111,115],"span",{"class":109,"style":110},"line","display: inline",[107,112,114],{"style":113},"color:#6f42c1;--hls-dark:#b392f0","npx ",[107,116,118],{"style":117},"color:#24292e;--hls-dark:#e1e4e8","kubb add plugin-ts","\n",[107,121,122,124],{"class":109,"style":110},[107,123,114],{"style":113},[107,125,126],{"style":117},"kubb add plugin-axios",[107,128,129,131],{"class":109,"style":110},[107,130,114],{"style":113},[107,132,133],{"style":117},"kubb add plugin-react-query",[107,135,136,139,142,145],{"class":109,"style":110},[107,137,138],{"style":113},"npm ",[107,140,141],{"style":117},"install axios react ",[107,143,144],{"style":117},"@",[107,146,147],{"style":117},"tanstack\u002Freact-query",[98,149,152],{"language":100,"filename":150,"code":151,"class":102},"npm","npm install -D kubb typescript @kubb\u002Fplugin-ts @kubb\u002Fplugin-axios @kubb\u002Fplugin-react-query\nnpm install axios react @tanstack\u002Freact-query",[14,153,154,119,176],{"class":105},[107,155,156,158,161,163,166,168,171,173],{"class":109,"style":110},[107,157,138],{"style":113},[107,159,160],{"style":117},"install -D kubb typescript ",[107,162,144],{"style":117},[107,164,165],{"style":117},"kubb\u002Fplugin-ts ",[107,167,144],{"style":117},[107,169,170],{"style":117},"kubb\u002Fplugin-axios ",[107,172,144],{"style":117},[107,174,175],{"style":117},"kubb\u002Fplugin-react-query",[107,177,178,180,182,184],{"class":109,"style":110},[107,179,138],{"style":113},[107,181,141],{"style":117},[107,183,144],{"style":117},[107,185,147],{"style":117},[98,187,190],{"language":188,"filename":16,"code":189,"class":102},"typescript","import { defineConfig } from 'kubb\u002Fconfig'\nimport { pluginTs } from '@kubb\u002Fplugin-ts'\nimport { pluginAxios } from '@kubb\u002Fplugin-axios'\nimport { pluginReactQuery } from '@kubb\u002Fplugin-react-query'\n\nexport default defineConfig({\n input: '.\u002FpetStore.yaml',\n output: { path: '.\u002Fsrc\u002Fgen', clean: true },\n plugins: [pluginTs(), pluginAxios(), pluginReactQuery({ hooks: true })],\n})",[14,191,193,119,216,119,232,119,248,119,264,119,266,119,280,119,297,119,332,119,377],{"class":192},"language-typescript",[107,194,195,199,203,206,209,212],{"class":109,"style":110},[107,196,198],{"style":197},"color:#d73a49;--hls-dark:#f97583","import ",[107,200,202],{"style":201},"color:#005cc5;--hls-dark:#79b8ff","{ ",[107,204,205],{"style":117},"defineConfig ",[107,207,208],{"style":201},"} ",[107,210,211],{"style":197},"from ",[107,213,215],{"style":214},"color:#032f62;--hls-dark:#9ecbff","'kubb\u002Fconfig'",[107,217,218,220,222,225,227,229],{"class":109,"style":110},[107,219,198],{"style":197},[107,221,202],{"style":201},[107,223,224],{"style":117},"pluginTs ",[107,226,208],{"style":201},[107,228,211],{"style":197},[107,230,231],{"style":214},"'@kubb\u002Fplugin-ts'",[107,233,234,236,238,241,243,245],{"class":109,"style":110},[107,235,198],{"style":197},[107,237,202],{"style":201},[107,239,240],{"style":117},"pluginAxios ",[107,242,208],{"style":201},[107,244,211],{"style":197},[107,246,247],{"style":214},"'@kubb\u002Fplugin-axios'",[107,249,250,252,254,257,259,261],{"class":109,"style":110},[107,251,198],{"style":197},[107,253,202],{"style":201},[107,255,256],{"style":117},"pluginReactQuery ",[107,258,208],{"style":201},[107,260,211],{"style":197},[107,262,263],{"style":214},"'@kubb\u002Fplugin-react-query'",[107,265],{"class":109,"style":110},[107,267,268,271,274,277],{"class":109,"style":110},[107,269,270],{"style":197},"export ",[107,272,273],{"style":197},"default ",[107,275,276],{"style":113},"defineConfig",[107,278,279],{"style":201},"({",[107,281,282,285,288,291,294],{"class":109,"style":110},[107,283,284],{"style":201}," ",[107,286,287],{"style":201},"input",[107,289,290],{"style":197},": ",[107,292,293],{"style":214},"'.\u002FpetStore.yaml'",[107,295,296],{"style":197},",",[107,298,299,301,304,306,308,311,313,316,319,322,324,327,330],{"class":109,"style":110},[107,300,284],{"style":197},[107,302,303],{"style":201},"output",[107,305,290],{"style":197},[107,307,202],{"style":201},[107,309,310],{"style":201},"path",[107,312,290],{"style":197},[107,314,315],{"style":214},"'.\u002Fsrc\u002Fgen'",[107,317,318],{"style":197},", ",[107,320,321],{"style":201},"clean",[107,323,290],{"style":197},[107,325,326],{"style":201},"true ",[107,328,329],{"style":201},"}",[107,331,296],{"style":197},[107,333,334,336,339,341,344,347,350,352,355,357,359,362,365,368,370,372,375],{"class":109,"style":110},[107,335,284],{"style":197},[107,337,338],{"style":201},"plugins",[107,340,290],{"style":197},[107,342,343],{"style":201},"[",[107,345,346],{"style":113},"pluginTs",[107,348,349],{"style":201},"()",[107,351,318],{"style":197},[107,353,354],{"style":113},"pluginAxios",[107,356,349],{"style":201},[107,358,318],{"style":197},[107,360,361],{"style":113},"pluginReactQuery",[107,363,364],{"style":201},"({ ",[107,366,367],{"style":201},"hooks",[107,369,290],{"style":197},[107,371,326],{"style":201},[107,373,374],{"style":201},"})]",[107,376,296],{"style":197},[107,378,379],{"class":109,"style":110},[107,380,381],{"style":201},"})",[83,383,385,390,462],{"label":384},"Vue Query",[10,386,88,387,389],{},[19,388,92],{"href":91}," composables for Vue.",[95,391,392,428],{},[98,393,395],{"language":100,"filename":34,"code":394,"class":102},"npx kubb add plugin-ts\nnpx kubb add plugin-axios\nnpx kubb add plugin-vue-query\nnpm install axios vue @tanstack\u002Fvue-query",[14,396,397,119,403,119,409,119,416],{"class":105},[107,398,399,401],{"class":109,"style":110},[107,400,114],{"style":113},[107,402,118],{"style":117},[107,404,405,407],{"class":109,"style":110},[107,406,114],{"style":113},[107,408,126],{"style":117},[107,410,411,413],{"class":109,"style":110},[107,412,114],{"style":113},[107,414,415],{"style":117},"kubb add plugin-vue-query",[107,417,418,420,423,425],{"class":109,"style":110},[107,419,138],{"style":113},[107,421,422],{"style":117},"install axios vue ",[107,424,144],{"style":117},[107,426,427],{"style":117},"tanstack\u002Fvue-query",[98,429,431],{"language":100,"filename":150,"code":430,"class":102},"npm install -D kubb typescript @kubb\u002Fplugin-ts @kubb\u002Fplugin-axios @kubb\u002Fplugin-vue-query\nnpm install axios vue @tanstack\u002Fvue-query",[14,432,433,119,452],{"class":105},[107,434,435,437,439,441,443,445,447,449],{"class":109,"style":110},[107,436,138],{"style":113},[107,438,160],{"style":117},[107,440,144],{"style":117},[107,442,165],{"style":117},[107,444,144],{"style":117},[107,446,170],{"style":117},[107,448,144],{"style":117},[107,450,451],{"style":117},"kubb\u002Fplugin-vue-query",[107,453,454,456,458,460],{"class":109,"style":110},[107,455,138],{"style":113},[107,457,422],{"style":117},[107,459,144],{"style":117},[107,461,427],{"style":117},[98,463,465],{"language":188,"filename":16,"code":464,"class":102},"import { defineConfig } from 'kubb\u002Fconfig'\nimport { pluginTs } from '@kubb\u002Fplugin-ts'\nimport { pluginAxios } from '@kubb\u002Fplugin-axios'\nimport { pluginVueQuery } from '@kubb\u002Fplugin-vue-query'\n\nexport default defineConfig({\n input: '.\u002FpetStore.yaml',\n output: { path: '.\u002Fsrc\u002Fgen', clean: true },\n plugins: [pluginTs(), pluginAxios(), pluginVueQuery({ hooks: true })],\n})",[14,466,467,119,481,119,495,119,509,119,525,119,527,119,537,119,549,119,577,119,614],{"class":192},[107,468,469,471,473,475,477,479],{"class":109,"style":110},[107,470,198],{"style":197},[107,472,202],{"style":201},[107,474,205],{"style":117},[107,476,208],{"style":201},[107,478,211],{"style":197},[107,480,215],{"style":214},[107,482,483,485,487,489,491,493],{"class":109,"style":110},[107,484,198],{"style":197},[107,486,202],{"style":201},[107,488,224],{"style":117},[107,490,208],{"style":201},[107,492,211],{"style":197},[107,494,231],{"style":214},[107,496,497,499,501,503,505,507],{"class":109,"style":110},[107,498,198],{"style":197},[107,500,202],{"style":201},[107,502,240],{"style":117},[107,504,208],{"style":201},[107,506,211],{"style":197},[107,508,247],{"style":214},[107,510,511,513,515,518,520,522],{"class":109,"style":110},[107,512,198],{"style":197},[107,514,202],{"style":201},[107,516,517],{"style":117},"pluginVueQuery ",[107,519,208],{"style":201},[107,521,211],{"style":197},[107,523,524],{"style":214},"'@kubb\u002Fplugin-vue-query'",[107,526],{"class":109,"style":110},[107,528,529,531,533,535],{"class":109,"style":110},[107,530,270],{"style":197},[107,532,273],{"style":197},[107,534,276],{"style":113},[107,536,279],{"style":201},[107,538,539,541,543,545,547],{"class":109,"style":110},[107,540,284],{"style":201},[107,542,287],{"style":201},[107,544,290],{"style":197},[107,546,293],{"style":214},[107,548,296],{"style":197},[107,550,551,553,555,557,559,561,563,565,567,569,571,573,575],{"class":109,"style":110},[107,552,284],{"style":197},[107,554,303],{"style":201},[107,556,290],{"style":197},[107,558,202],{"style":201},[107,560,310],{"style":201},[107,562,290],{"style":197},[107,564,315],{"style":214},[107,566,318],{"style":197},[107,568,321],{"style":201},[107,570,290],{"style":197},[107,572,326],{"style":201},[107,574,329],{"style":201},[107,576,296],{"style":197},[107,578,579,581,583,585,587,589,591,593,595,597,599,602,604,606,608,610,612],{"class":109,"style":110},[107,580,284],{"style":197},[107,582,338],{"style":201},[107,584,290],{"style":197},[107,586,343],{"style":201},[107,588,346],{"style":113},[107,590,349],{"style":201},[107,592,318],{"style":197},[107,594,354],{"style":113},[107,596,349],{"style":201},[107,598,318],{"style":197},[107,600,601],{"style":113},"pluginVueQuery",[107,603,364],{"style":201},[107,605,367],{"style":201},[107,607,290],{"style":197},[107,609,326],{"style":201},[107,611,374],{"style":201},[107,613,296],{"style":197},[107,615,616],{"class":109,"style":110},[107,617,381],{"style":201},[83,619,621,639,725],{"label":620},"Zod and MSW",[10,622,623,624,628,629,633,634,638],{},"Runtime validation with ",[19,625,627],{"href":626},"https:\u002F\u002Fzod.dev","Zod",", plus ",[19,630,632],{"href":631},"https:\u002F\u002Fmswjs.io","MSW"," request handlers backed by ",[19,635,637],{"href":636},"https:\u002F\u002Ffakerjs.dev","Faker.js"," mock data.",[95,640,641,685],{},[98,642,644],{"language":100,"filename":34,"code":643,"class":102},"npx kubb add plugin-ts\nnpx kubb add plugin-zod\nnpx kubb add plugin-faker\nnpx kubb add plugin-msw\nnpm install zod msw @faker-js\u002Ffaker",[14,645,646,119,652,119,659,119,666,119,673],{"class":105},[107,647,648,650],{"class":109,"style":110},[107,649,114],{"style":113},[107,651,118],{"style":117},[107,653,654,656],{"class":109,"style":110},[107,655,114],{"style":113},[107,657,658],{"style":117},"kubb add plugin-zod",[107,660,661,663],{"class":109,"style":110},[107,662,114],{"style":113},[107,664,665],{"style":117},"kubb add plugin-faker",[107,667,668,670],{"class":109,"style":110},[107,669,114],{"style":113},[107,671,672],{"style":117},"kubb add plugin-msw",[107,674,675,677,680,682],{"class":109,"style":110},[107,676,138],{"style":113},[107,678,679],{"style":117},"install zod msw ",[107,681,144],{"style":117},[107,683,684],{"style":117},"faker-js\u002Ffaker",[98,686,688],{"language":100,"filename":150,"code":687,"class":102},"npm install -D kubb typescript @kubb\u002Fplugin-ts @kubb\u002Fplugin-zod @kubb\u002Fplugin-faker @kubb\u002Fplugin-msw\nnpm install zod msw @faker-js\u002Ffaker",[14,689,690,119,715],{"class":105},[107,691,692,694,696,698,700,702,705,707,710,712],{"class":109,"style":110},[107,693,138],{"style":113},[107,695,160],{"style":117},[107,697,144],{"style":117},[107,699,165],{"style":117},[107,701,144],{"style":117},[107,703,704],{"style":117},"kubb\u002Fplugin-zod ",[107,706,144],{"style":117},[107,708,709],{"style":117},"kubb\u002Fplugin-faker ",[107,711,144],{"style":117},[107,713,714],{"style":117},"kubb\u002Fplugin-msw",[107,716,717,719,721,723],{"class":109,"style":110},[107,718,138],{"style":113},[107,720,679],{"style":117},[107,722,144],{"style":117},[107,724,684],{"style":117},[98,726,728],{"language":188,"filename":16,"code":727,"class":102},"import { defineConfig } from 'kubb\u002Fconfig'\nimport { pluginTs } from '@kubb\u002Fplugin-ts'\nimport { pluginZod } from '@kubb\u002Fplugin-zod'\nimport { pluginFaker } from '@kubb\u002Fplugin-faker'\nimport { pluginMsw } from '@kubb\u002Fplugin-msw'\n\nexport default defineConfig({\n input: '.\u002FpetStore.yaml',\n output: { path: '.\u002Fsrc\u002Fgen', clean: true },\n plugins: [pluginTs(), pluginZod(), pluginFaker(), pluginMsw({ parser: 'faker', handlers: true })],\n})",[14,729,730,119,744,119,758,119,774,119,790,119,806,119,808,119,818,119,830,119,858,119,914],{"class":192},[107,731,732,734,736,738,740,742],{"class":109,"style":110},[107,733,198],{"style":197},[107,735,202],{"style":201},[107,737,205],{"style":117},[107,739,208],{"style":201},[107,741,211],{"style":197},[107,743,215],{"style":214},[107,745,746,748,750,752,754,756],{"class":109,"style":110},[107,747,198],{"style":197},[107,749,202],{"style":201},[107,751,224],{"style":117},[107,753,208],{"style":201},[107,755,211],{"style":197},[107,757,231],{"style":214},[107,759,760,762,764,767,769,771],{"class":109,"style":110},[107,761,198],{"style":197},[107,763,202],{"style":201},[107,765,766],{"style":117},"pluginZod ",[107,768,208],{"style":201},[107,770,211],{"style":197},[107,772,773],{"style":214},"'@kubb\u002Fplugin-zod'",[107,775,776,778,780,783,785,787],{"class":109,"style":110},[107,777,198],{"style":197},[107,779,202],{"style":201},[107,781,782],{"style":117},"pluginFaker ",[107,784,208],{"style":201},[107,786,211],{"style":197},[107,788,789],{"style":214},"'@kubb\u002Fplugin-faker'",[107,791,792,794,796,799,801,803],{"class":109,"style":110},[107,793,198],{"style":197},[107,795,202],{"style":201},[107,797,798],{"style":117},"pluginMsw ",[107,800,208],{"style":201},[107,802,211],{"style":197},[107,804,805],{"style":214},"'@kubb\u002Fplugin-msw'",[107,807],{"class":109,"style":110},[107,809,810,812,814,816],{"class":109,"style":110},[107,811,270],{"style":197},[107,813,273],{"style":197},[107,815,276],{"style":113},[107,817,279],{"style":201},[107,819,820,822,824,826,828],{"class":109,"style":110},[107,821,284],{"style":201},[107,823,287],{"style":201},[107,825,290],{"style":197},[107,827,293],{"style":214},[107,829,296],{"style":197},[107,831,832,834,836,838,840,842,844,846,848,850,852,854,856],{"class":109,"style":110},[107,833,284],{"style":197},[107,835,303],{"style":201},[107,837,290],{"style":197},[107,839,202],{"style":201},[107,841,310],{"style":201},[107,843,290],{"style":197},[107,845,315],{"style":214},[107,847,318],{"style":197},[107,849,321],{"style":201},[107,851,290],{"style":197},[107,853,326],{"style":201},[107,855,329],{"style":201},[107,857,296],{"style":197},[107,859,860,862,864,866,868,870,872,874,877,879,881,884,886,888,891,893,896,898,901,903,906,908,910,912],{"class":109,"style":110},[107,861,284],{"style":197},[107,863,338],{"style":201},[107,865,290],{"style":197},[107,867,343],{"style":201},[107,869,346],{"style":113},[107,871,349],{"style":201},[107,873,318],{"style":197},[107,875,876],{"style":113},"pluginZod",[107,878,349],{"style":201},[107,880,318],{"style":197},[107,882,883],{"style":113},"pluginFaker",[107,885,349],{"style":201},[107,887,318],{"style":197},[107,889,890],{"style":113},"pluginMsw",[107,892,364],{"style":201},[107,894,895],{"style":201},"parser",[107,897,290],{"style":197},[107,899,900],{"style":214},"'faker'",[107,902,318],{"style":197},[107,904,905],{"style":201},"handlers",[107,907,290],{"style":197},[107,909,326],{"style":201},[107,911,374],{"style":201},[107,913,296],{"style":197},[107,915,916],{"class":109,"style":110},[107,917,381],{"style":201},[10,919,920,921,924,925,927,928,934,935,938],{},"To use the global ",[14,922,923],{},"fetch"," instead of Axios, replace ",[14,926,354],{}," with ",[19,929,931],{"href":930},"\u002Fextensions\u002Fkubb-labs\u002Fplugin-fetch",[14,932,933],{},"pluginFetch"," from ",[14,936,937],{},"@kubb\u002Fplugin-fetch",".",[75,940,942],{"id":941},"format-lint-and-run-commands-after-generation","Format, lint, and run commands after generation",[944,945,946,964],"ul",{},[947,948,949,952,953,956,957,960,961,938],"li",{},[14,950,951],{},"format"," and ",[14,954,955],{},"lint"," take a tool name, or ",[14,958,959],{},"'auto'"," for the first one installed. Install the tools first, such as ",[14,962,963],{},"npm install -D @biomejs\u002Fbiome oxlint",[947,965,966,972,973,976,977,980,981,938],{},[19,967,969],{"href":968},"\u002Fdocs\u002F5.x\u002Freference\u002Fconfiguration#outputpostgenerate",[14,970,971],{},"output.postGenerate"," runs shell commands after formatting and linting. The example runs a ",[14,974,975],{},"typecheck"," script, such as ",[14,978,979],{},"\"typecheck\": \"tsc --noEmit\""," in ",[14,982,983],{},"package.json",[98,985,987],{"language":188,"filename":16,"code":986,"class":102},"import { defineConfig } from 'kubb\u002Fconfig'\nimport { pluginTs } from '@kubb\u002Fplugin-ts'\n\nexport default defineConfig({\n input: '.\u002FpetStore.yaml',\n output: {\n path: '.\u002Fsrc\u002Fgen',\n clean: true,\n format: 'biome',\n lint: 'oxlint',\n postGenerate: ['npm run typecheck'],\n },\n plugins: [pluginTs()],\n})",[14,988,989,119,1003,119,1017,119,1019,119,1029,119,1041,119,1052,119,1065,119,1078,119,1091,119,1104,119,1123,119,1131,119,1148],{"class":192},[107,990,991,993,995,997,999,1001],{"class":109,"style":110},[107,992,198],{"style":197},[107,994,202],{"style":201},[107,996,205],{"style":117},[107,998,208],{"style":201},[107,1000,211],{"style":197},[107,1002,215],{"style":214},[107,1004,1005,1007,1009,1011,1013,1015],{"class":109,"style":110},[107,1006,198],{"style":197},[107,1008,202],{"style":201},[107,1010,224],{"style":117},[107,1012,208],{"style":201},[107,1014,211],{"style":197},[107,1016,231],{"style":214},[107,1018],{"class":109,"style":110},[107,1020,1021,1023,1025,1027],{"class":109,"style":110},[107,1022,270],{"style":197},[107,1024,273],{"style":197},[107,1026,276],{"style":113},[107,1028,279],{"style":201},[107,1030,1031,1033,1035,1037,1039],{"class":109,"style":110},[107,1032,284],{"style":201},[107,1034,287],{"style":201},[107,1036,290],{"style":197},[107,1038,293],{"style":214},[107,1040,296],{"style":197},[107,1042,1043,1045,1047,1049],{"class":109,"style":110},[107,1044,284],{"style":197},[107,1046,303],{"style":201},[107,1048,290],{"style":197},[107,1050,1051],{"style":201},"{",[107,1053,1054,1057,1059,1061,1063],{"class":109,"style":110},[107,1055,1056],{"style":201}," ",[107,1058,310],{"style":201},[107,1060,290],{"style":197},[107,1062,315],{"style":214},[107,1064,296],{"style":197},[107,1066,1067,1069,1071,1073,1076],{"class":109,"style":110},[107,1068,1056],{"style":197},[107,1070,321],{"style":201},[107,1072,290],{"style":197},[107,1074,1075],{"style":201},"true",[107,1077,296],{"style":197},[107,1079,1080,1082,1084,1086,1089],{"class":109,"style":110},[107,1081,1056],{"style":197},[107,1083,951],{"style":201},[107,1085,290],{"style":197},[107,1087,1088],{"style":214},"'biome'",[107,1090,296],{"style":197},[107,1092,1093,1095,1097,1099,1102],{"class":109,"style":110},[107,1094,1056],{"style":197},[107,1096,955],{"style":201},[107,1098,290],{"style":197},[107,1100,1101],{"style":214},"'oxlint'",[107,1103,296],{"style":197},[107,1105,1106,1108,1111,1113,1115,1118,1121],{"class":109,"style":110},[107,1107,1056],{"style":197},[107,1109,1110],{"style":201},"postGenerate",[107,1112,290],{"style":197},[107,1114,343],{"style":201},[107,1116,1117],{"style":214},"'npm run typecheck'",[107,1119,1120],{"style":201},"]",[107,1122,296],{"style":197},[107,1124,1125,1127,1129],{"class":109,"style":110},[107,1126,284],{"style":197},[107,1128,329],{"style":201},[107,1130,296],{"style":197},[107,1132,1133,1135,1137,1139,1141,1143,1146],{"class":109,"style":110},[107,1134,284],{"style":197},[107,1136,338],{"style":201},[107,1138,290],{"style":197},[107,1140,343],{"style":201},[107,1142,346],{"style":113},[107,1144,1145],{"style":201},"()]",[107,1147,296],{"style":197},[107,1149,1150],{"class":109,"style":110},[107,1151,381],{"style":201},[75,1153,1155],{"id":1154},"check-generated-code-in-ci","Check generated code in CI",[10,1157,1158,1159,1165,1166,1169],{},"When you commit the generated files, ",[19,1160,1162],{"href":1161},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fgenerate#check-mode",[14,1163,1164],{},"kubb generate --check"," fails the pipeline if they no longer match the spec and the config. It writes nothing. ",[14,1167,1168],{},"--diff"," prints what would change.",[10,1171,1172,1173,1175,1176,938],{},"When the job exits with code 1, run ",[14,1174,30],{}," and commit the result. Code 2 means the config or the generation failed. See ",[19,1177,1179],{"href":1178},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fgenerate#exit-codes","Exit codes",[10,1181,1182,1183,1189],{},"Commit ",[19,1184,1186],{"href":1185},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fgenerate#kubb-lock",[14,1187,1188],{},"kubb-lock.json"," next to the generated files. The check reads it to recognize formatted output, so the job needs no formatter or linter.",[95,1191,1192,1357],{},[98,1193,1197],{"language":1194,"filename":1195,"code":1196,"class":102},"yaml",".github\u002Fworkflows\u002Fkubb-check.yml","name: Kubb check\n\non:\n pull_request:\n\njobs:\n check:\n runs-on: ubuntu-latest\n steps:\n - uses: actions\u002Fcheckout@v5\n - uses: actions\u002Fsetup-node@v5\n with:\n node-version: 22\n cache: npm\n - run: npm ci\n - run: npx kubb generate --check --diff",[14,1198,1200,119,1210,119,1212,119,1220,119,1229,119,1231,119,1238,119,1247,119,1259,119,1268,119,1281,119,1296,119,1306,119,1319,119,1330,119,1344],{"class":1199},"language-yaml",[107,1201,1202,1205,1207],{"class":109,"style":110},[107,1203,1204],{"style":201},"name",[107,1206,290],{"style":197},[107,1208,1209],{"style":214},"Kubb check",[107,1211],{"class":109,"style":110},[107,1213,1214,1217],{"class":109,"style":110},[107,1215,1216],{"style":201},"on",[107,1218,1219],{"style":197},":",[107,1221,1222,1224,1227],{"class":109,"style":110},[107,1223,284],{"style":197},[107,1225,1226],{"style":201},"pull_request",[107,1228,1219],{"style":197},[107,1230],{"class":109,"style":110},[107,1232,1233,1236],{"class":109,"style":110},[107,1234,1235],{"style":201},"jobs",[107,1237,1219],{"style":197},[107,1239,1240,1242,1245],{"class":109,"style":110},[107,1241,284],{"style":197},[107,1243,1244],{"style":201},"check",[107,1246,1219],{"style":197},[107,1248,1249,1251,1254,1256],{"class":109,"style":110},[107,1250,1056],{"style":197},[107,1252,1253],{"style":201},"runs-on",[107,1255,290],{"style":197},[107,1257,1258],{"style":214},"ubuntu-latest",[107,1260,1261,1263,1266],{"class":109,"style":110},[107,1262,1056],{"style":214},[107,1264,1265],{"style":201},"steps",[107,1267,1219],{"style":197},[107,1269,1270,1273,1276,1278],{"class":109,"style":110},[107,1271,1272],{"style":197}," - ",[107,1274,1275],{"style":201},"uses",[107,1277,290],{"style":197},[107,1279,1280],{"style":214},"actions\u002Fcheckout@v5",[107,1282,1283,1286,1289,1291,1293],{"class":109,"style":110},[107,1284,1285],{"style":214}," ",[107,1287,1288],{"style":197},"- ",[107,1290,1275],{"style":201},[107,1292,290],{"style":197},[107,1294,1295],{"style":214},"actions\u002Fsetup-node@v5",[107,1297,1298,1301,1304],{"class":109,"style":110},[107,1299,1300],{"style":214}," ",[107,1302,1303],{"style":201},"with",[107,1305,1219],{"style":197},[107,1307,1308,1311,1314,1316],{"class":109,"style":110},[107,1309,1310],{"style":197}," ",[107,1312,1313],{"style":201},"node-version",[107,1315,290],{"style":197},[107,1317,1318],{"style":201},"22",[107,1320,1321,1323,1326,1328],{"class":109,"style":110},[107,1322,1310],{"style":201},[107,1324,1325],{"style":201},"cache",[107,1327,290],{"style":197},[107,1329,150],{"style":214},[107,1331,1332,1334,1336,1339,1341],{"class":109,"style":110},[107,1333,1285],{"style":214},[107,1335,1288],{"style":197},[107,1337,1338],{"style":201},"run",[107,1340,290],{"style":197},[107,1342,1343],{"style":214},"npm ci",[107,1345,1346,1348,1350,1352,1354],{"class":109,"style":110},[107,1347,1285],{"style":214},[107,1349,1288],{"style":197},[107,1351,1338],{"style":201},[107,1353,290],{"style":197},[107,1355,1356],{"style":214},"npx kubb generate --check --diff",[98,1358,1361],{"language":1194,"filename":1359,"code":1360,"class":102},".gitlab-ci.yml","kubb-check:\n image: node:22\n rules:\n - if: $CI_PIPELINE_SOURCE == \"merge_request_event\"\n script:\n - npm ci\n - npx kubb generate --check --diff",[14,1362,1363,119,1370,119,1382,119,1391,119,1404,119,1413,119,1419],{"class":1199},[107,1364,1365,1368],{"class":109,"style":110},[107,1366,1367],{"style":201},"kubb-check",[107,1369,1219],{"style":197},[107,1371,1372,1374,1377,1379],{"class":109,"style":110},[107,1373,284],{"style":197},[107,1375,1376],{"style":201},"image",[107,1378,290],{"style":197},[107,1380,1381],{"style":214},"node:22",[107,1383,1384,1386,1389],{"class":109,"style":110},[107,1385,284],{"style":214},[107,1387,1388],{"style":201},"rules",[107,1390,1219],{"style":197},[107,1392,1393,1396,1399,1401],{"class":109,"style":110},[107,1394,1395],{"style":197}," - ",[107,1397,1398],{"style":201},"if",[107,1400,290],{"style":197},[107,1402,1403],{"style":214},"$CI_PIPELINE_SOURCE == \"merge_request_event\"",[107,1405,1406,1408,1411],{"class":109,"style":110},[107,1407,284],{"style":214},[107,1409,1410],{"style":201},"script",[107,1412,1219],{"style":197},[107,1414,1415,1417],{"class":109,"style":110},[107,1416,1395],{"style":197},[107,1418,1343],{"style":214},[107,1420,1421,1423,1425],{"class":109,"style":110},[107,1422,1056],{"style":214},[107,1424,1288],{"style":197},[107,1426,1356],{"style":214},[10,1428,1429,1430,1434],{},"To see which generated files changed against the base branch, publish a ",[19,1431,1433],{"href":1432},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fci","Studio snapshot"," in the same pipeline.",[75,1436,1438],{"id":1437},"reviewable-diffs","Keep generated diffs reviewable",[10,1440,1441,1442,1445,1446,1219],{},"Mark the output and the lockfile as generated, so GitHub collapses them in pull requests. Use your ",[14,1443,1444],{},"output.path"," without a leading ",[14,1447,1448],{},".\u002F",[98,1450,1454],{"language":1451,"filename":1452,"code":1453,"class":102},"text",".gitattributes","src\u002Fgen\u002F** linguist-generated=true\nkubb-lock.json linguist-generated=true",[14,1455,1457,119,1462],{"class":1456},"language-text",[107,1458,1459],{"class":109,"style":110},[107,1460,1461],{"style":117},"src\u002Fgen\u002F** linguist-generated=true",[107,1463,1464],{"class":109,"style":110},[107,1465,1466],{"style":117},"kubb-lock.json linguist-generated=true",[10,1468,1469,1470,1476,1477,1479,1480,938],{},"For a large spec, add ",[19,1471,1473],{"href":1472},"\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#group",[14,1474,1475],{},"group: { type: 'tag' }"," to each plugin so a change stays in one folder. For one file per plugin, give ",[14,1478,1444],{}," an extension, such as ",[14,1481,1482],{},"pluginTs({ output: { path: 'types.ts' } })",[75,1484,1486],{"id":1485},"barrel-files","Add barrel files",[10,1488,1489,1490,1493,1494,1496,1497,1503],{},"A barrel is an ",[14,1491,1492],{},"index.ts"," that re-exports a folder. ",[14,1495,276],{}," registers ",[19,1498,1500],{"href":1499},"\u002Fextensions\u002Fkubb-labs\u002Fplugin-barrel",[14,1501,1502],{},"@kubb\u002Fplugin-barrel"," for you, with these defaults:",[1505,1506,1507,1523],"table",{},[1508,1509,1510],"thead",{},[1511,1512,1513,1517,1520],"tr",{},[1514,1515,1516],"th",{},"Barrel",[1514,1518,1519],{},"Default",[1514,1521,1522],{},"Change it with",[1524,1525,1526,1546],"tbody",{},[1511,1527,1528,1535,1538],{},[1529,1530,1531,1532],"td",{},"Root, such as ",[14,1533,1534],{},"src\u002Fgen\u002Findex.ts",[1529,1536,1537],{},"Off",[1529,1539,1540,1543,1544],{},[14,1541,1542],{},"output.barrel"," on ",[14,1545,276],{},[1511,1547,1548,1554,1562],{},[1529,1549,1550,1551],{},"Plugin folder, such as ",[14,1552,1553],{},"src\u002Fgen\u002Ftypes\u002Findex.ts",[1529,1555,1556,1559,1560],{},[14,1557,1558],{},"{ type: 'named' }"," from the plugin's default ",[14,1561,303],{},[1529,1563,1564,1567,1568,1570,1571,1574],{},[14,1565,1566],{},"barrel"," inside the plugin's ",[14,1569,303],{},", or ",[14,1572,1573],{},"false"," to drop it",[10,1576,1577,1578,1581],{},"This config turns on the root barrel, writes ",[14,1579,1580],{},"export *"," barrels in every TypeScript subfolder, and leaves the Zod files out of all barrels:",[98,1583,1585],{"language":188,"filename":16,"code":1584,"class":102},"import { defineConfig } from 'kubb\u002Fconfig'\nimport { pluginTs } from '@kubb\u002Fplugin-ts'\nimport { pluginZod } from '@kubb\u002Fplugin-zod'\n\nexport default defineConfig({\n input: '.\u002FpetStore.yaml',\n output: { path: '.\u002Fsrc\u002Fgen', barrel: { type: 'named' } },\n plugins: [pluginTs({ output: { path: 'types', barrel: { type: 'all', nested: true } } }), pluginZod({ output: { path: 'zod', barrel: false } })],\n})",[14,1586,1587,119,1601,119,1615,119,1629,119,1631,119,1641,119,1653,119,1690,119,1777],{"class":192},[107,1588,1589,1591,1593,1595,1597,1599],{"class":109,"style":110},[107,1590,198],{"style":197},[107,1592,202],{"style":201},[107,1594,205],{"style":117},[107,1596,208],{"style":201},[107,1598,211],{"style":197},[107,1600,215],{"style":214},[107,1602,1603,1605,1607,1609,1611,1613],{"class":109,"style":110},[107,1604,198],{"style":197},[107,1606,202],{"style":201},[107,1608,224],{"style":117},[107,1610,208],{"style":201},[107,1612,211],{"style":197},[107,1614,231],{"style":214},[107,1616,1617,1619,1621,1623,1625,1627],{"class":109,"style":110},[107,1618,198],{"style":197},[107,1620,202],{"style":201},[107,1622,766],{"style":117},[107,1624,208],{"style":201},[107,1626,211],{"style":197},[107,1628,773],{"style":214},[107,1630],{"class":109,"style":110},[107,1632,1633,1635,1637,1639],{"class":109,"style":110},[107,1634,270],{"style":197},[107,1636,273],{"style":197},[107,1638,276],{"style":113},[107,1640,279],{"style":201},[107,1642,1643,1645,1647,1649,1651],{"class":109,"style":110},[107,1644,284],{"style":201},[107,1646,287],{"style":201},[107,1648,290],{"style":197},[107,1650,293],{"style":214},[107,1652,296],{"style":197},[107,1654,1655,1657,1659,1661,1663,1665,1667,1669,1671,1673,1675,1677,1680,1682,1685,1688],{"class":109,"style":110},[107,1656,284],{"style":197},[107,1658,303],{"style":201},[107,1660,290],{"style":197},[107,1662,202],{"style":201},[107,1664,310],{"style":201},[107,1666,290],{"style":197},[107,1668,315],{"style":214},[107,1670,318],{"style":197},[107,1672,1566],{"style":201},[107,1674,290],{"style":197},[107,1676,202],{"style":201},[107,1678,1679],{"style":201},"type",[107,1681,290],{"style":197},[107,1683,1684],{"style":214},"'named' ",[107,1686,1687],{"style":201},"} }",[107,1689,296],{"style":197},[107,1691,1692,1694,1696,1698,1700,1702,1704,1706,1708,1710,1712,1714,1717,1719,1721,1723,1725,1727,1729,1732,1734,1737,1739,1741,1744,1746,1748,1750,1752,1754,1756,1758,1760,1763,1765,1767,1769,1772,1775],{"class":109,"style":110},[107,1693,284],{"style":197},[107,1695,338],{"style":201},[107,1697,290],{"style":197},[107,1699,343],{"style":201},[107,1701,346],{"style":113},[107,1703,364],{"style":201},[107,1705,303],{"style":201},[107,1707,290],{"style":197},[107,1709,202],{"style":201},[107,1711,310],{"style":201},[107,1713,290],{"style":197},[107,1715,1716],{"style":214},"'types'",[107,1718,318],{"style":197},[107,1720,1566],{"style":201},[107,1722,290],{"style":197},[107,1724,202],{"style":201},[107,1726,1679],{"style":201},[107,1728,290],{"style":197},[107,1730,1731],{"style":214},"'all'",[107,1733,318],{"style":197},[107,1735,1736],{"style":201},"nested",[107,1738,290],{"style":197},[107,1740,326],{"style":201},[107,1742,1743],{"style":201},"} } })",[107,1745,318],{"style":197},[107,1747,876],{"style":113},[107,1749,364],{"style":201},[107,1751,303],{"style":201},[107,1753,290],{"style":197},[107,1755,202],{"style":201},[107,1757,310],{"style":201},[107,1759,290],{"style":197},[107,1761,1762],{"style":214},"'zod'",[107,1764,318],{"style":197},[107,1766,1566],{"style":201},[107,1768,290],{"style":197},[107,1770,1771],{"style":201},"false ",[107,1773,1774],{"style":201},"} })]",[107,1776,296],{"style":197},[107,1778,1779],{"class":109,"style":110},[107,1780,381],{"style":201},[62,1782,1784,1785,1787,1788,1790,1791,1793,1794,1796],{"as":1783},"important","Your own ",[14,1786,303],{}," on a plugin replaces its default, barrel included. Set ",[14,1789,1566],{}," in it, or the plugin falls back to the root ",[14,1792,1542],{},". A plugin writes a barrel only in directory mode, when its ",[14,1795,1444],{}," has no file extension.",[10,1798,1799,1804,1805,952,1807,1810],{},[19,1800,1802],{"href":1801},"\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#output-barrel",[14,1803,1542],{}," shows each export style and the ",[14,1806,1736],{},[14,1808,1809],{},"namespace"," fields.",[75,1812,1814],{"id":1813},"read-the-spec-from-a-git-repository","Read the spec from a git repository",[10,1816,1817,1818,1820,1821,1824,1825,1828],{},"When the spec lives in another repository, set ",[14,1819,287],{}," to ",[14,1822,1823],{},"git+\u003Crepo>#\u003Cref>:\u003Cpath>",". Pin ",[14,1826,1827],{},"\u003Cref>"," to a tag or commit so every run uses the same spec:",[98,1830,1832],{"language":188,"filename":16,"code":1831,"class":102},"import { defineConfig } from 'kubb\u002Fconfig'\nimport { pluginTs } from '@kubb\u002Fplugin-ts'\n\nexport default defineConfig({\n input: 'git+https:\u002F\u002Fgithub.com\u002Forg\u002Fapi.git#v2.1.0:specs\u002Fopenapi.yaml',\n output: { path: '.\u002Fsrc\u002Fgen' },\n plugins: [pluginTs()],\n})",[14,1833,1834,119,1848,119,1862,119,1864,119,1874,119,1887,119,1908,119,1924],{"class":192},[107,1835,1836,1838,1840,1842,1844,1846],{"class":109,"style":110},[107,1837,198],{"style":197},[107,1839,202],{"style":201},[107,1841,205],{"style":117},[107,1843,208],{"style":201},[107,1845,211],{"style":197},[107,1847,215],{"style":214},[107,1849,1850,1852,1854,1856,1858,1860],{"class":109,"style":110},[107,1851,198],{"style":197},[107,1853,202],{"style":201},[107,1855,224],{"style":117},[107,1857,208],{"style":201},[107,1859,211],{"style":197},[107,1861,231],{"style":214},[107,1863],{"class":109,"style":110},[107,1865,1866,1868,1870,1872],{"class":109,"style":110},[107,1867,270],{"style":197},[107,1869,273],{"style":197},[107,1871,276],{"style":113},[107,1873,279],{"style":201},[107,1875,1876,1878,1880,1882,1885],{"class":109,"style":110},[107,1877,284],{"style":201},[107,1879,287],{"style":201},[107,1881,290],{"style":197},[107,1883,1884],{"style":214},"'git+https:\u002F\u002Fgithub.com\u002Forg\u002Fapi.git#v2.1.0:specs\u002Fopenapi.yaml'",[107,1886,296],{"style":197},[107,1888,1889,1891,1893,1895,1897,1899,1901,1904,1906],{"class":109,"style":110},[107,1890,284],{"style":197},[107,1892,303],{"style":201},[107,1894,290],{"style":197},[107,1896,202],{"style":201},[107,1898,310],{"style":201},[107,1900,290],{"style":197},[107,1902,1903],{"style":214},"'.\u002Fsrc\u002Fgen' ",[107,1905,329],{"style":201},[107,1907,296],{"style":197},[107,1909,1910,1912,1914,1916,1918,1920,1922],{"class":109,"style":110},[107,1911,284],{"style":197},[107,1913,338],{"style":201},[107,1915,290],{"style":197},[107,1917,343],{"style":201},[107,1919,346],{"style":113},[107,1921,1145],{"style":201},[107,1923,296],{"style":197},[107,1925,1926],{"class":109,"style":110},[107,1927,381],{"style":201},[10,1929,1930,1931,1934,1935,1938,1939,1944],{},"Kubb runs ",[14,1932,1933],{},"git"," from the ",[14,1936,1937],{},"PATH"," with your credentials, so a private repository works with your credential helper or SSH key. In CI, give the job read access to that repository. ",[19,1940,1942],{"href":1941},"\u002Fdocs\u002F5.x\u002Freference\u002Fconfiguration#input",[14,1943,287],{}," has the full format.",[75,1946,1948],{"id":1947},"security","Limit what a spec may read",[10,1950,1951,1952,1955,1956,1959,1960,1965,1966,1968,1969,952,1971,1219],{},"A spec can point at other files and URLs with ",[14,1953,1954],{},"$ref",". By default ",[14,1957,1958],{},"kubb generate"," reads all of them. Add ",[19,1961,1963],{"href":1962},"\u002Fdocs\u002F5.x\u002Freference\u002Fconfiguration#security",[14,1964,1947],{}," to limit that. Each recipe below is the ",[14,1967,1947],{}," key of your config, so add it next to ",[14,1970,287],{},[14,1972,338],{},[98,1974,1976],{"language":188,"filename":16,"code":1975,"class":102},"import { defineConfig } from 'kubb\u002Fconfig'\nimport { pluginTs } from '@kubb\u002Fplugin-ts'\n\nexport default defineConfig({\n input: '.\u002FpetStore.yaml',\n output: { path: '.\u002Fsrc\u002Fgen' },\n plugins: [pluginTs()],\n security: {\n \u002F\u002F a recipe from this section\n },\n})",[14,1977,1978,119,1992,119,2006,119,2008,119,2018,119,2030,119,2050,119,2066,119,2076,119,2084,119,2092],{"class":192},[107,1979,1980,1982,1984,1986,1988,1990],{"class":109,"style":110},[107,1981,198],{"style":197},[107,1983,202],{"style":201},[107,1985,205],{"style":117},[107,1987,208],{"style":201},[107,1989,211],{"style":197},[107,1991,215],{"style":214},[107,1993,1994,1996,1998,2000,2002,2004],{"class":109,"style":110},[107,1995,198],{"style":197},[107,1997,202],{"style":201},[107,1999,224],{"style":117},[107,2001,208],{"style":201},[107,2003,211],{"style":197},[107,2005,231],{"style":214},[107,2007],{"class":109,"style":110},[107,2009,2010,2012,2014,2016],{"class":109,"style":110},[107,2011,270],{"style":197},[107,2013,273],{"style":197},[107,2015,276],{"style":113},[107,2017,279],{"style":201},[107,2019,2020,2022,2024,2026,2028],{"class":109,"style":110},[107,2021,284],{"style":201},[107,2023,287],{"style":201},[107,2025,290],{"style":197},[107,2027,293],{"style":214},[107,2029,296],{"style":197},[107,2031,2032,2034,2036,2038,2040,2042,2044,2046,2048],{"class":109,"style":110},[107,2033,284],{"style":197},[107,2035,303],{"style":201},[107,2037,290],{"style":197},[107,2039,202],{"style":201},[107,2041,310],{"style":201},[107,2043,290],{"style":197},[107,2045,1903],{"style":214},[107,2047,329],{"style":201},[107,2049,296],{"style":197},[107,2051,2052,2054,2056,2058,2060,2062,2064],{"class":109,"style":110},[107,2053,284],{"style":197},[107,2055,338],{"style":201},[107,2057,290],{"style":197},[107,2059,343],{"style":201},[107,2061,346],{"style":113},[107,2063,1145],{"style":201},[107,2065,296],{"style":197},[107,2067,2068,2070,2072,2074],{"class":109,"style":110},[107,2069,284],{"style":197},[107,2071,1947],{"style":201},[107,2073,290],{"style":197},[107,2075,1051],{"style":201},[107,2077,2078,2080],{"class":109,"style":110},[107,2079,1056],{"style":201},[107,2081,2083],{"style":2082},"color:#6a737d;--hls-dark:#6a737d","\u002F\u002F a recipe from this section",[107,2085,2086,2088,2090],{"class":109,"style":110},[107,2087,284],{"style":2082},[107,2089,329],{"style":201},[107,2091,296],{"style":197},[107,2093,2094],{"class":109,"style":110},[107,2095,381],{"style":201},[10,2097,2098,2099,2101,2102,2104,2105,2108],{},"Once ",[14,2100,1947],{}," is set, a ",[14,2103,1954],{}," reads files inside your project and public hosts, and never a secret file such as ",[14,2106,2107],{},".env"," or a key. The recipes open or close more. The same rules apply on your machine, in CI, and on a Kubb Studio agent you host.",[2110,2111,2113],"h3",{"id":2112},"share-schemas-from-a-folder-next-to-the-project","Share schemas from a folder next to the project",[98,2115,2117],{"language":188,"code":2116,"class":102},"security: {\n read: { allow: ['..\u002Fshared-schemas'] },\n}",[14,2118,2119,119,2127,119,2153],{"class":192},[107,2120,2121,2123,2125],{"class":109,"style":110},[107,2122,1947],{"style":117},[107,2124,290],{"style":197},[107,2126,1051],{"style":201},[107,2128,2129,2131,2134,2136,2138,2141,2143,2145,2148,2151],{"class":109,"style":110},[107,2130,284],{"style":201},[107,2132,2133],{"style":201},"read",[107,2135,290],{"style":197},[107,2137,202],{"style":201},[107,2139,2140],{"style":201},"allow",[107,2142,290],{"style":197},[107,2144,343],{"style":201},[107,2146,2147],{"style":214},"'..\u002Fshared-schemas'",[107,2149,2150],{"style":201},"] }",[107,2152,296],{"style":197},[107,2154,2155],{"class":109,"style":110},[107,2156,329],{"style":201},[10,2158,2159],{},"The folder adds to the project folder, so files in the project stay readable.",[2110,2161,2163],{"id":2162},"read-from-an-internal-host","Read from an internal host",[98,2165,2167],{"language":188,"code":2166,"class":102},"security: {\n net: { allow: ['specs.corp.internal'] },\n}",[14,2168,2169,119,2177,119,2201],{"class":192},[107,2170,2171,2173,2175],{"class":109,"style":110},[107,2172,1947],{"style":117},[107,2174,290],{"style":197},[107,2176,1051],{"style":201},[107,2178,2179,2181,2184,2186,2188,2190,2192,2194,2197,2199],{"class":109,"style":110},[107,2180,284],{"style":201},[107,2182,2183],{"style":201},"net",[107,2185,290],{"style":197},[107,2187,202],{"style":201},[107,2189,2140],{"style":201},[107,2191,290],{"style":197},[107,2193,343],{"style":201},[107,2195,2196],{"style":214},"'specs.corp.internal'",[107,2198,2150],{"style":201},[107,2200,296],{"style":197},[107,2202,2203],{"class":109,"style":110},[107,2204,329],{"style":201},[10,2206,2207,2208,318,2211,2214,2215,2218,2219,938],{},"Kubb reaches the host on a private address too. Write ",[14,2209,2210],{},"host",[14,2212,2213],{},"*.host"," for subdomains, or ",[14,2216,2217],{},"host:port",". For a spec on your own machine, allow ",[14,2220,2221],{},"localhost:3000",[2110,2223,2225],{"id":2224},"reach-only-the-hosts-you-list","Reach only the hosts you list",[98,2227,2229],{"language":188,"code":2228,"class":102},"security: {\n net: { public: false, allow: ['specs.corp.internal', 'raw.githubusercontent.com'] },\n}",[14,2230,2231,119,2239,119,2275],{"class":192},[107,2232,2233,2235,2237],{"class":109,"style":110},[107,2234,1947],{"style":117},[107,2236,290],{"style":197},[107,2238,1051],{"style":201},[107,2240,2241,2243,2245,2247,2249,2252,2254,2256,2258,2260,2262,2264,2266,2268,2271,2273],{"class":109,"style":110},[107,2242,284],{"style":201},[107,2244,2183],{"style":201},[107,2246,290],{"style":197},[107,2248,202],{"style":201},[107,2250,2251],{"style":197},"public",[107,2253,290],{"style":197},[107,2255,1573],{"style":201},[107,2257,318],{"style":197},[107,2259,2140],{"style":201},[107,2261,290],{"style":197},[107,2263,343],{"style":201},[107,2265,2196],{"style":214},[107,2267,318],{"style":197},[107,2269,2270],{"style":214},"'raw.githubusercontent.com'",[107,2272,2150],{"style":201},[107,2274,296],{"style":197},[107,2276,2277],{"class":109,"style":110},[107,2278,329],{"style":201},[10,2280,2281,2284],{},[14,2282,2283],{},"public: false"," turns every other host off.",[2110,2286,2288],{"id":2287},"run-ci-without-a-network","Run CI without a network",[98,2290,2292],{"language":188,"code":2291,"class":102},"security: {\n net: process.env.CI ? false : {},\n}",[14,2293,2294,119,2302,119,2335],{"class":192},[107,2295,2296,2298,2300],{"class":109,"style":110},[107,2297,1947],{"style":117},[107,2299,290],{"style":197},[107,2301,1051],{"style":201},[107,2303,2304,2306,2308,2310,2313,2315,2318,2320,2323,2326,2328,2330,2333],{"class":109,"style":110},[107,2305,284],{"style":201},[107,2307,2183],{"style":201},[107,2309,290],{"style":197},[107,2311,2312],{"style":117},"process",[107,2314,938],{"style":197},[107,2316,2317],{"style":201},"env",[107,2319,938],{"style":197},[107,2321,2322],{"style":201},"CI ",[107,2324,2325],{"style":197},"? ",[107,2327,1771],{"style":201},[107,2329,290],{"style":197},[107,2331,2332],{"style":201},"{}",[107,2334,296],{"style":197},[107,2336,2337],{"class":109,"style":110},[107,2338,329],{"style":201},[10,2340,2341],{},"The config is TypeScript, so it can read the environment. On a CI runner no host is reached. Elsewhere the built-in rules apply.",[2110,2343,2345],{"id":2344},"refuse-a-folder-or-a-host","Refuse a folder or a host",[98,2347,2349],{"language":188,"code":2348,"class":102},"security: {\n read: { deny: ['fixtures\u002Fprivate\u002F**'] },\n net: { deny: ['*.example.org'] },\n}",[14,2350,2351,119,2359,119,2383,119,2406],{"class":192},[107,2352,2353,2355,2357],{"class":109,"style":110},[107,2354,1947],{"style":117},[107,2356,290],{"style":197},[107,2358,1051],{"style":201},[107,2360,2361,2363,2365,2367,2369,2372,2374,2376,2379,2381],{"class":109,"style":110},[107,2362,284],{"style":201},[107,2364,2133],{"style":201},[107,2366,290],{"style":197},[107,2368,202],{"style":201},[107,2370,2371],{"style":201},"deny",[107,2373,290],{"style":197},[107,2375,343],{"style":201},[107,2377,2378],{"style":214},"'fixtures\u002Fprivate\u002F**'",[107,2380,2150],{"style":201},[107,2382,296],{"style":197},[107,2384,2385,2387,2389,2391,2393,2395,2397,2399,2402,2404],{"class":109,"style":110},[107,2386,284],{"style":197},[107,2388,2183],{"style":201},[107,2390,290],{"style":197},[107,2392,202],{"style":201},[107,2394,2371],{"style":201},[107,2396,290],{"style":197},[107,2398,343],{"style":201},[107,2400,2401],{"style":214},"'*.example.org'",[107,2403,2150],{"style":201},[107,2405,296],{"style":197},[107,2407,2408],{"class":109,"style":110},[107,2409,329],{"style":201},[10,2411,2412],{},"A deny wins over every allow.",[2110,2414,2416],{"id":2415},"use-the-company-proxy","Use the company proxy",[98,2418,2420],{"language":188,"code":2419,"class":102},"security: {\n net: { proxy: true },\n}",[14,2421,2422,119,2430,119,2451],{"class":192},[107,2423,2424,2426,2428],{"class":109,"style":110},[107,2425,1947],{"style":117},[107,2427,290],{"style":197},[107,2429,1051],{"style":201},[107,2431,2432,2434,2436,2438,2440,2443,2445,2447,2449],{"class":109,"style":110},[107,2433,284],{"style":201},[107,2435,2183],{"style":201},[107,2437,290],{"style":197},[107,2439,202],{"style":201},[107,2441,2442],{"style":201},"proxy",[107,2444,290],{"style":197},[107,2446,326],{"style":201},[107,2448,329],{"style":201},[107,2450,296],{"style":197},[107,2452,2453],{"class":109,"style":110},[107,2454,329],{"style":201},[10,2456,2457,2458,2461,2462,2465,2466,2469],{},"Requests go through ",[14,2459,2460],{},"HTTP_PROXY"," or ",[14,2463,2464],{},"HTTPS_PROXY",". A host on ",[14,2467,2468],{},"NO_PROXY"," connects directly.",[10,2471,2472,2473,2479,2480,2484],{},"When a run fails with ",[19,2474,2476],{"href":2475},"\u002Fdocs\u002F5.x\u002Freference\u002Fdiagnostics#kubb-access-refused",[14,2477,2478],{},"KUBB_ACCESS_REFUSED",", the message names the file or host and the rule that refused it. ",[19,2481,2483],{"href":2482},"\u002Fdocs\u002F5.x\u002Freference\u002Fsecurity","Security"," lists every setting.",[75,2486,2488],{"id":2487},"watch-mode-several-specifications-and-scripts","Watch mode, several specifications, and scripts",[1505,2490,2491,2501],{},[1508,2492,2493],{},[1511,2494,2495,2498],{},[1514,2496,2497],{},"To",[1514,2499,2500],{},"Do this",[1524,2502,2503,2519,2533,2548],{},[1511,2504,2505,2508],{},[1529,2506,2507],{},"Generate again when the local spec changes",[1529,2509,2510,2511,2514,2515,938],{},"Run ",[14,2512,2513],{},"kubb generate --watch",". A URL or git input generates once. See ",[19,2516,2518],{"href":2517},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fgenerate#watch-mode-details","Watch mode details",[1511,2520,2521,2524],{},[1529,2522,2523],{},"Generate from several specs in one run",[1529,2525,2526,2527,2529,2530,2532],{},"Pass an array to ",[14,2528,276],{},", each entry with its own plugins and output directory. Set a ",[14,2531,1204],{}," per entry to tell them apart in the CLI output.",[1511,2534,2535,2538],{},[1529,2536,2537],{},"Drive Kubb from a script",[1529,2539,2540,2541,2547],{},"Call ",[19,2542,2544],{"href":2543},"\u002Fdocs\u002F5.x\u002Freference\u002Fkit\u002Fengine#createkubb",[14,2545,2546],{},"createKubb"," to run builds or read diagnostics.",[1511,2549,2550,2553],{},[1529,2551,2552],{},"Fail CI on an invalid spec",[1529,2554,2510,2555,2561,2562,938],{},[19,2556,2558],{"href":2557},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fvalidate",[14,2559,2560],{},"kubb validate"," before ",[14,2563,1958],{},{"title":2565,"searchDepth":2566,"depth":2566,"links":2567},"",5,[2568,2570,2571,2572,2573,2574,2575,2584],{"id":77,"depth":2569,"text":78},2,{"id":941,"depth":2569,"text":942},{"id":1154,"depth":2569,"text":1155},{"id":1437,"depth":2569,"text":1438},{"id":1485,"depth":2569,"text":1486},{"id":1813,"depth":2569,"text":1814},{"id":1947,"depth":2569,"text":1948,"children":2576},[2577,2579,2580,2581,2582,2583],{"id":2112,"depth":2578,"text":2113},3,{"id":2162,"depth":2578,"text":2163},{"id":2224,"depth":2578,"text":2225},{"id":2287,"depth":2578,"text":2288},{"id":2344,"depth":2578,"text":2345},{"id":2415,"depth":2578,"text":2416},{"id":2487,"depth":2569,"text":2488},"Configure common Kubb stacks, formatting, linting, post-generate commands, a CI check, reviewable diffs, barrel files, git inputs, what a spec may read, watch mode, and several specs in one run.","md",{"layout":2588,"title":5,"description":2585,"outline":2589,"order":2569,"navigation":2590},"doc",[2569,2578],{"title":2591,"icon":2592},"Configure generation","i-iconoir-flask",{"layout":2588,"outline":2594},[2569,2578],{"title":2591,"icon":2592},"\u002Fdocs\u002F5.x\u002Fhow-to\u002Frecipes",{"title":5,"description":2585},{"loc":2596},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Fhow-to\u002Frecipes.md","docs\u002F5.x\u002Fhow-to\u002Frecipes","ylgk55SXYS_pi0NJ-gYiUqoutnaBnpSLjOYiwpws46Q",1795989032125,"2e8b4c62-5b8c-4587-97c0-530d08a9bd53"]