[{"data":1,"prerenderedAt":869,"buildId":870},["ShallowReactive",2],{"page:\u002Fextensions\u002Fkubb-labs\u002Fplugin-client\u002Foptions":3},{"id":4,"frontmatter":5,"title":6,"heading":6,"body":7,"path":868,"source":4},"extensions\u002Fkubb-labs\u002Fplugin-client\u002Foptions.md",{},"Options",{"type":8,"value":9,"toc":854},"minimark",[10,25,30,288,292,296,299,329,387,402,405,407,444,499,505,545,548,554,591,593,612,649,694,718,720,726,755,782,794],[11,12,13,14,18,19,24],"p",{},"Pass these options to ",[15,16,17],"code",{},"pluginClient()",". Shared options link to ",[20,21,23],"a",{"href":22},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options","Shared plugin options",".",[26,27,29],"h2",{"id":28},"options-overview","Options overview",[31,32,33,49],"table",{},[34,35,36],"thead",{},[37,38,39,43,46],"tr",{},[40,41,42],"th",{},"Option",[40,44,45],{},"Purpose",[40,47,48],{},"Default",[50,51,52,69,87,108,126,144,164,182,197,212,230,252,270],"tbody",{},[37,53,54,63,66],{},[55,56,57],"td",{},[20,58,60],{"href":59},"#importpath",[15,61,62],{},"importPath",[55,64,65],{},"Import specifier of your client module.",[55,67,68],{},"Required",[37,70,71,79,82],{},[55,72,73],{},[20,74,76],{"href":75},"#returntype",[15,77,78],{},"returnType",[55,80,81],{},"What a generated function resolves to.",[55,83,84],{},[15,85,86],{},"'plain'",[37,88,89,97,103],{},[55,90,91],{},[20,92,94],{"href":93},"#throwonerrordefault",[15,95,96],{},"throwOnErrorDefault",[55,98,99,102],{},[15,100,101],{},"throwOnError"," value each call passes to your client.",[55,104,105],{},[15,106,107],{},"true",[37,109,110,118,121],{},[55,111,112],{},[20,113,115],{"href":114},"#validator",[15,116,117],{},"validator",[55,119,120],{},"Zod or Valibot schemas to pass to your client.",[55,122,123],{},[15,124,125],{},"false",[37,127,128,136,141],{},[55,129,130],{},[20,131,133],{"href":132},"#auth",[15,134,135],{},"auth",[55,137,138,139,24],{},"How generated functions take ",[15,140,135],{},[55,142,143],{},"None",[37,145,146,153,159],{},[55,147,148],{},[20,149,150],{"href":132},[15,151,152],{},"auth.mode",[55,154,155,156,158],{},"Optional ",[15,157,135],{},", or required when a token is needed.",[55,160,161],{},[15,162,163],{},"'optional'",[37,165,166,174,177],{},[55,167,168],{},[20,169,171],{"href":170},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#output",[15,172,173],{},"output",[55,175,176],{},"Where files are written.",[55,178,179],{},[15,180,181],{},"{ path: 'clients', barrel: { type: 'named' } }",[37,183,184,192,195],{},[55,185,186],{},[20,187,189],{"href":188},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#group",[15,190,191],{},"group",[55,193,194],{},"Split output by tag or path.",[55,196,143],{},[37,198,199,207,210],{},[55,200,201],{},[20,202,204],{"href":203},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#include",[15,205,206],{},"include",[55,208,209],{},"Keep only operations that match.",[55,211,143],{},[37,213,214,222,225],{},[55,215,216],{},[20,217,219],{"href":218},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#exclude",[15,220,221],{},"exclude",[55,223,224],{},"Skip operations that match.",[55,226,227],{},[15,228,229],{},"[]",[37,231,232,240,248],{},[55,233,234],{},[20,235,237],{"href":236},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#override",[15,238,239],{},"override",[55,241,242,243,245,246,24],{},"Apply different options per pattern, except ",[15,244,78],{}," and ",[15,247,96],{},[55,249,250],{},[15,251,229],{},[37,253,254,262,265],{},[55,255,256],{},[20,257,259],{"href":258},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#resolver",[15,260,261],{},"resolver",[55,263,264],{},"Customize generated names and file paths. Takes one patch or an array of patches.",[55,266,267],{},[15,268,269],{},"resolverClient",[37,271,272,280,283],{},[55,273,274],{},[20,275,277],{"href":276},"https:\u002F\u002Fkubb.dev\u002Fdocs\u002F5.x\u002Freference\u002Fplugin-options#macros",[15,278,279],{},"macros",[55,281,282],{},"Rewrite AST nodes before printing.",[55,284,285,287],{},[15,286,229],{},", run after the built-in client macros",[26,289,291],{"id":290},"option-details","Option details",[293,294,62],"h3",{"id":295},"importpath",[11,297,298],{},"Import specifier of your client module, written into every generated import as given. It must resolve from the generated file: use a relative path, a package name, or an alias.",[31,300,301,309],{},[34,302,303],{},[37,304,305,307],{},[40,306],{},[40,308],{},[50,310,311,321],{},[37,312,313,316],{},[55,314,315],{},"Type",[55,317,318],{},[15,319,320],{},"string",[37,322,323,325],{},[55,324,68],{},[55,326,327],{},[15,328,107],{},[330,331,335],"pre",{"language":332,"code":333,"class":334},"typescript","pluginClient({ importPath: '..\u002F..\u002F..\u002Fclient' }) \u002F\u002F from src\u002Fgen\u002Fclients\u002F\u003Ctag>\u002F to src\u002Fclient.ts\npluginClient({ importPath: '@my-org\u002Fapi-client' }) \u002F\u002F a package","highlights",[15,336,338,368,369],{"class":337},"language-typescript",[339,340,343,347,351,353,357,361,364],"span",{"class":341,"style":342},"line","display: inline",[339,344,346],{"style":345},"color:#6f42c1;--hls-dark:#b392f0","pluginClient",[339,348,350],{"style":349},"color:#005cc5;--hls-dark:#79b8ff","({ ",[339,352,62],{"style":349},[339,354,356],{"style":355},"color:#d73a49;--hls-dark:#f97583",": ",[339,358,360],{"style":359},"color:#032f62;--hls-dark:#9ecbff","'..\u002F..\u002F..\u002Fclient' ",[339,362,363],{"style":349},"}) ",[339,365,367],{"style":366},"color:#6a737d;--hls-dark:#6a737d","\u002F\u002F from src\u002Fgen\u002Fclients\u002F\u003Ctag>\u002F to src\u002Fclient.ts","\n",[339,370,371,373,375,377,379,382,384],{"class":341,"style":342},[339,372,346],{"style":345},[339,374,350],{"style":349},[339,376,62],{"style":349},[339,378,356],{"style":355},[339,380,381],{"style":359},"'@my-org\u002Fapi-client' ",[339,383,363],{"style":349},[339,385,386],{"style":366},"\u002F\u002F a package",[11,388,389,390,392,393,396,397,401],{},"Without ",[15,391,191],{},", files sit one folder higher, so use ",[15,394,395],{},"..\u002F..\u002Fclient",". ",[20,398,400],{"href":399},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-client\u002Fguides\u002Fwrite-your-client","Write your client"," lists the exports the module needs.",[293,403,78],{"id":404},"returntype",[11,406,81],{},[31,408,409,417],{},[34,410,411],{},[37,412,413,415],{},[40,414],{},[40,416],{},[50,418,419,428,436],{},[37,420,421,423],{},[55,422,315],{},[55,424,425],{},[15,426,427],{},"'plain' | 'full' | 'data'",[37,429,430,432],{},[55,431,68],{},[55,433,434],{},[15,435,125],{},[37,437,438,440],{},[55,439,48],{},[55,441,442],{},[15,443,86],{},[445,446,447,455,479],"field-group",{},[448,449,450,451,454],"field",{"name":86},"Default. Returns what your ",[15,452,453],{},"client"," returns.",[448,456,458,459,462,463,466,467,470,471,474,475,478],{"name":457},"'full'","The caller can ",[15,460,461],{},"await"," the call or call ",[15,464,465],{},".unwrap()",". Your module must export ",[15,468,469],{},"withUnwrap",", ",[15,472,473],{},"resolveThrowOnError",", and the ",[15,476,477],{},"Unwrappable"," type.",[448,480,482,483,485,486,488,489,466,491,470,494,474,496,478],{"name":481},"'data'","Resolves to the body when ",[15,484,101],{}," is ",[15,487,107],{},", and to the full result when it is ",[15,490,125],{},[15,492,493],{},"unwrapResult",[15,495,473],{},[15,497,498],{},"UnwrappedResult",[11,500,501,502,24],{},"You can re-export these helpers from ",[15,503,504],{},"@kubb\u002Fplugin-client\u002Ftemplates\u002Fcore.ts",[330,506,508],{"language":332,"code":507,"class":334},"pluginClient({ importPath: '..\u002F..\u002Fclient', returnType: 'full' })\n\u002F\u002F with integerType: 'number' on the adapter\n\u002F\u002F const pet = await getPetById({ path: { petId: 1 } }).unwrap()",[15,509,510,368,535,368,540],{"class":337},[339,511,512,514,516,518,520,523,525,527,529,532],{"class":341,"style":342},[339,513,346],{"style":345},[339,515,350],{"style":349},[339,517,62],{"style":349},[339,519,356],{"style":355},[339,521,522],{"style":359},"'..\u002F..\u002Fclient'",[339,524,470],{"style":355},[339,526,78],{"style":349},[339,528,356],{"style":355},[339,530,531],{"style":359},"'full' ",[339,533,534],{"style":349},"})",[339,536,537],{"class":341,"style":342},[339,538,539],{"style":366},"\u002F\u002F with integerType: 'number' on the adapter",[339,541,542],{"class":341,"style":342},[339,543,544],{"style":366},"\u002F\u002F const pet = await getPetById({ path: { petId: 1 } }).unwrap()",[293,546,96],{"id":547},"throwonerrordefault",[11,549,550,551,553],{},"The ",[15,552,101],{}," value every generated function passes to your client, unless the call sets its own. Your client decides what the flag does.",[31,555,556,564],{},[34,557,558],{},[37,559,560,562],{},[40,561],{},[40,563],{},[50,565,566,575,583],{},[37,567,568,570],{},[55,569,315],{},[55,571,572],{},[15,573,574],{},"boolean",[37,576,577,579],{},[55,578,68],{},[55,580,581],{},[15,582,125],{},[37,584,585,587],{},[55,586,48],{},[55,588,589],{},[15,590,107],{},[293,592,117],{"id":117},[11,594,595,596,599,600,603,604,607,608,24],{},"Passes Zod schemas from ",[15,597,598],{},"@kubb\u002Fplugin-zod",", or Valibot schemas from ",[15,601,602],{},"@kubb\u002Fplugin-valibot",", to your client on ",[15,605,606],{},"config.validator",". Your client runs them. See ",[20,609,611],{"href":610},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-client\u002Fguides\u002Fvalidate-requests-and-responses","Validate requests and responses",[31,613,614,622],{},[34,615,616],{},[37,617,618,620],{},[40,619],{},[40,621],{},[50,623,624,633,641],{},[37,625,626,628],{},[55,627,315],{},[55,629,630],{},[15,631,632],{},"false | 'zod' | 'valibot' | { request?; params?; response? }",[37,634,635,637],{},[55,636,68],{},[55,638,639],{},[15,640,125],{},[37,642,643,645],{},[55,644,48],{},[55,646,647],{},[15,648,125],{},[445,650,651,654,660,665],{},[448,652,653],{"name":125},"Default. Passes nothing.",[448,655,657,658,24],{"name":656},"'zod'","Passes the response and error schemas of ",[15,659,598],{},[448,661,657,663,24],{"name":662},"'valibot'",[15,664,602],{},[448,666,668,669,671,672,674,675,678,679,682,683,686,687,689,690,693],{"name":667},"{ request?, params?, response? }","Opts in per slot, with ",[15,670,656],{}," or ",[15,673,662],{}," as the value. Use one library for every slot. ",[15,676,677],{},"request"," for the body, ",[15,680,681],{},"params"," for the path, query, header, and cookie schemas, and ",[15,684,685],{},"response"," for the response and error schemas. ",[15,688,681],{}," also imports ",[15,691,692],{},"toHeadersStandardSchema"," from your module.",[695,696,698,699,702,703,705,706,709,710,470,712,709,715,717],"blockquote",{"as":697},"important","Add the plugin of the library to ",[15,700,701],{},"plugins"," when ",[15,704,117],{}," is set: ",[15,707,708],{},"pluginZod()"," for ",[15,711,656],{},[15,713,714],{},"pluginValibot()",[15,716,662],{},". Without it, generation stops with an error.",[293,719,135],{"id":135},[11,721,722,723,725],{},"Sets how generated functions take the ",[15,724,135],{}," option.",[31,727,728,736],{},[34,729,730],{},[37,731,732,734],{},[40,733],{},[40,735],{},[50,737,738,747],{},[37,739,740,742],{},[55,741,315],{},[55,743,744],{},[15,745,746],{},"{ mode?: 'optional' | 'required' }",[37,748,749,751],{},[55,750,68],{},[55,752,753],{},[15,754,125],{},[445,756,757,764],{},[448,758,760,761,763],{"name":759},"mode: 'optional'","Default value. Every generated function takes ",[15,762,135],{}," as an optional option. Use it with the query-hook plugins, which pass a partial config to the function.",[448,765,767,768,770,771,774,775,778,779,781],{"name":766},"mode: 'required'","A generated function whose operation needs a security scheme takes ",[15,769,135],{}," as a required option, so a missing token fails at compile time. An operation without ",[15,772,773],{},"security",", or one that allows ",[15,776,777],{},"{}"," (anonymous access), keeps ",[15,780,135],{}," optional.",[11,783,784,785,787,788,790,791,793],{},"With ",[15,786,766],{},", the required type is read from the ",[15,789,135],{}," key of your module's ",[15,792,6],{},", so that type must have one.",[330,795,798],{"language":796,"code":797,"class":334},"ts","\u002F\u002F with pluginClient({ importPath: '..\u002Fclient', auth: { mode: 'required' } })\nawait addPet({ body, auth: () => getToken() })\nawait addPet({ body }) \u002F\u002F Type error: `auth` is missing",[15,799,801,368,806,368,838],{"class":800},"language-ts",[339,802,803],{"class":341,"style":342},[339,804,805],{"style":366},"\u002F\u002F with pluginClient({ importPath: '..\u002Fclient', auth: { mode: 'required' } })",[339,807,808,811,814,816,820,822,824,826,829,832,835],{"class":341,"style":342},[339,809,810],{"style":355},"await ",[339,812,813],{"style":345},"addPet",[339,815,350],{"style":349},[339,817,819],{"style":818},"color:#24292e;--hls-dark:#e1e4e8","body",[339,821,470],{"style":355},[339,823,135],{"style":349},[339,825,356],{"style":355},[339,827,828],{"style":349},"() ",[339,830,831],{"style":355},"=> ",[339,833,834],{"style":345},"getToken",[339,836,837],{"style":349},"() })",[339,839,840,842,844,846,849,851],{"class":341,"style":342},[339,841,810],{"style":355},[339,843,813],{"style":345},[339,845,350],{"style":349},[339,847,848],{"style":818},"body ",[339,850,363],{"style":349},[339,852,853],{"style":366},"\u002F\u002F Type error: `auth` is missing",{"title":855,"searchDepth":856,"depth":856,"links":857},"",5,[858,860],{"id":28,"depth":859,"text":29},2,{"id":290,"depth":859,"text":291,"children":861},[862,864,865,866,867],{"id":295,"depth":863,"text":62},3,{"id":404,"depth":863,"text":78},{"id":547,"depth":863,"text":96},{"id":117,"depth":863,"text":117},{"id":135,"depth":863,"text":135},"\u002Fextensions\u002Fkubb-labs\u002Fplugin-client\u002Foptions",1795727680097,"1b64b1eb-29b7-4f90-ad41-6f24721e1669"]