[{"data":1,"prerenderedAt":848},["ShallowReactive",2],{"libs":3,"navigation-openapi-writer":115,"\u002Fopenapi-writer\u002Fversions-and-output\u002Fchoosing-a-version":256,"\u002Fopenapi-writer\u002Fversions-and-output\u002Fchoosing-a-version-surround":843},[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":193,"body":258,"description":837,"experimental":119,"extension":838,"links":118,"meta":839,"navigation":410,"path":194,"rawbody":840,"seo":841,"since":118,"stem":195,"__hash__":842},"openapi_writer\u002Fopenapi-writer\u002F4.versions-and-output\u002F2.choosing-a-version.md",{"type":259,"value":260,"toc":831},"minimark",[261,270,275,322,329,333,336,364,531,535,540,543,582,586,589,597,822,827],[262,263,264,265,269],"p",{},"You describe the API once, with the model of the latest version, and choose the OpenAPI version when writing. The same\n",[266,267,268],"code",{},"OpenApi"," object can be written for 3.0.4, 3.1.2 and 3.2.0 in a row.",[271,272,274],"h2",{"id":273},"supported-versions","Supported versions",[276,277,278,291],"table",{},[279,280,281],"thead",{},[282,283,284,288],"tr",{},[285,286,287],"th",{},"Version",[285,289,290],{},"When to choose it",[292,293,294,303,311],"tbody",{},[282,295,296,300],{},[297,298,299],"td",{},"3.1.2 (default), 3.1.1, 3.1.0",[297,301,302],{},"Most tools; full JSON Schema 2020-12",[282,304,305,308],{},[297,306,307],{},"3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0.0",[297,309,310],{},"Older tools: some code generators, older Swagger UI versions",[282,312,313,316],{},[297,314,315],{},"3.2.0",[297,317,318,319],{},"Its new features, when every consumer reads 3.2; see ",[320,321,205],"a",{"href":206},[262,323,324,325,328],{},"Within a line (3.0.x, 3.1.x), the output is the same except for the ",[266,326,327],{},"openapi"," field.",[271,330,332],{"id":331},"where-the-version-comes-from","Where the version comes from",[262,334,335],{},"The first of these that is set wins:",[337,338,339,355,361],"ol",{},[340,341,342,343,346,347,350,351,354],"li",{},"the version passed to the method: ",[266,344,345],{},"toJson(Version::V3_0_4)",", ",[266,348,349],{},"Serializer::for('3.0.4')",",\n",[266,352,353],{},"$validator->validate($document, '3.0.4')",";",[340,356,357,358,354],{},"the version declared by the document: ",[266,359,360],{},"OpenApi::create()->openapi(Version::V3_2_0)",[340,362,363],{},"3.1.2.",[365,366,371],"pre",{"className":367,"code":368,"language":369,"meta":370,"style":370},"language-php shiki shiki-themes material-theme-lighter github-light github-dark","use Ark4ne\\OpenApiWriter\\Enums\\Version;\n\n$document = $document->openapi(Version::V3_2_0);\n\n$document->toJson();                  \u002F\u002F 3.2.0, as declared\n$document->toJson(Version::V3_0_4);   \u002F\u002F 3.0.4\n$document->toJson('3.1.2');           \u002F\u002F a version string works too\n","php","",[266,372,373,405,412,453,458,477,503],{"__ignoreMap":370},[374,375,378,382,386,390,393,395,397,399,401],"span",{"class":376,"line":377},"line",1,[374,379,381],{"class":380},"sw1J6","use",[374,383,385],{"class":384},"s_hVV"," Ark4ne",[374,387,389],{"class":388},"s39Yj","\\",[374,391,392],{"class":384},"OpenApiWriter",[374,394,389],{"class":388},[374,396,237],{"class":384},[374,398,389],{"class":388},[374,400,287],{"class":384},[374,402,404],{"class":403},"sP7_E",";\n",[374,406,408],{"class":376,"line":407},2,[374,409,411],{"emptyLinePlaceholder":410},true,"\n",[374,413,415,418,422,426,429,432,435,438,441,444,447,450],{"class":376,"line":414},3,[374,416,417],{"class":403},"$",[374,419,421],{"class":420},"su5hD","document ",[374,423,425],{"class":424},"smGrS","=",[374,427,428],{"class":403}," $",[374,430,431],{"class":420},"document",[374,433,434],{"class":424},"->",[374,436,327],{"class":437},"sGLFI",[374,439,440],{"class":403},"(",[374,442,287],{"class":443},"sZMiF",[374,445,446],{"class":424},"::",[374,448,449],{"class":384},"V3_2_0",[374,451,452],{"class":403},");\n",[374,454,456],{"class":376,"line":455},4,[374,457,411],{"emptyLinePlaceholder":410},[374,459,461,463,465,467,470,473],{"class":376,"line":460},5,[374,462,417],{"class":403},[374,464,431],{"class":420},[374,466,434],{"class":424},[374,468,469],{"class":437},"toJson",[374,471,472],{"class":403},"();",[374,474,476],{"class":475},"sutJx","                  \u002F\u002F 3.2.0, as declared\n",[374,478,480,482,484,486,488,490,492,494,497,500],{"class":376,"line":479},6,[374,481,417],{"class":403},[374,483,431],{"class":420},[374,485,434],{"class":424},[374,487,469],{"class":437},[374,489,440],{"class":403},[374,491,287],{"class":443},[374,493,446],{"class":424},[374,495,496],{"class":384},"V3_0_4",[374,498,499],{"class":403},");",[374,501,502],{"class":475},"   \u002F\u002F 3.0.4\n",[374,504,506,508,510,512,514,516,520,524,526,528],{"class":376,"line":505},7,[374,507,417],{"class":403},[374,509,431],{"class":420},[374,511,434],{"class":424},[374,513,469],{"class":437},[374,515,440],{"class":403},[374,517,519],{"class":518},"sjJ54","'",[374,521,523],{"class":522},"s_sjI","3.1.2",[374,525,519],{"class":518},[374,527,499],{"class":403},[374,529,530],{"class":475},"           \u002F\u002F a version string works too\n",[271,532,534],{"id":533},"what-happens-when-writing","What happens when writing",[536,537],"mermaid-diagram",{"caption":538,"svg":539},"Writing a document for a version","\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" class=\"mermaid mermaid-flowchart\" viewBox=\"0 0 1333 367\" width=\"100%\" role=\"img\" aria-roledescription=\"flowchart\" data-mermaid-version=\"13.0.0-alpha.3\" style=\"max-width:1333px;--_ff:var(--mermaid-fontFamily,&quot;trebuchet ms&quot;, verdana, arial, sans-serif);--_fs:var(--mermaid-fontSize,16px);--_mb:var(--mermaid-mainBkg,var(--_p));--_p:var(--mermaid-primaryColor,#fff4dd);--_nb:var(--mermaid-nodeBorder,var(--_pb));--_pb:var(--mermaid-primaryBorderColor,color-mix(in srgb,var(--_p) 85%,black));--_nt:var(--mermaid-nodeTextColor,color(from color(from var(--_mb) srgb-linear calc(1 - max(clamp(0,((0.2126*r + 0.7152*g + 0.0722*b) - 0.231668)*1e9,1))) 0 0) srgb calc(0.2 + 0.756863*r) calc(0.2 + 0.756863*r) calc(0.2 + 0.756863*r)));--_sw:var(--mermaid-strokeWidth,1px);--_l:var(--mermaid-lineColor,#0b0b0b);--_ah:var(--mermaid-arrowheadColor,var(--_l));--_el:var(--mermaid-edgeLabelBackground,var(--_s));--_s:var(--mermaid-secondaryColor,#f4ddff);--_tx:var(--mermaid-textColor,var(--_pt));--_pt:var(--mermaid-primaryTextColor,#333333)\" font-family=\"var(--_ff)\" font-size=\"var(--_fs)\">\u003Cg class=\"edgePaths\" fill=\"none\" stroke=\"var(--_l)\" stroke-width=\"var(--_sw)\" stroke-linecap=\"round\">\u003Cg class=\"edge flowchart-link edge-thickness-normal edge-pattern-solid\" data-id=\"L_Model_Feature_0\" data-ast=\"e:Model&gt;Feature\">\u003Cpath d=\"M188,101.58L231,101.58\" fill=\"none\"\u002F>\u003Cpath class=\"marker\" d=\"M238,101.58L230,105.58L230,97.58Z\" fill=\"var(--_ah)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"edge flowchart-link edge-thickness-normal edge-pattern-solid\" data-id=\"L_Feature_Out_0\" data-ast=\"e:Feature&gt;Out\">\u003Cpath d=\"M406.15,82.58L438.15,82.58A5,5 0 0,0 443.15,77.58L443.15,33A5,5 0 0,1 448.15,28L1121.37,28A5,5 0 0,1 1126.37,33L1126.37,104.86A5,5 0 0,0 1131.37,109.86L1137.37,109.86\" fill=\"none\"\u002F>\u003Cpath class=\"marker\" d=\"M1144.37,109.86L1136.37,113.86L1136.37,105.86Z\" fill=\"var(--_ah)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"edge flowchart-link edge-thickness-normal edge-pattern-solid\" data-id=\"L_Feature_Converted_0\" data-ast=\"e:Feature&gt;Converted\">\u003Cpath d=\"M422.15,98.58L603.84,98.58\" fill=\"none\"\u002F>\u003Cpath class=\"marker\" d=\"M610.84,98.58L602.84,102.58L602.84,94.58Z\" fill=\"var(--_ah)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"edge flowchart-link edge-thickness-normal edge-pattern-solid\" data-id=\"L_Converted_Out_0\" data-ast=\"e:Converted&gt;Out\">\u003Cpath d=\"M790.84,98.58L1107.37,98.58A5,5 0 0,1 1112.37,103.58L1112.37,120.86A5,5 0 0,0 1117.37,125.86L1137.37,125.86\" fill=\"none\"\u002F>\u003Cpath class=\"marker\" d=\"M1144.37,125.86L1136.37,129.86L1136.37,121.86Z\" fill=\"var(--_ah)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"edge flowchart-link edge-thickness-normal edge-pattern-solid\" data-id=\"L_Feature_Mode_0\" data-ast=\"e:Feature&gt;Mode\">\u003Cpath d=\"M409.01,117.72L438.15,117.72A5,5 0 0,1 443.15,122.72L443.15,265.45A5,5 0 0,0 448.15,270.45L609.55,270.45\" fill=\"none\"\u002F>\u003Cpath class=\"marker\" d=\"M616.55,270.45L608.55,274.45L608.55,266.45Z\" fill=\"var(--_ah)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"edge flowchart-link edge-thickness-normal edge-pattern-solid\" data-id=\"L_Mode_Exception_0\" data-ast=\"e:Mode&gt;Exception\">\u003Cpath d=\"M774.56,259.87L803.84,259.87A5,5 0 0,0 808.84,254.87L808.84,213.15A5,5 0 0,1 813.84,208.15L907.37,208.15\" fill=\"none\"\u002F>\u003Cpath class=\"marker\" d=\"M914.37,208.15L906.37,212.15L906.37,204.15Z\" fill=\"var(--_ah)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"edge flowchart-link edge-thickness-normal edge-pattern-solid\" data-id=\"L_Mode_Dropped_0\" data-ast=\"e:Mode&gt;Dropped\">\u003Cpath d=\"M774.56,281.02L803.84,281.02A5,5 0 0,1 808.84,286.02L808.84,320.3A5,5 0 0,0 813.84,325.3L907.37,325.3\" fill=\"none\"\u002F>\u003Cpath class=\"marker\" d=\"M914.37,325.3L906.37,329.3L906.37,321.3Z\" fill=\"var(--_ah)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003Cg class=\"edge flowchart-link edge-thickness-normal edge-pattern-solid\" data-id=\"L_Dropped_Out_0\" data-ast=\"e:Dropped&gt;Out\">\u003Cpath d=\"M1094.37,325.3L1107.37,325.3A5,5 0 0,0 1112.37,320.3L1112.37,146.86A5,5 0 0,1 1117.37,141.86L1137.37,141.86\" fill=\"none\"\u002F>\u003Cpath class=\"marker\" d=\"M1144.37,141.86L1136.37,145.86L1136.37,137.86Z\" fill=\"var(--_ah)\" stroke=\"none\"\u002F>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"edgeLabels\">\u003Cg class=\"edgeLabel\" data-id=\"L_Feature_Out_0\">\u003Crect x=\"681.47\" y=\"18.71\" width=\"38.74\" height=\"18.58\" rx=\"3\" fill=\"var(--_el)\"\u002F>\u003Ctext fill=\"var(--_tx)\" x=\"700.84\" y=\"33.74\" text-anchor=\"middle\">as is\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"edgeLabel\" data-id=\"L_Feature_Converted_0\">\u003Crect x=\"463.15\" y=\"89.29\" width=\"120.69\" height=\"18.58\" rx=\"3\" fill=\"var(--_el)\"\u002F>\u003Ctext fill=\"var(--_tx)\" x=\"523.5\" y=\"104.31\" text-anchor=\"middle\">in another form\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"edgeLabel\" data-id=\"L_Feature_Mode_0\">\u003Crect x=\"510.83\" y=\"261.16\" width=\"25.33\" height=\"18.58\" rx=\"3\" fill=\"var(--_el)\"\u002F>\u003Ctext fill=\"var(--_tx)\" x=\"523.5\" y=\"276.18\" text-anchor=\"middle\">no\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"edgeLabel\" data-id=\"L_Mode_Exception_0\">\u003Crect x=\"835.18\" y=\"198.86\" width=\"45.86\" height=\"18.58\" rx=\"3\" fill=\"var(--_el)\"\u002F>\u003Ctext fill=\"var(--_tx)\" x=\"858.1\" y=\"213.89\" text-anchor=\"middle\">strict\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"edgeLabel\" data-id=\"L_Mode_Dropped_0\">\u003Crect x=\"828.84\" y=\"316.02\" width=\"58.53\" height=\"18.58\" rx=\"3\" fill=\"var(--_el)\"\u002F>\u003Ctext fill=\"var(--_tx)\" x=\"858.1\" y=\"331.04\" text-anchor=\"middle\">lenient\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"nodes\" fill=\"var(--_nt)\">\u003Cg class=\"node default\" data-id=\"Model\" data-ast=\"n:Model\" transform=\"translate(98,101.58)\">\u003Crect x=\"-90\" y=\"-24.29\" width=\"180\" height=\"48.58\" fill=\"var(--_mb)\" stroke=\"var(--_nb)\" stroke-width=\"var(--_sw)\"\u002F>\u003Ctext x=\"0\" y=\"5.74\" text-anchor=\"middle\">PHP objects\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"node default\" data-id=\"Feature\" data-ast=\"n:Feature\" transform=\"translate(331.58,101.58)\">\u003Cpolygon points=\"0,-93.58 93.58,0 0,93.58 -93.58,0\" fill=\"var(--_mb)\" stroke=\"var(--_nb)\" stroke-width=\"var(--_sw)\"\u002F>\u003Ctext text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-3.55\">Can the version\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"15.02\">express it?\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"node default\" data-id=\"Out\" data-ast=\"n:Out\" transform=\"translate(1234.37,125.86)\">\u003Crect x=\"-90\" y=\"-33.58\" width=\"180\" height=\"67.15\" fill=\"var(--_mb)\" stroke=\"var(--_nb)\" stroke-width=\"var(--_sw)\"\u002F>\u003Ctext text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-3.55\">JSON, YAML or\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"15.02\">array\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"node default\" data-id=\"Converted\" data-ast=\"n:Converted\" transform=\"translate(700.84,98.58)\">\u003Crect x=\"-90\" y=\"-24.29\" width=\"180\" height=\"48.58\" fill=\"var(--_mb)\" stroke=\"var(--_nb)\" stroke-width=\"var(--_sw)\"\u002F>\u003Ctext x=\"0\" y=\"5.74\" text-anchor=\"middle\">Converted\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"node default\" data-id=\"Mode\" data-ast=\"n:Mode\" transform=\"translate(700.84,270.45)\">\u003Cpolygon points=\"0,-84.29 84.29,0 0,84.29 -84.29,0\" fill=\"var(--_mb)\" stroke=\"var(--_nb)\" stroke-width=\"var(--_sw)\"\u002F>\u003Ctext x=\"0\" y=\"5.74\" text-anchor=\"middle\">Mode\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"node default\" data-id=\"Exception\" data-ast=\"n:Exception\" transform=\"translate(1004.37,208.15)\">\u003Crect x=\"-90\" y=\"-33.58\" width=\"180\" height=\"67.15\" fill=\"var(--_mb)\" stroke=\"var(--_nb)\" stroke-width=\"var(--_sw)\"\u002F>\u003Ctext text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-3.55\">UnsupportedFea\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"15.02\">tureException\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"node default\" data-id=\"Dropped\" data-ast=\"n:Dropped\" transform=\"translate(1004.37,325.3)\">\u003Crect x=\"-90\" y=\"-33.58\" width=\"180\" height=\"67.15\" fill=\"var(--_mb)\" stroke=\"var(--_nb)\" stroke-width=\"var(--_sw)\"\u002F>\u003Ctext text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"0\" y=\"-3.55\">Dropped and\u003C\u002Ftspan>\u003Ctspan x=\"0\" y=\"15.02\">reported\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003C\u002Fsvg>",[262,541,542],{},"Each field and each difference between versions falls in one of three cases:",[544,545,546,553,574],"ul",{},[340,547,548,552],{},[549,550,551],"strong",{},"Written as is",": the field exists in the version.",[340,554,555,558,559,562,563,566,567,570,571,573],{},[549,556,557],{},"Converted",": the version expresses it in another form. A nullable string becomes ",[266,560,561],{},"nullable: true"," in 3.0,\n",[266,564,565],{},"const"," becomes a one-value ",[266,568,569],{},"enum",". See ",[320,572,197],{"href":198},".",[340,575,576,579,580,573],{},[549,577,578],{},"Unsupported",": the version has no way to express it, such as webhooks in 3.0. In strict mode, the default, the\nlibrary throws one exception listing all of them; in lenient mode it drops them and reports each one. See\n",[320,581,201],{"href":202},[271,583,585],{"id":584},"targeting-several-versions","Targeting several versions",[262,587,588],{},"To publish one document for several versions:",[544,590,591,594],{},[340,592,593],{},"use only the features of the oldest version, and write each version in strict mode: any slip throws;",[340,595,596],{},"or declare the newest version, and write the older ones in lenient mode, checking what was dropped:",[365,598,600],{"className":367,"code":599,"language":369,"meta":370,"style":370},"use Ark4ne\\OpenApiWriter\\Enums\\Strictness;\nuse Ark4ne\\OpenApiWriter\\Serialization\\DiagnosticLevel;\nuse Ark4ne\\OpenApiWriter\\Serialization\\Serializer;\n\n$v32 = $document->openapi(Version::V3_2_0)->toJson();\n\n$result = Serializer::for(Version::V3_0_4, Strictness::Lenient)\n    ->serialize($document);\n$v30 = $result->toJson();\n$lost = $result->diagnostics()->ofLevel(DiagnosticLevel::Dropped);\n",[266,601,602,623,645,666,670,705,709,748,764,785],{"__ignoreMap":370},[374,603,604,606,608,610,612,614,616,618,621],{"class":376,"line":377},[374,605,381],{"class":380},[374,607,385],{"class":384},[374,609,389],{"class":388},[374,611,392],{"class":384},[374,613,389],{"class":388},[374,615,237],{"class":384},[374,617,389],{"class":388},[374,619,620],{"class":384},"Strictness",[374,622,404],{"class":403},[374,624,625,627,629,631,633,635,638,640,643],{"class":376,"line":407},[374,626,381],{"class":380},[374,628,385],{"class":384},[374,630,389],{"class":388},[374,632,392],{"class":384},[374,634,389],{"class":388},[374,636,637],{"class":384},"Serialization",[374,639,389],{"class":388},[374,641,642],{"class":384},"DiagnosticLevel",[374,644,404],{"class":403},[374,646,647,649,651,653,655,657,659,661,664],{"class":376,"line":414},[374,648,381],{"class":380},[374,650,385],{"class":384},[374,652,389],{"class":388},[374,654,392],{"class":384},[374,656,389],{"class":388},[374,658,637],{"class":384},[374,660,389],{"class":388},[374,662,663],{"class":384},"Serializer",[374,665,404],{"class":403},[374,667,668],{"class":376,"line":455},[374,669,411],{"emptyLinePlaceholder":410},[374,671,672,674,677,679,681,683,685,687,689,691,693,695,698,700,702],{"class":376,"line":460},[374,673,417],{"class":403},[374,675,676],{"class":420},"v32 ",[374,678,425],{"class":424},[374,680,428],{"class":403},[374,682,431],{"class":420},[374,684,434],{"class":424},[374,686,327],{"class":437},[374,688,440],{"class":403},[374,690,287],{"class":443},[374,692,446],{"class":424},[374,694,449],{"class":384},[374,696,697],{"class":403},")",[374,699,434],{"class":424},[374,701,469],{"class":437},[374,703,704],{"class":403},"();\n",[374,706,707],{"class":376,"line":479},[374,708,411],{"emptyLinePlaceholder":410},[374,710,711,713,716,718,721,723,726,728,730,732,734,737,740,742,745],{"class":376,"line":505},[374,712,417],{"class":403},[374,714,715],{"class":420},"result ",[374,717,425],{"class":424},[374,719,720],{"class":443}," Serializer",[374,722,446],{"class":424},[374,724,725],{"class":437},"for",[374,727,440],{"class":403},[374,729,287],{"class":443},[374,731,446],{"class":424},[374,733,496],{"class":384},[374,735,736],{"class":403},",",[374,738,739],{"class":443}," Strictness",[374,741,446],{"class":424},[374,743,744],{"class":384},"Lenient",[374,746,747],{"class":403},")\n",[374,749,751,754,757,760,762],{"class":376,"line":750},8,[374,752,753],{"class":424},"    ->",[374,755,756],{"class":437},"serialize",[374,758,759],{"class":403},"($",[374,761,431],{"class":420},[374,763,452],{"class":403},[374,765,767,769,772,774,776,779,781,783],{"class":376,"line":766},9,[374,768,417],{"class":403},[374,770,771],{"class":420},"v30 ",[374,773,425],{"class":424},[374,775,428],{"class":403},[374,777,778],{"class":420},"result",[374,780,434],{"class":424},[374,782,469],{"class":437},[374,784,704],{"class":403},[374,786,787,789,792,794,796,798,800,803,806,808,811,813,815,817,820],{"class":376,"line":29},[374,788,417],{"class":403},[374,790,791],{"class":420},"lost ",[374,793,425],{"class":424},[374,795,428],{"class":403},[374,797,778],{"class":420},[374,799,434],{"class":424},[374,801,802],{"class":437},"diagnostics",[374,804,805],{"class":403},"()",[374,807,434],{"class":424},[374,809,810],{"class":437},"ofLevel",[374,812,440],{"class":403},[374,814,642],{"class":443},[374,816,446],{"class":424},[374,818,819],{"class":384},"Dropped",[374,821,452],{"class":403},[262,823,824,825,573],{},"Validate each version you publish: see ",[320,826,219],{"href":220},[828,829,830],"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 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 .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);}",{"title":370,"searchDepth":414,"depth":414,"links":832},[833,834,835,836],{"id":273,"depth":407,"text":274},{"id":331,"depth":407,"text":332},{"id":533,"depth":407,"text":534},{"id":584,"depth":407,"text":585},"One model for every OpenAPI version - how the target version is chosen and what happens when writing.","md",{},"---\ntitle: Choosing a version\ndescription: One model for every OpenAPI version - how the target version is chosen and what happens when writing.\n---\n\nYou describe the API once, with the model of the latest version, and choose the OpenAPI version when writing. The same\n`OpenApi` object can be written for 3.0.4, 3.1.2 and 3.2.0 in a row.\n\n## Supported versions\n\n| Version | When to choose it |\n| --- | --- |\n| 3.1.2 (default), 3.1.1, 3.1.0 | Most tools; full JSON Schema 2020-12 |\n| 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0.0 | Older tools: some code generators, older Swagger UI versions |\n| 3.2.0 | Its new features, when every consumer reads 3.2; see [OpenAPI 3.2](\u002Fopenapi-writer\u002Fversions-and-output\u002Fopenapi-3-2) |\n\nWithin a line (3.0.x, 3.1.x), the output is the same except for the `openapi` field.\n\n## Where the version comes from\n\nThe first of these that is set wins:\n\n1. the version passed to the method: `toJson(Version::V3_0_4)`, `Serializer::for('3.0.4')`,\n   `$validator->validate($document, '3.0.4')`;\n2. the version declared by the document: `OpenApi::create()->openapi(Version::V3_2_0)`;\n3. 3.1.2.\n\n```php\nuse Ark4ne\\OpenApiWriter\\Enums\\Version;\n\n$document = $document->openapi(Version::V3_2_0);\n\n$document->toJson();                  \u002F\u002F 3.2.0, as declared\n$document->toJson(Version::V3_0_4);   \u002F\u002F 3.0.4\n$document->toJson('3.1.2');           \u002F\u002F a version string works too\n```\n\n## What happens when writing\n\n```mermaid [Writing a document for a version]\nflowchart LR\n  Model[PHP objects] --> Feature{Can the version\u003Cbr\u002F>express it?}\n  Feature -->|as is| Out[JSON, YAML or array]\n  Feature -->|in another form| Converted[Converted] --> Out\n  Feature -->|no| Mode{Mode}\n  Mode -->|strict| Exception[UnsupportedFeatureException]\n  Mode -->|lenient| Dropped[Dropped and reported] --> Out\n```\n\nEach field and each difference between versions falls in one of three cases:\n\n- **Written as is**: the field exists in the version.\n- **Converted**: the version expresses it in another form. A nullable string becomes `nullable: true` in 3.0,\n  `const` becomes a one-value `enum`. See [Conversions](\u002Fopenapi-writer\u002Fversions-and-output\u002Fconversions).\n- **Unsupported**: the version has no way to express it, such as webhooks in 3.0. In strict mode, the default, the\n  library throws one exception listing all of them; in lenient mode it drops them and reports each one. See\n  [Strict and lenient](\u002Fopenapi-writer\u002Fversions-and-output\u002Fstrict-and-lenient).\n\n## Targeting several versions\n\nTo publish one document for several versions:\n\n- use only the features of the oldest version, and write each version in strict mode: any slip throws;\n- or declare the newest version, and write the older ones in lenient mode, checking what was dropped:\n\n```php\nuse Ark4ne\\OpenApiWriter\\Enums\\Strictness;\nuse Ark4ne\\OpenApiWriter\\Serialization\\DiagnosticLevel;\nuse Ark4ne\\OpenApiWriter\\Serialization\\Serializer;\n\n$v32 = $document->openapi(Version::V3_2_0)->toJson();\n\n$result = Serializer::for(Version::V3_0_4, Strictness::Lenient)\n    ->serialize($document);\n$v30 = $result->toJson();\n$lost = $result->diagnostics()->ofLevel(DiagnosticLevel::Dropped);\n```\n\nValidate each version you publish: see [Validating a document](\u002Fopenapi-writer\u002Fvalidation\u002Fvalidating-a-document).\n",{"title":193,"description":837},"NkXocYDPRiWLrBDEpnLYQ9wLDTzzBXqRW0Ild22onVQ",[844,846],{"title":189,"path":190,"stem":191,"description":845,"children":-1},"Write any object as JSON, YAML or a PHP array, and save it to a file.",{"title":197,"path":198,"stem":199,"description":847,"children":-1},"What the library rewrites for OpenAPI 3.0, and what each version cannot express.",1795438899122]