[{"data":1,"prerenderedAt":888},["ShallowReactive",2],{"page:\u002Fextensions\u002Fkubb-labs\u002Fplugin-zod\u002Fguides\u002Fformat-mappings":3},{"id":4,"frontmatter":5,"title":6,"heading":6,"body":7,"path":887,"source":4},"extensions\u002Fkubb-labs\u002Fplugin-zod\u002Fguides\u002Fformat-mappings.md",{},"Zod validators for OpenAPI formats",{"type":8,"value":9,"toc":877},"minimark",[10,27,49,54,208,223,227,576,588,592,671,677,681,761,765,771,870],[11,12,13,14,18,19,22,23,26],"p",{},"Look up the Zod v4 call Kubb writes for each OpenAPI type and format, such as ",[15,16,17],"code",{},"z.uuid()"," for ",[15,20,21],{},"format: uuid",", and the keywords that add a ",[15,24,25],{},"z.refine"," check.",[11,28,29,32,33,36,37,40,41,48],{},[15,30,31],{},"@kubb\u002Fplugin-zod"," reads the ",[15,34,35],{},"type"," and ",[15,38,39],{},"format"," of each schema and prints the matching Zod call. The Zod Mini column shows the output with ",[42,43,45],"a",{"href":44},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-zod\u002Foptions#mini",[15,46,47],{},"mini: true",".",[50,51,53],"h2",{"id":52},"integers","Integers",[55,56,57,77],"table",{},[58,59,60],"thead",{},[61,62,63,68,71,74],"tr",{},[64,65,67],"th",{"style":66},"text-align:left","OpenAPI type and format",[64,69,70],{"style":66},"Zod",[64,72,73],{"style":66},"Zod Mini",[64,75,76],{"style":66},"Notes",[78,79,80,106,128,149,170],"tbody",{},[61,81,82,88,93,97],{},[83,84,85],"td",{"style":66},[15,86,87],{},"integer",[83,89,90],{"style":66},[15,91,92],{},"z.int()",[83,94,95],{"style":66},[15,96,92],{},[83,98,99,100],{"style":66},"Coerced with ",[42,101,103],{"href":102},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-zod\u002Fguides\u002Fcoercion#coerce-numbers",[15,104,105],{},"coercion.numbers",[61,107,108,116,121,125],{},[83,109,110,112,113],{"style":66},[15,111,87],{},", ",[15,114,115],{},"format: int32",[83,117,118],{"style":66},[15,119,120],{},"z.int32()",[83,122,123],{"style":66},[15,124,120],{},[83,126,127],{"style":66},"32-bit signed integer",[61,129,130,137,142,146],{},[83,131,132,112,134],{"style":66},[15,133,87],{},[15,135,136],{},"format: uint32",[83,138,139],{"style":66},[15,140,141],{},"z.uint32()",[83,143,144],{"style":66},[15,145,141],{},[83,147,148],{"style":66},"32-bit unsigned integer",[61,150,151,158,163,167],{},[83,152,153,112,155],{"style":66},[15,154,87],{},[15,156,157],{},"format: int64",[83,159,160],{"style":66},[15,161,162],{},"z.coerce.bigint()",[83,164,165],{"style":66},[15,166,162],{},[83,168,169],{"style":66},"Always coerced, because JSON holds a number",[61,171,172,183,188,193],{},[83,173,174,112,177,179,180],{"style":66},[15,175,176],{},"string",[15,178,115],{}," \u002F ",[15,181,182],{},"int64",[83,184,185],{"style":66},[15,186,187],{},"z.string().regex(\u002F^-?\\d+$\u002F)",[83,189,190],{"style":66},[15,191,192],{},"z.string().check(z.regex(\u002F^-?\\d+$\u002F))",[83,194,195,196,199,200,203,204,207],{"style":66},"An integer sent as a JSON string. ",[15,197,198],{},"uint64"," uses ",[15,201,202],{},"\u002F^\\d+$\u002F",". A ",[15,205,206],{},"pattern"," in the spec wins.",[11,209,210,211,217,218,220,221,48],{},"With ",[42,212,214],{"href":213},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fadapter-oas\u002Foptions#integertype",[15,215,216],{},"integerType: 'number'"," on the adapter, ",[15,219,157],{}," prints ",[15,222,92],{},[50,224,226],{"id":225},"strings","Strings",[55,228,229,241],{},[58,230,231],{},[61,232,233,235,237,239],{},[64,234,67],{"style":66},[64,236,70],{"style":66},[64,238,73],{"style":66},[64,240,76],{"style":66},[78,242,243,274,295,319,340,369,390,411,441,465,486,507,528,549],{},[61,244,245,251,259,265],{},[83,246,247,112,249],{"style":66},[15,248,176],{},[15,250,21],{},[83,252,253,255,256],{"style":66},[15,254,17],{}," or ",[15,257,258],{},"z.guid()",[83,260,261,255,263],{"style":66},[15,262,17],{},[15,264,258],{},[83,266,267,268],{"style":66},"Set by ",[42,269,271],{"href":270},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-zod\u002Foptions#guidtype",[15,272,273],{},"guidType",[61,275,276,283,288,292],{},[83,277,278,112,280],{"style":66},[15,279,176],{},[15,281,282],{},"format: email",[83,284,285],{"style":66},[15,286,287],{},"z.email()",[83,289,290],{"style":66},[15,291,287],{},[83,293,294],{"style":66},"Email",[61,296,297,307,312,316],{},[83,298,299,112,301,179,304],{"style":66},[15,300,176],{},[15,302,303],{},"format: uri",[15,305,306],{},"url",[83,308,309],{"style":66},[15,310,311],{},"z.url()",[83,313,314],{"style":66},[15,315,311],{},[83,317,318],{"style":66},"URL",[61,320,321,328,333,337],{},[83,322,323,112,325],{"style":66},[15,324,176],{},[15,326,327],{},"format: hostname",[83,329,330],{"style":66},[15,331,332],{},"z.hostname()",[83,334,335],{"style":66},[15,336,332],{},[83,338,339],{"style":66},"Host name",[61,341,342,352,360,366],{},[83,343,344,112,346,179,349],{"style":66},[15,345,176],{},[15,347,348],{},"format: ipv4",[15,350,351],{},"ipv6",[83,353,354,179,357],{"style":66},[15,355,356],{},"z.ipv4()",[15,358,359],{},"z.ipv6()",[83,361,362,179,364],{"style":66},[15,363,356],{},[15,365,359],{},[83,367,368],{"style":66},"IP address",[61,370,371,378,383,387],{},[83,372,373,112,375],{"style":66},[15,374,176],{},[15,376,377],{},"format: base64",[83,379,380],{"style":66},[15,381,382],{},"z.base64()",[83,384,385],{"style":66},[15,386,382],{},[83,388,389],{"style":66},"Base64 string",[61,391,392,399,404,408],{},[83,393,394,112,396],{"style":66},[15,395,176],{},[15,397,398],{},"format: base64url",[83,400,401],{"style":66},[15,402,403],{},"z.base64url()",[83,405,406],{"style":66},[15,407,403],{},[83,409,410],{"style":66},"URL-safe base64 string",[61,412,413,423,429,435],{},[83,414,415,112,417,179,420],{"style":66},[15,416,176],{},[15,418,419],{},"contentEncoding: base64",[15,421,422],{},"base64url",[83,424,425,179,427],{"style":66},[15,426,382],{},[15,428,403],{},[83,430,431,179,433],{"style":66},[15,432,382],{},[15,434,403],{},[83,436,437,438],{"style":66},"Other encodings stay ",[15,439,440],{},"z.string()",[61,442,443,453,458,462],{},[83,444,445,112,447,179,450],{"style":66},[15,446,176],{},[15,448,449],{},"format: byte",[15,451,452],{},"binary",[83,454,455],{"style":66},[15,456,457],{},"z.instanceof(Blob)",[83,459,460],{"style":66},[15,461,457],{},[83,463,464],{"style":66},"Binary payload",[61,466,467,474,479,483],{},[83,468,469,112,471],{"style":66},[15,470,176],{},[15,472,473],{},"format: jwt",[83,475,476],{"style":66},[15,477,478],{},"z.jwt()",[83,480,481],{"style":66},[15,482,478],{},[83,484,485],{"style":66},"JSON Web Token",[61,487,488,495,500,504],{},[83,489,490,112,492],{"style":66},[15,491,176],{},[15,493,494],{},"format: ulid",[83,496,497],{"style":66},[15,498,499],{},"z.ulid()",[83,501,502],{"style":66},[15,503,499],{},[83,505,506],{"style":66},"ULID",[61,508,509,516,521,525],{},[83,510,511,112,513],{"style":66},[15,512,176],{},[15,514,515],{},"format: iban",[83,517,518],{"style":66},[15,519,520],{},"z.iban()",[83,522,523],{"style":66},[15,524,520],{},[83,526,527],{"style":66},"International Bank Account Number",[61,529,530,537,542,546],{},[83,531,532,112,534],{"style":66},[15,533,176],{},[15,535,536],{},"format: duration",[83,538,539],{"style":66},[15,540,541],{},"z.iso.duration()",[83,543,544],{"style":66},[15,545,541],{},[83,547,548],{"style":66},"ISO 8601 duration",[61,550,551,563,568,573],{},[83,552,553,555,556,559,560],{"style":66},[15,554,176],{},", JSON ",[15,557,558],{},"contentMediaType"," with ",[15,561,562],{},"contentSchema",[83,564,565],{"style":66},[15,566,567],{},"z.string().refine(...)",[83,569,570],{"style":66},[15,571,572],{},"z.string().check(z.refine(...))",[83,574,575],{"style":66},"Must parse as JSON that passes the content schema. It stays a string.",[11,577,578,584,585,48],{},[42,579,581],{"href":580},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-zod\u002Fguides\u002Fcoercion#coerce-strings",[15,582,583],{},"coercion.strings"," replaces some of these validators with ",[15,586,587],{},"z.coerce.string()",[50,589,591],{"id":590},"dates-and-times","Dates and times",[55,593,594,606],{},[58,595,596],{},[61,597,598,600,602,604],{},[64,599,67],{"style":66},[64,601,70],{"style":66},[64,603,73],{"style":66},[64,605,76],{"style":66},[78,607,608,629,650],{},[61,609,610,617,622,626],{},[83,611,612,112,614],{"style":66},[15,613,176],{},[15,615,616],{},"format: date",[83,618,619],{"style":66},[15,620,621],{},"z.iso.date()",[83,623,624],{"style":66},[15,625,621],{},[83,627,628],{"style":66},"ISO 8601 date",[61,630,631,638,643,647],{},[83,632,633,112,635],{"style":66},[15,634,176],{},[15,636,637],{},"format: date-time",[83,639,640],{"style":66},[15,641,642],{},"z.iso.datetime()",[83,644,645],{"style":66},[15,646,440],{},[83,648,649],{"style":66},"ISO 8601 date-time",[61,651,652,659,664,668],{},[83,653,654,112,656],{"style":66},[15,655,176],{},[15,657,658],{},"format: time",[83,660,661],{"style":66},[15,662,663],{},"z.iso.time()",[83,665,666],{"style":66},[15,667,663],{},[83,669,670],{"style":66},"ISO 8601 time",[11,672,673,674,48],{},"These rows apply to the adapter's default ",[15,675,676],{},"dateType: 'string'",[50,678,680],{"id":679},"objects","Objects",[55,682,683,695],{},[58,684,685],{},[61,686,687,689,691,693],{},[64,688,67],{"style":66},[64,690,70],{"style":66},[64,692,73],{"style":66},[64,694,76],{"style":66},[78,696,697,719,740],{},[61,698,699,707,712,716],{},[83,700,701,112,704],{"style":66},[15,702,703],{},"object",[15,705,706],{},"additionalProperties: \u003Cschema>",[83,708,709],{"style":66},[15,710,711],{},"z.record(z.string(), schema)",[83,713,714],{"style":66},[15,715,711],{},[83,717,718],{"style":66},"Dictionary with no fixed properties",[61,720,721,728,733,737],{},[83,722,723,112,725],{"style":66},[15,724,703],{},[15,726,727],{},"additionalProperties: true",[83,729,730],{"style":66},[15,731,732],{},"z.looseObject(shape)",[83,734,735],{"style":66},[15,736,732],{},[83,738,739],{"style":66},"Allows extra keys",[61,741,742,749,754,758],{},[83,743,744,112,746],{"style":66},[15,745,703],{},[15,747,748],{},"additionalProperties: false",[83,750,751],{"style":66},[15,752,753],{},"z.strictObject(shape)",[83,755,756],{"style":66},[15,757,753],{},[83,759,760],{"style":66},"Rejects extra keys",[50,762,764],{"id":763},"json-schema-keywords","JSON Schema keywords",[11,766,767,768,770],{},"These keywords print a ",[15,769,25],{}," check in both APIs:",[55,772,773,783],{},[58,774,775],{},[61,776,777,780],{},[64,778,779],{},"Keyword",[64,781,782],{},"Check",[78,784,785,811,827,844,860],{},[61,786,787,805],{},[83,788,789,792,793,792,796,112,799,112,802],{},[15,790,791],{},"if","\u002F",[15,794,795],{},"then",[15,797,798],{},"else",[15,800,801],{},"dependentRequired",[15,803,804],{},"dependentSchemas",[83,806,807,808,48],{},"Checks the input before parsing, in ",[15,809,810],{},"z.pipe(z.unknown().check(...), schema)",[61,812,813,821],{},[83,814,815,112,818],{},[15,816,817],{},"minProperties",[15,819,820],{},"maxProperties",[83,822,823,824,48],{},"Counts the keys of the input before parsing, in the same ",[15,825,826],{},"z.pipe(...)",[61,828,829,838],{},[83,830,831,834,835],{},[15,832,833],{},"propertyNames"," on an object that also declares ",[15,836,837],{},"properties",[83,839,840,841,48],{},"Checks every key of the input. A dictionary keeps ",[15,842,843],{},"z.record(keySchema, schema)",[61,845,846,857],{},[83,847,848,559,851,36,854],{},[15,849,850],{},"contains",[15,852,853],{},"minContains",[15,855,856],{},"maxContains",[83,858,859],{},"Counts the matching items of an array.",[61,861,862,867],{},[83,863,864],{},[15,865,866],{},"uniqueItems",[83,868,869],{},"Rejects an array with duplicate entries.",[11,871,872,873,48],{},"To change the call for one type, replace its printer handler. See ",[42,874,876],{"href":875},"https:\u002F\u002Fkubb.dev\u002Fextensions\u002Fkubb-labs\u002Fplugin-zod\u002Fguides\u002Fcustomization","Customize generated schemas",{"title":878,"searchDepth":879,"depth":879,"links":880},"",5,[881,883,884,885,886],{"id":52,"depth":882,"text":53},2,{"id":225,"depth":882,"text":226},{"id":590,"depth":882,"text":591},{"id":679,"depth":882,"text":680},{"id":763,"depth":882,"text":764},"\u002Fextensions\u002Fkubb-labs\u002Fplugin-zod\u002Fguides\u002Fformat-mappings",1794776439690]