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