[{"data":1,"prerenderedAt":1295},["ShallowReactive",2],{"libs":3,"navigation-openapi-writer":115,"\u002Fopenapi-writer\u002Fversions-and-output\u002Fwriting-a-document":256,"\u002Fopenapi-writer\u002Fversions-and-output\u002Fwriting-a-document-surround":1290},[4,45,69,95],{"id":5,"color":6,"compatibility":7,"extension":20,"icon":21,"links":22,"meta":27,"name":28,"order":29,"package":30,"related":31,"stem":34,"tagline":35,"__hash__":36,"slug":37,"repository":38,"branch":39,"path":40,"collection":41,"entry":42,"home":43,"version":44},"laravel_json_api_meta\u002Fdocs\u002Fsite\u002Flib.yml","violet",[8,13,16],{"version":9,"php":10,"laravel":11,"status":12},"3.x","^8.3","^12.46 || ^13.0","active",{"version":14,"php":10,"laravel":11,"status":15},"2.x","eol",{"version":17,"php":18,"laravel":19,"status":15},"1.x","^8.1","^10.0 || ^11.0 || ^12.0 || ^13.0","yml","i-lucide-braces",[23],{"label":24,"to":25,"icon":26},"JSON:API 1.1","https:\u002F\u002Fjsonapi.org\u002Fformat\u002F","i-lucide-book-marked",{},"Laravel JSON:API",10,"ark4ne\u002Flaravel-json-api",[32,33],"laravel-api-revisions","laravel-openapi-generator","docs\u002Fsite\u002Flib","JSON:API 1.1 resources for Laravel, with typed values, validated includes and fieldsets, and API revisions.","ILGoVp9rzKYDQc18VV8kkXy3EQOQ8rv87JblFKXYDrU","laravel-json-api","Ark4ne\u002Flaravel-json-api","master","docs\u002Fsite","laravel_json_api","\u002Flaravel-json-api\u002Fgetting-started\u002Fintroduction","\u002Flaravel-json-api","v3.0.0",{"id":46,"color":47,"compatibility":48,"extension":20,"icon":50,"links":51,"meta":56,"name":57,"order":58,"package":59,"related":60,"stem":34,"tagline":61,"__hash__":62,"slug":32,"repository":63,"branch":64,"path":40,"collection":65,"entry":66,"home":67,"version":68},"laravel_api_revisions_meta\u002Fdocs\u002Fsite\u002Flib.yml","amber",[49],{"version":17,"php":10,"laravel":11,"status":12},"i-lucide-git-branch",[52],{"label":53,"to":54,"icon":55},"Agent skill","https:\u002F\u002Fgithub.com\u002FArk4ne\u002Flaravel-api-revisions\u002Ftree\u002Fmain\u002Fskills\u002Flaravel-api-revisions","i-lucide-bot",{},"Laravel API Revisions",20,"ark4ne\u002Flaravel-api-revisions",[37,33],"Typed schemas for Laravel resources and form requests, evolved through dated API revisions, Stripe-style.","w24MBVK4_XliIZ8nVcfnuT9OgR-m-Ytxz31Pxua_mLM","Ark4ne\u002Flaravel-api-revisions","main","laravel_api_revisions","\u002Flaravel-api-revisions\u002Fgetting-started\u002Fintroduction","\u002Flaravel-api-revisions","v1.0.0",{"id":70,"color":71,"compatibility":72,"extension":20,"icon":77,"links":78,"meta":82,"name":83,"order":84,"package":85,"related":86,"stem":34,"tagline":88,"__hash__":89,"slug":33,"repository":90,"branch":39,"path":40,"collection":91,"entry":92,"home":93,"version":94},"laravel_openapi_generator_meta\u002Fdocs\u002Fsite\u002Flib.yml","emerald",[73,75],{"version":17,"php":10,"laravel":74,"status":12},"^13.0",{"version":76,"php":18,"laravel":19,"status":15},"0.6","i-lucide-file-json",[79],{"label":80,"to":81,"icon":26},"OpenAPI Specification","https:\u002F\u002Fspec.openapis.org\u002Foas\u002Flatest.html",{},"Laravel OpenAPI Generator",30,"ark4ne\u002Flaravel-openapi-generator",[87,37,32],"openapi-writer","Generates OpenAPI 3.0, 3.1 and 3.2 documents from a Laravel application, its routes, form requests and resources.","DTt0SVqegMImLmWmwL8LCW5lxRCWFYcnBFOaquLpVwc","Ark4ne\u002Flaravel-openapi-generator","laravel_openapi_generator","\u002Flaravel-openapi-generator\u002Fgetting-started\u002Fintroduction","\u002Flaravel-openapi-generator","v1.2.0",{"id":96,"color":97,"compatibility":98,"extension":20,"icon":101,"links":102,"meta":104,"name":105,"order":106,"package":107,"related":108,"stem":34,"tagline":109,"__hash__":110,"slug":87,"repository":111,"branch":64,"path":40,"collection":112,"entry":113,"home":114,"version":68},"openapi_writer_meta\u002Fdocs\u002Fsite\u002Flib.yml","sky",[99],{"version":17,"php":100,"status":12},"^8.2","i-lucide-file-pen-line",[103],{"label":80,"to":81,"icon":26},{},"OpenAPI Writer",40,"ark4ne\u002Fopenapi-writer",[33],"Framework-agnostic, fluent and immutable PHP builder for OpenAPI 3.0, 3.1 and 3.2 documents, written as JSON or YAML and validated.","JFQcdQ9GEChOkfRKibLjoxZOfnt6HYNsayX2melOzMk","Ark4ne\u002Fopenapi-writer","openapi_writer","\u002Fopenapi-writer\u002Fgetting-started\u002Fintroduction","\u002Fopenapi-writer",[116,135,169,182,212,226,248],{"title":117,"since":118,"experimental":119,"icon":120,"path":121,"stem":122,"children":123,"page":119},"Getting started",null,false,"i-lucide-rocket","\u002Fopenapi-writer\u002Fgetting-started","openapi-writer\u002F1.getting-started",[124,127,131],{"title":125,"path":113,"stem":126,"since":118,"experimental":119},"Introduction","openapi-writer\u002F1.getting-started\u002F1.introduction",{"title":128,"path":129,"stem":130,"since":118,"experimental":119},"Installation","\u002Fopenapi-writer\u002Fgetting-started\u002Finstallation","openapi-writer\u002F1.getting-started\u002F2.installation",{"title":132,"path":133,"stem":134,"since":118,"experimental":119},"Quick start","\u002Fopenapi-writer\u002Fgetting-started\u002Fquick-start","openapi-writer\u002F1.getting-started\u002F3.quick-start",{"title":136,"since":118,"experimental":119,"icon":137,"path":138,"stem":139,"children":140,"page":119},"Building documents","i-lucide-blocks","\u002Fopenapi-writer\u002Fbuilding-documents","openapi-writer\u002F2.building-documents",[141,145,149,153,157,161,165],{"title":142,"path":143,"stem":144,"since":118,"experimental":119},"The object model","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fthe-object-model","openapi-writer\u002F2.building-documents\u002F1.the-object-model",{"title":146,"path":147,"stem":148,"since":118,"experimental":119},"Document","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fdocument","openapi-writer\u002F2.building-documents\u002F2.document",{"title":150,"path":151,"stem":152,"since":118,"experimental":119},"Paths and operations","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fpaths-and-operations","openapi-writer\u002F2.building-documents\u002F3.paths-and-operations",{"title":154,"path":155,"stem":156,"since":118,"experimental":119},"Requests and responses","\u002Fopenapi-writer\u002Fbuilding-documents\u002Frequests-and-responses","openapi-writer\u002F2.building-documents\u002F4.requests-and-responses",{"title":158,"path":159,"stem":160,"since":118,"experimental":119},"Components and references","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fcomponents-and-references","openapi-writer\u002F2.building-documents\u002F5.components-and-references",{"title":162,"path":163,"stem":164,"since":118,"experimental":119},"Security","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fsecurity","openapi-writer\u002F2.building-documents\u002F6.security",{"title":166,"path":167,"stem":168,"since":118,"experimental":119},"Webhooks and callbacks","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fwebhooks-and-callbacks","openapi-writer\u002F2.building-documents\u002F7.webhooks-and-callbacks",{"title":170,"since":118,"experimental":119,"icon":21,"path":171,"stem":172,"children":173,"page":119},"Schemas","\u002Fopenapi-writer\u002Fschemas","openapi-writer\u002F3.schemas",[174,178],{"title":175,"path":176,"stem":177,"since":118,"experimental":119},"Types and constraints","\u002Fopenapi-writer\u002Fschemas\u002Ftypes-and-constraints","openapi-writer\u002F3.schemas\u002F1.types-and-constraints",{"title":179,"path":180,"stem":181,"since":118,"experimental":119},"Composition and polymorphism","\u002Fopenapi-writer\u002Fschemas\u002Fcomposition-and-polymorphism","openapi-writer\u002F3.schemas\u002F2.composition-and-polymorphism",{"title":183,"since":118,"experimental":119,"icon":184,"path":185,"stem":186,"children":187,"page":119},"Versions and output","i-lucide-layers","\u002Fopenapi-writer\u002Fversions-and-output","openapi-writer\u002F4.versions-and-output",[188,192,196,200,204,208],{"title":189,"path":190,"stem":191,"since":118,"experimental":119},"Writing a document","\u002Fopenapi-writer\u002Fversions-and-output\u002Fwriting-a-document","openapi-writer\u002F4.versions-and-output\u002F1.writing-a-document",{"title":193,"path":194,"stem":195,"since":118,"experimental":119},"Choosing a version","\u002Fopenapi-writer\u002Fversions-and-output\u002Fchoosing-a-version","openapi-writer\u002F4.versions-and-output\u002F2.choosing-a-version",{"title":197,"path":198,"stem":199,"since":118,"experimental":119},"Conversions","\u002Fopenapi-writer\u002Fversions-and-output\u002Fconversions","openapi-writer\u002F4.versions-and-output\u002F3.conversions",{"title":201,"path":202,"stem":203,"since":118,"experimental":119},"Strict and lenient","\u002Fopenapi-writer\u002Fversions-and-output\u002Fstrict-and-lenient","openapi-writer\u002F4.versions-and-output\u002F4.strict-and-lenient",{"title":205,"path":206,"stem":207,"since":118,"experimental":119},"OpenAPI 3.2","\u002Fopenapi-writer\u002Fversions-and-output\u002Fopenapi-3-2","openapi-writer\u002F4.versions-and-output\u002F5.openapi-3-2",{"title":209,"path":210,"stem":211,"since":118,"experimental":119},"Redoc extensions","\u002Fopenapi-writer\u002Fversions-and-output\u002Fredoc-extensions","openapi-writer\u002F4.versions-and-output\u002F6.redoc-extensions",{"title":213,"since":118,"experimental":119,"icon":214,"path":215,"stem":216,"children":217,"page":119},"Validation","i-lucide-badge-check","\u002Fopenapi-writer\u002Fvalidation","openapi-writer\u002F5.validation",[218,222],{"title":219,"path":220,"stem":221,"since":118,"experimental":119},"Validating a document","\u002Fopenapi-writer\u002Fvalidation\u002Fvalidating-a-document","openapi-writer\u002F5.validation\u002F1.validating-a-document",{"title":223,"path":224,"stem":225,"since":118,"experimental":119},"Custom rules","\u002Fopenapi-writer\u002Fvalidation\u002Fcustom-rules","openapi-writer\u002F5.validation\u002F2.custom-rules",{"title":227,"since":118,"experimental":119,"icon":228,"path":229,"stem":230,"children":231,"page":119},"Reference","i-lucide-library","\u002Fopenapi-writer\u002Freference","openapi-writer\u002F6.reference",[232,236,240,244],{"title":233,"path":234,"stem":235,"since":118,"experimental":119},"Objects","\u002Fopenapi-writer\u002Freference\u002Fobjects","openapi-writer\u002F6.reference\u002F1.objects",{"title":237,"path":238,"stem":239,"since":118,"experimental":119},"Enums","\u002Fopenapi-writer\u002Freference\u002Fenums","openapi-writer\u002F6.reference\u002F2.enums",{"title":241,"path":242,"stem":243,"since":118,"experimental":119},"Validation rules","\u002Fopenapi-writer\u002Freference\u002Fvalidation-rules","openapi-writer\u002F6.reference\u002F3.validation-rules",{"title":245,"path":246,"stem":247,"since":118,"experimental":119},"Exceptions","\u002Fopenapi-writer\u002Freference\u002Fexceptions","openapi-writer\u002F6.reference\u002F4.exceptions",{"title":249,"path":250,"children":251},"Releases","\u002Fopenapi-writer\u002Freleases",[252],{"title":253,"path":254,"stem":255,"since":118,"experimental":119},"Changelog","\u002Fopenapi-writer\u002Fchangelog","openapi-writer\u002FCHANGELOG",{"id":257,"title":189,"body":258,"description":1284,"experimental":119,"extension":1285,"links":118,"meta":1286,"navigation":326,"path":190,"rawbody":1287,"seo":1288,"since":118,"stem":191,"__hash__":1289},"openapi_writer\u002Fopenapi-writer\u002F4.versions-and-output\u002F1.writing-a-document.md",{"type":259,"value":260,"toc":1277},"minimark",[261,274,279,439,503,525,687,691,694,804,817,821,1037,1040,1044,1068,1072,1086,1273],[262,263,264,265,269,270,273],"p",{},"Every object, from the whole ",[266,267,268],"code",{},"OpenApi"," document to a single ",[266,271,272],{},"Schema",", has three methods that write it for a version.",[275,276,278],"h2",{"id":277},"json-yaml-or-array","JSON, YAML or array",[280,281,286],"pre",{"className":282,"code":283,"language":284,"meta":285,"style":285},"language-php shiki shiki-themes material-theme-lighter github-light github-dark","use Ark4ne\\OpenApiWriter\\Enums\\Version;\n\n$json = $document->toJson(Version::V3_1_2, JSON_PRETTY_PRINT);\n$yaml = $document->toYaml(Version::V3_1_2);     \u002F\u002F needs symfony\u002Fyaml\n$array = $document->toArray(Version::V3_1_2);\n","php","",[266,287,288,321,328,376,410],{"__ignoreMap":285},[289,290,293,297,301,305,308,310,312,314,317],"span",{"class":291,"line":292},"line",1,[289,294,296],{"class":295},"sw1J6","use",[289,298,300],{"class":299},"s_hVV"," Ark4ne",[289,302,304],{"class":303},"s39Yj","\\",[289,306,307],{"class":299},"OpenApiWriter",[289,309,304],{"class":303},[289,311,237],{"class":299},[289,313,304],{"class":303},[289,315,316],{"class":299},"Version",[289,318,320],{"class":319},"sP7_E",";\n",[289,322,324],{"class":291,"line":323},2,[289,325,327],{"emptyLinePlaceholder":326},true,"\n",[289,329,331,334,338,342,345,348,351,355,358,361,364,367,370,373],{"class":291,"line":330},3,[289,332,333],{"class":319},"$",[289,335,337],{"class":336},"su5hD","json ",[289,339,341],{"class":340},"smGrS","=",[289,343,344],{"class":319}," $",[289,346,347],{"class":336},"document",[289,349,350],{"class":340},"->",[289,352,354],{"class":353},"sGLFI","toJson",[289,356,357],{"class":319},"(",[289,359,316],{"class":360},"sZMiF",[289,362,363],{"class":340},"::",[289,365,366],{"class":299},"V3_1_2",[289,368,369],{"class":319},",",[289,371,372],{"class":299}," JSON_PRETTY_PRINT",[289,374,375],{"class":319},");\n",[289,377,379,381,384,386,388,390,392,395,397,399,401,403,406],{"class":291,"line":378},4,[289,380,333],{"class":319},[289,382,383],{"class":336},"yaml ",[289,385,341],{"class":340},[289,387,344],{"class":319},[289,389,347],{"class":336},[289,391,350],{"class":340},[289,393,394],{"class":353},"toYaml",[289,396,357],{"class":319},[289,398,316],{"class":360},[289,400,363],{"class":340},[289,402,366],{"class":299},[289,404,405],{"class":319},");",[289,407,409],{"class":408},"sutJx","     \u002F\u002F needs symfony\u002Fyaml\n",[289,411,413,415,418,420,422,424,426,429,431,433,435,437],{"class":291,"line":412},5,[289,414,333],{"class":319},[289,416,417],{"class":336},"array ",[289,419,341],{"class":340},[289,421,344],{"class":319},[289,423,347],{"class":336},[289,425,350],{"class":340},[289,427,428],{"class":353},"toArray",[289,430,357],{"class":319},[289,432,316],{"class":360},[289,434,363],{"class":340},[289,436,366],{"class":299},[289,438,375],{"class":319},[440,441,442,455],"table",{},[443,444,445],"thead",{},[446,447,448,452],"tr",{},[449,450,451],"th",{},"Method",[449,453,454],{},"Returns",[456,457,458,472,485],"tbody",{},[446,459,460,466],{},[461,462,463],"td",{},[266,464,465],{},"toJson($version = null, int $flags = 0, $extensions = None)",[461,467,468,469],{},"A JSON string; the flags are those of ",[266,470,471],{},"json_encode()",[446,473,474,479],{},[461,475,476],{},[266,477,478],{},"toYaml($version = null, $extensions = None)",[461,480,481,482],{},"A YAML string; needs ",[266,483,484],{},"symfony\u002Fyaml",[446,486,487,492],{},[461,488,489],{},[266,490,491],{},"toArray($version = null, $extensions = None)",[461,493,494,495,498,499,502],{},"A PHP array; empty objects are ",[266,496,497],{},"\\stdClass",", so they stay ",[266,500,501],{},"{}"," in JSON",[262,504,505,506,508,509,512,513,516,517,520,521,524],{},"The version is a ",[266,507,316],{}," case or its string: ",[266,510,511],{},"toJson('3.0.4')",". Without one, the version given to\n",[266,514,515],{},"OpenApi::openapi()"," is used, else 3.1.2. ",[266,518,519],{},"$extensions"," turns on the\n",[522,523,209],"a",{"href":210},".",[526,527,530,558],"example",{"input":528,"output":529},"toYaml()","openapi.yaml",[531,532,533],"template",{"v-slot:input":285},[280,534,536],{"className":282,"code":535,"language":284,"meta":285,"style":285},"$document->toYaml(Version::V3_1_2);\n",[266,537,538],{"__ignoreMap":285},[289,539,540,542,544,546,548,550,552,554,556],{"class":291,"line":292},[289,541,333],{"class":319},[289,543,347],{"class":336},[289,545,350],{"class":340},[289,547,394],{"class":353},[289,549,357],{"class":319},[289,551,316],{"class":360},[289,553,363],{"class":340},[289,555,366],{"class":299},[289,557,375],{"class":319},[531,559,560],{"v-slot:output":285},[280,561,565],{"className":562,"code":563,"language":564,"meta":285,"style":285},"language-yaml shiki shiki-themes material-theme-lighter github-light github-dark","openapi: 3.1.2\ninfo:\n  title: 'Books API'\n  version: 1.0.0\npaths:\n  '\u002Fbooks\u002F{id}':\n    get:\n      operationId: books.show\n      responses:\n        '200':\n          description: OK\n","yaml",[266,566,567,580,588,606,616,623,637,645,656,664,676],{"__ignoreMap":285},[289,568,569,573,576],{"class":291,"line":292},[289,570,572],{"class":571},"sQzsp","openapi",[289,574,575],{"class":319},":",[289,577,579],{"class":578},"srdBf"," 3.1.2\n",[289,581,582,585],{"class":291,"line":323},[289,583,584],{"class":571},"info",[289,586,587],{"class":319},":\n",[289,589,590,593,595,599,603],{"class":291,"line":330},[289,591,592],{"class":571},"  title",[289,594,575],{"class":319},[289,596,598],{"class":597},"sjJ54"," '",[289,600,602],{"class":601},"s_sjI","Books API",[289,604,605],{"class":597},"'\n",[289,607,608,611,613],{"class":291,"line":378},[289,609,610],{"class":571},"  version",[289,612,575],{"class":319},[289,614,615],{"class":578}," 1.0.0\n",[289,617,618,621],{"class":291,"line":412},[289,619,620],{"class":571},"paths",[289,622,587],{"class":319},[289,624,626,629,632,635],{"class":291,"line":625},6,[289,627,628],{"class":597},"  '",[289,630,631],{"class":601},"\u002Fbooks\u002F{id}",[289,633,634],{"class":597},"'",[289,636,587],{"class":319},[289,638,640,643],{"class":291,"line":639},7,[289,641,642],{"class":571},"    get",[289,644,587],{"class":319},[289,646,648,651,653],{"class":291,"line":647},8,[289,649,650],{"class":571},"      operationId",[289,652,575],{"class":319},[289,654,655],{"class":601}," books.show\n",[289,657,659,662],{"class":291,"line":658},9,[289,660,661],{"class":571},"      responses",[289,663,587],{"class":319},[289,665,666,669,672,674],{"class":291,"line":29},[289,667,668],{"class":597},"        '",[289,670,671],{"class":601},"200",[289,673,634],{"class":597},[289,675,587],{"class":319},[289,677,679,682,684],{"class":291,"line":678},11,[289,680,681],{"class":571},"          description",[289,683,575],{"class":319},[289,685,686],{"class":601}," OK\n",[275,688,690],{"id":689},"writing-any-object","Writing any object",[262,692,693],{},"Writing is not limited to the document: a schema, a response or a parameter can be written alone, which helps to\ninspect a piece or to test it.",[280,695,697],{"className":282,"code":696,"language":284,"meta":285,"style":285},"use Ark4ne\\OpenApiWriter\\Objects\\Schema;\n\n$subtitle = Schema::string()->nullable();\n\n$subtitle->toJson('3.1.2');  \u002F\u002F {\"type\":[\"string\",\"null\"]}\n$subtitle->toJson('3.0.4');  \u002F\u002F {\"type\":\"string\",\"nullable\":true}\n",[266,698,699,719,723,751,755,780],{"__ignoreMap":285},[289,700,701,703,705,707,709,711,713,715,717],{"class":291,"line":292},[289,702,296],{"class":295},[289,704,300],{"class":299},[289,706,304],{"class":303},[289,708,307],{"class":299},[289,710,304],{"class":303},[289,712,233],{"class":299},[289,714,304],{"class":303},[289,716,272],{"class":299},[289,718,320],{"class":319},[289,720,721],{"class":291,"line":323},[289,722,327],{"emptyLinePlaceholder":326},[289,724,725,727,730,732,735,737,740,743,745,748],{"class":291,"line":330},[289,726,333],{"class":319},[289,728,729],{"class":336},"subtitle ",[289,731,341],{"class":340},[289,733,734],{"class":360}," Schema",[289,736,363],{"class":340},[289,738,739],{"class":353},"string",[289,741,742],{"class":319},"()",[289,744,350],{"class":340},[289,746,747],{"class":353},"nullable",[289,749,750],{"class":319},"();\n",[289,752,753],{"class":291,"line":378},[289,754,327],{"emptyLinePlaceholder":326},[289,756,757,759,762,764,766,768,770,773,775,777],{"class":291,"line":412},[289,758,333],{"class":319},[289,760,761],{"class":336},"subtitle",[289,763,350],{"class":340},[289,765,354],{"class":353},[289,767,357],{"class":319},[289,769,634],{"class":597},[289,771,772],{"class":601},"3.1.2",[289,774,634],{"class":597},[289,776,405],{"class":319},[289,778,779],{"class":408},"  \u002F\u002F {\"type\":[\"string\",\"null\"]}\n",[289,781,782,784,786,788,790,792,794,797,799,801],{"class":291,"line":625},[289,783,333],{"class":319},[289,785,761],{"class":336},[289,787,350],{"class":340},[289,789,354],{"class":353},[289,791,357],{"class":319},[289,793,634],{"class":597},[289,795,796],{"class":601},"3.0.4",[289,798,634],{"class":597},[289,800,405],{"class":319},[289,802,803],{"class":408},"  \u002F\u002F {\"type\":\"string\",\"nullable\":true}\n",[262,805,806,808,809,812,813,816],{},[266,807,268],{}," also implements ",[266,810,811],{},"JsonSerializable",": ",[266,814,815],{},"json_encode($document)"," writes it for its declared version.",[275,818,820],{"id":819},"saving-files","Saving files",[280,822,824],{"className":282,"code":823,"language":284,"meta":285,"style":285},"$directory = __DIR__ . '\u002Fpublic';\n\nfile_put_contents(\n    $directory . '\u002Fopenapi.json',\n    $document->toJson(Version::V3_1_2, JSON_PRETTY_PRINT) . \"\\n\",\n);\nfile_put_contents(\n    $directory . '\u002Fopenapi.yaml',\n    $document->toYaml(Version::V3_1_2),\n);\nfile_put_contents(\n    $directory . '\u002Fopenapi-3.0.json',\n    $document->toJson(Version::V3_0_4, JSON_PRETTY_PRINT) . \"\\n\",\n);\n",[266,825,826,850,854,863,882,920,924,930,947,968,972,978,996,1032],{"__ignoreMap":285},[289,827,828,830,833,835,838,841,843,846,848],{"class":291,"line":292},[289,829,333],{"class":319},[289,831,832],{"class":336},"directory ",[289,834,341],{"class":340},[289,836,837],{"class":303}," __DIR__",[289,839,840],{"class":340}," .",[289,842,598],{"class":597},[289,844,845],{"class":601},"\u002Fpublic",[289,847,634],{"class":597},[289,849,320],{"class":319},[289,851,852],{"class":291,"line":323},[289,853,327],{"emptyLinePlaceholder":326},[289,855,856,860],{"class":291,"line":330},[289,857,859],{"class":858},"sptTA","file_put_contents",[289,861,862],{"class":319},"(\n",[289,864,865,868,870,872,874,877,879],{"class":291,"line":378},[289,866,867],{"class":319},"    $",[289,869,832],{"class":336},[289,871,524],{"class":340},[289,873,598],{"class":597},[289,875,876],{"class":601},"\u002Fopenapi.json",[289,878,634],{"class":597},[289,880,881],{"class":319},",\n",[289,883,884,886,888,890,892,894,896,898,900,902,904,907,909,912,915,918],{"class":291,"line":412},[289,885,867],{"class":319},[289,887,347],{"class":336},[289,889,350],{"class":340},[289,891,354],{"class":353},[289,893,357],{"class":319},[289,895,316],{"class":360},[289,897,363],{"class":340},[289,899,366],{"class":299},[289,901,369],{"class":319},[289,903,372],{"class":299},[289,905,906],{"class":319},")",[289,908,840],{"class":340},[289,910,911],{"class":597}," \"",[289,913,914],{"class":299},"\\n",[289,916,917],{"class":597},"\"",[289,919,881],{"class":319},[289,921,922],{"class":291,"line":625},[289,923,375],{"class":319},[289,925,926,928],{"class":291,"line":639},[289,927,859],{"class":858},[289,929,862],{"class":319},[289,931,932,934,936,938,940,943,945],{"class":291,"line":647},[289,933,867],{"class":319},[289,935,832],{"class":336},[289,937,524],{"class":340},[289,939,598],{"class":597},[289,941,942],{"class":601},"\u002Fopenapi.yaml",[289,944,634],{"class":597},[289,946,881],{"class":319},[289,948,949,951,953,955,957,959,961,963,965],{"class":291,"line":658},[289,950,867],{"class":319},[289,952,347],{"class":336},[289,954,350],{"class":340},[289,956,394],{"class":353},[289,958,357],{"class":319},[289,960,316],{"class":360},[289,962,363],{"class":340},[289,964,366],{"class":299},[289,966,967],{"class":319},"),\n",[289,969,970],{"class":291,"line":29},[289,971,375],{"class":319},[289,973,974,976],{"class":291,"line":678},[289,975,859],{"class":858},[289,977,862],{"class":319},[289,979,981,983,985,987,989,992,994],{"class":291,"line":980},12,[289,982,867],{"class":319},[289,984,832],{"class":336},[289,986,524],{"class":340},[289,988,598],{"class":597},[289,990,991],{"class":601},"\u002Fopenapi-3.0.json",[289,993,634],{"class":597},[289,995,881],{"class":319},[289,997,999,1001,1003,1005,1007,1009,1011,1013,1016,1018,1020,1022,1024,1026,1028,1030],{"class":291,"line":998},13,[289,1000,867],{"class":319},[289,1002,347],{"class":336},[289,1004,350],{"class":340},[289,1006,354],{"class":353},[289,1008,357],{"class":319},[289,1010,316],{"class":360},[289,1012,363],{"class":340},[289,1014,1015],{"class":299},"V3_0_4",[289,1017,369],{"class":319},[289,1019,372],{"class":299},[289,1021,906],{"class":319},[289,1023,840],{"class":340},[289,1025,911],{"class":597},[289,1027,914],{"class":299},[289,1029,917],{"class":597},[289,1031,881],{"class":319},[289,1033,1035],{"class":291,"line":1034},14,[289,1036,375],{"class":319},[262,1038,1039],{},"The library writes strings; where they go (a file, an HTTP response, a build artifact) is up to you. Point Swagger UI,\nRedoc, Scalar or any other viewer to the result.",[275,1041,1043],{"id":1042},"key-order","Key order",[262,1045,1046,1047,1049,1050,1049,1052,881,1055,1057,1058,1049,1061,1049,1064,1067],{},"The keys are written in the order of the specification, whatever the order of the calls: ",[266,1048,572],{},", ",[266,1051,584],{},[266,1053,1054],{},"servers",[266,1056,620],{},"… at the root; ",[266,1059,1060],{},"type",[266,1062,1063],{},"required",[266,1065,1066],{},"properties","… in a schema. Two builds of the same document give the same\noutput, which keeps the diffs of a committed file small.",[275,1069,1071],{"id":1070},"the-serializer","The serializer",[262,1073,1074,1077,1078,1081,1082,575],{},[266,1075,1076],{},"toJson()"," and its siblings are shortcuts for the ",[266,1079,1080],{},"Serializer",", which also returns the\n",[522,1083,1085],{"href":1084},"\u002Fopenapi-writer\u002Fversions-and-output\u002Fstrict-and-lenient#diagnostics","diagnostics",[280,1087,1089],{"className":282,"code":1088,"language":284,"meta":285,"style":285},"use Ark4ne\\OpenApiWriter\\Enums\\Strictness;\nuse Ark4ne\\OpenApiWriter\\Serialization\\Serializer;\n\n$result = Serializer::for(Version::V3_0_4, Strictness::Lenient)\n    ->serialize($document);\n\n$json = $result->toJson(JSON_PRETTY_PRINT);\n$yaml = $result->toYaml();\n$array = $result->toArray();\n$diagnostics = $result->diagnostics();\n",[266,1090,1091,1112,1133,1137,1175,1190,1194,1218,1236,1254],{"__ignoreMap":285},[289,1092,1093,1095,1097,1099,1101,1103,1105,1107,1110],{"class":291,"line":292},[289,1094,296],{"class":295},[289,1096,300],{"class":299},[289,1098,304],{"class":303},[289,1100,307],{"class":299},[289,1102,304],{"class":303},[289,1104,237],{"class":299},[289,1106,304],{"class":303},[289,1108,1109],{"class":299},"Strictness",[289,1111,320],{"class":319},[289,1113,1114,1116,1118,1120,1122,1124,1127,1129,1131],{"class":291,"line":323},[289,1115,296],{"class":295},[289,1117,300],{"class":299},[289,1119,304],{"class":303},[289,1121,307],{"class":299},[289,1123,304],{"class":303},[289,1125,1126],{"class":299},"Serialization",[289,1128,304],{"class":303},[289,1130,1080],{"class":299},[289,1132,320],{"class":319},[289,1134,1135],{"class":291,"line":330},[289,1136,327],{"emptyLinePlaceholder":326},[289,1138,1139,1141,1144,1146,1149,1151,1154,1156,1158,1160,1162,1164,1167,1169,1172],{"class":291,"line":378},[289,1140,333],{"class":319},[289,1142,1143],{"class":336},"result ",[289,1145,341],{"class":340},[289,1147,1148],{"class":360}," Serializer",[289,1150,363],{"class":340},[289,1152,1153],{"class":353},"for",[289,1155,357],{"class":319},[289,1157,316],{"class":360},[289,1159,363],{"class":340},[289,1161,1015],{"class":299},[289,1163,369],{"class":319},[289,1165,1166],{"class":360}," Strictness",[289,1168,363],{"class":340},[289,1170,1171],{"class":299},"Lenient",[289,1173,1174],{"class":319},")\n",[289,1176,1177,1180,1183,1186,1188],{"class":291,"line":412},[289,1178,1179],{"class":340},"    ->",[289,1181,1182],{"class":353},"serialize",[289,1184,1185],{"class":319},"($",[289,1187,347],{"class":336},[289,1189,375],{"class":319},[289,1191,1192],{"class":291,"line":625},[289,1193,327],{"emptyLinePlaceholder":326},[289,1195,1196,1198,1200,1202,1204,1207,1209,1211,1213,1216],{"class":291,"line":639},[289,1197,333],{"class":319},[289,1199,337],{"class":336},[289,1201,341],{"class":340},[289,1203,344],{"class":319},[289,1205,1206],{"class":336},"result",[289,1208,350],{"class":340},[289,1210,354],{"class":353},[289,1212,357],{"class":319},[289,1214,1215],{"class":299},"JSON_PRETTY_PRINT",[289,1217,375],{"class":319},[289,1219,1220,1222,1224,1226,1228,1230,1232,1234],{"class":291,"line":647},[289,1221,333],{"class":319},[289,1223,383],{"class":336},[289,1225,341],{"class":340},[289,1227,344],{"class":319},[289,1229,1206],{"class":336},[289,1231,350],{"class":340},[289,1233,394],{"class":353},[289,1235,750],{"class":319},[289,1237,1238,1240,1242,1244,1246,1248,1250,1252],{"class":291,"line":658},[289,1239,333],{"class":319},[289,1241,417],{"class":336},[289,1243,341],{"class":340},[289,1245,344],{"class":319},[289,1247,1206],{"class":336},[289,1249,350],{"class":340},[289,1251,428],{"class":353},[289,1253,750],{"class":319},[289,1255,1256,1258,1261,1263,1265,1267,1269,1271],{"class":291,"line":29},[289,1257,333],{"class":319},[289,1259,1260],{"class":336},"diagnostics ",[289,1262,341],{"class":340},[289,1264,344],{"class":319},[289,1266,1206],{"class":336},[289,1268,350],{"class":340},[289,1270,1085],{"class":353},[289,1272,750],{"class":319},[1274,1275,1276],"style",{},"html pre.shiki code .sw1J6, html code.shiki .sw1J6{--shiki-light:#F76D47;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .s39Yj, html code.shiki .s39Yj{--shiki-light:#39ADB5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sutJx, html code.shiki .sutJx{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sptTA, html code.shiki .sptTA{--shiki-light:#6182B8;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sQzsp, html code.shiki .sQzsp{--shiki-light:#E53935;--shiki-default:#22863A;--shiki-dark:#85E89D}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":285,"searchDepth":330,"depth":330,"links":1278},[1279,1280,1281,1282,1283],{"id":277,"depth":323,"text":278},{"id":689,"depth":323,"text":690},{"id":819,"depth":323,"text":820},{"id":1042,"depth":323,"text":1043},{"id":1070,"depth":323,"text":1071},"Write any object as JSON, YAML or a PHP array, and save it to a file.","md",{},"---\ntitle: Writing a document\ndescription: Write any object as JSON, YAML or a PHP array, and save it to a file.\n---\n\nEvery object, from the whole `OpenApi` document to a single `Schema`, has three methods that write it for a version.\n\n## JSON, YAML or array\n\n```php\nuse Ark4ne\\OpenApiWriter\\Enums\\Version;\n\n$json = $document->toJson(Version::V3_1_2, JSON_PRETTY_PRINT);\n$yaml = $document->toYaml(Version::V3_1_2);     \u002F\u002F needs symfony\u002Fyaml\n$array = $document->toArray(Version::V3_1_2);\n```\n\n| Method | Returns |\n| --- | --- |\n| `toJson($version = null, int $flags = 0, $extensions = None)` | A JSON string; the flags are those of `json_encode()` |\n| `toYaml($version = null, $extensions = None)` | A YAML string; needs `symfony\u002Fyaml` |\n| `toArray($version = null, $extensions = None)` | A PHP array; empty objects are `\\stdClass`, so they stay `{}` in JSON |\n\nThe version is a `Version` case or its string: `toJson('3.0.4')`. Without one, the version given to\n`OpenApi::openapi()` is used, else 3.1.2. `$extensions` turns on the\n[Redoc extensions](\u002Fopenapi-writer\u002Fversions-and-output\u002Fredoc-extensions).\n\n::example{input=\"toYaml()\" output=\"openapi.yaml\"}\n#input\n```php\n$document->toYaml(Version::V3_1_2);\n```\n#output\n```yaml\nopenapi: 3.1.2\ninfo:\n  title: 'Books API'\n  version: 1.0.0\npaths:\n  '\u002Fbooks\u002F{id}':\n    get:\n      operationId: books.show\n      responses:\n        '200':\n          description: OK\n```\n::\n\n## Writing any object\n\nWriting is not limited to the document: a schema, a response or a parameter can be written alone, which helps to\ninspect a piece or to test it.\n\n```php\nuse Ark4ne\\OpenApiWriter\\Objects\\Schema;\n\n$subtitle = Schema::string()->nullable();\n\n$subtitle->toJson('3.1.2');  \u002F\u002F {\"type\":[\"string\",\"null\"]}\n$subtitle->toJson('3.0.4');  \u002F\u002F {\"type\":\"string\",\"nullable\":true}\n```\n\n`OpenApi` also implements `JsonSerializable`: `json_encode($document)` writes it for its declared version.\n\n## Saving files\n\n```php\n$directory = __DIR__ . '\u002Fpublic';\n\nfile_put_contents(\n    $directory . '\u002Fopenapi.json',\n    $document->toJson(Version::V3_1_2, JSON_PRETTY_PRINT) . \"\\n\",\n);\nfile_put_contents(\n    $directory . '\u002Fopenapi.yaml',\n    $document->toYaml(Version::V3_1_2),\n);\nfile_put_contents(\n    $directory . '\u002Fopenapi-3.0.json',\n    $document->toJson(Version::V3_0_4, JSON_PRETTY_PRINT) . \"\\n\",\n);\n```\n\nThe library writes strings; where they go (a file, an HTTP response, a build artifact) is up to you. Point Swagger UI,\nRedoc, Scalar or any other viewer to the result.\n\n## Key order\n\nThe keys are written in the order of the specification, whatever the order of the calls: `openapi`, `info`, `servers`,\n`paths`… at the root; `type`, `required`, `properties`… in a schema. Two builds of the same document give the same\noutput, which keeps the diffs of a committed file small.\n\n## The serializer\n\n`toJson()` and its siblings are shortcuts for the `Serializer`, which also returns the\n[diagnostics](\u002Fopenapi-writer\u002Fversions-and-output\u002Fstrict-and-lenient#diagnostics):\n\n```php\nuse Ark4ne\\OpenApiWriter\\Enums\\Strictness;\nuse Ark4ne\\OpenApiWriter\\Serialization\\Serializer;\n\n$result = Serializer::for(Version::V3_0_4, Strictness::Lenient)\n    ->serialize($document);\n\n$json = $result->toJson(JSON_PRETTY_PRINT);\n$yaml = $result->toYaml();\n$array = $result->toArray();\n$diagnostics = $result->diagnostics();\n```\n",{"title":189,"description":1284},"pKpOBvcbewyFdfI6t-OhWwMXcqi58aw7xaYVrfyxfXE",[1291,1293],{"title":179,"path":180,"stem":181,"description":1292,"children":-1},"Combine schemas with allOf, oneOf and anyOf, add a discriminator, and use generic envelopes.",{"title":193,"path":194,"stem":195,"description":1294,"children":-1},"One model for every OpenAPI version - how the target version is chosen and what happens when writing.",1795438899291]