[{"data":1,"prerenderedAt":1873},["ShallowReactive",2],{"libs":3,"navigation-openapi-writer":115,"\u002Fopenapi-writer\u002Fbuilding-documents\u002Fcomponents-and-references":256,"\u002Fopenapi-writer\u002Fbuilding-documents\u002Fcomponents-and-references-surround":1868},[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":158,"body":258,"description":1862,"experimental":119,"extension":1863,"links":118,"meta":1864,"navigation":441,"path":159,"rawbody":1865,"seo":1866,"since":118,"stem":160,"__hash__":1867},"openapi_writer\u002Fopenapi-writer\u002F2.building-documents\u002F5.components-and-references.md",{"type":259,"value":260,"toc":1856},"minimark",[261,274,279,285,1009,1036,1076,1080,1086,1189,1203,1206,1503,1513,1517,1536,1690,1699,1715,1719,1729,1842,1852],[262,263,264,265,269,270,273],"p",{},"Declare each reusable piece once in ",[266,267,268],"code",{},"Components",", under a name, then refer to it with ",[266,271,272],{},"::ref()"," wherever the\nspecification accepts a reference.",[275,276,278],"h2",{"id":277},"declaring-components","Declaring components",[262,280,281,282,284],{},"Every section of ",[266,283,268],{}," is a map: the objectId of each entry is the component name.",[286,287,292],"pre",{"className":288,"code":289,"language":290,"meta":291,"style":291},"language-php shiki shiki-themes material-theme-lighter github-light github-dark","use Ark4ne\\OpenApiWriter\\Objects\\Components;\nuse Ark4ne\\OpenApiWriter\\Objects\\MediaType;\nuse Ark4ne\\OpenApiWriter\\Objects\\Parameter;\nuse Ark4ne\\OpenApiWriter\\Objects\\RequestBody;\nuse Ark4ne\\OpenApiWriter\\Objects\\Response;\nuse Ark4ne\\OpenApiWriter\\Objects\\Schema;\n\n$error = MediaType::json()->schema(Schema::ref('Error'));\n\n$components = Components::create()\n    ->schemas(\n        Schema::object('Book')\n            ->properties(\n                Schema::integer('id')->format('int64')->readOnly(),\n                Schema::string('title')->minLength(1),\n            )\n            ->required('id', 'title'),\n        Schema::object('Error')\n            ->properties(Schema::string('message'))\n            ->required('message'),\n    )\n    ->parameters(\n        Parameter::path('book', 'BookId')\n            ->schema(Schema::integer()->format('int64')),\n    )\n    ->requestBodies(\n        RequestBody::create('Book')\n            ->required()\n            ->content(MediaType::json()->schema(Schema::ref('Book'))),\n    )\n    ->responses(\n        Response::notFound()->objectId('NotFound')->content($error),\n    );\n\n$document = $document->components($components);\n","php","",[266,293,294,326,348,370,392,414,436,443,502,507,527,539,562,573,620,655,661,689,708,735,751,757,767,798,830,835,845,865,874,915,919,929,970,976,981],{"__ignoreMap":291},[295,296,299,303,307,311,314,316,318,320,322],"span",{"class":297,"line":298},"line",1,[295,300,302],{"class":301},"sw1J6","use",[295,304,306],{"class":305},"s_hVV"," Ark4ne",[295,308,310],{"class":309},"s39Yj","\\",[295,312,313],{"class":305},"OpenApiWriter",[295,315,310],{"class":309},[295,317,233],{"class":305},[295,319,310],{"class":309},[295,321,268],{"class":305},[295,323,325],{"class":324},"sP7_E",";\n",[295,327,329,331,333,335,337,339,341,343,346],{"class":297,"line":328},2,[295,330,302],{"class":301},[295,332,306],{"class":305},[295,334,310],{"class":309},[295,336,313],{"class":305},[295,338,310],{"class":309},[295,340,233],{"class":305},[295,342,310],{"class":309},[295,344,345],{"class":305},"MediaType",[295,347,325],{"class":324},[295,349,351,353,355,357,359,361,363,365,368],{"class":297,"line":350},3,[295,352,302],{"class":301},[295,354,306],{"class":305},[295,356,310],{"class":309},[295,358,313],{"class":305},[295,360,310],{"class":309},[295,362,233],{"class":305},[295,364,310],{"class":309},[295,366,367],{"class":305},"Parameter",[295,369,325],{"class":324},[295,371,373,375,377,379,381,383,385,387,390],{"class":297,"line":372},4,[295,374,302],{"class":301},[295,376,306],{"class":305},[295,378,310],{"class":309},[295,380,313],{"class":305},[295,382,310],{"class":309},[295,384,233],{"class":305},[295,386,310],{"class":309},[295,388,389],{"class":305},"RequestBody",[295,391,325],{"class":324},[295,393,395,397,399,401,403,405,407,409,412],{"class":297,"line":394},5,[295,396,302],{"class":301},[295,398,306],{"class":305},[295,400,310],{"class":309},[295,402,313],{"class":305},[295,404,310],{"class":309},[295,406,233],{"class":305},[295,408,310],{"class":309},[295,410,411],{"class":305},"Response",[295,413,325],{"class":324},[295,415,417,419,421,423,425,427,429,431,434],{"class":297,"line":416},6,[295,418,302],{"class":301},[295,420,306],{"class":305},[295,422,310],{"class":309},[295,424,313],{"class":305},[295,426,310],{"class":309},[295,428,233],{"class":305},[295,430,310],{"class":309},[295,432,433],{"class":305},"Schema",[295,435,325],{"class":324},[295,437,439],{"class":297,"line":438},7,[295,440,442],{"emptyLinePlaceholder":441},true,"\n",[295,444,446,449,453,457,461,464,468,471,474,477,480,482,484,487,489,493,497,499],{"class":297,"line":445},8,[295,447,448],{"class":324},"$",[295,450,452],{"class":451},"su5hD","error ",[295,454,456],{"class":455},"smGrS","=",[295,458,460],{"class":459},"sZMiF"," MediaType",[295,462,463],{"class":455},"::",[295,465,467],{"class":466},"sGLFI","json",[295,469,470],{"class":324},"()",[295,472,473],{"class":455},"->",[295,475,476],{"class":466},"schema",[295,478,479],{"class":324},"(",[295,481,433],{"class":459},[295,483,463],{"class":455},[295,485,486],{"class":466},"ref",[295,488,479],{"class":324},[295,490,492],{"class":491},"sjJ54","'",[295,494,496],{"class":495},"s_sjI","Error",[295,498,492],{"class":491},[295,500,501],{"class":324},"));\n",[295,503,505],{"class":297,"line":504},9,[295,506,442],{"emptyLinePlaceholder":441},[295,508,509,511,514,516,519,521,524],{"class":297,"line":29},[295,510,448],{"class":324},[295,512,513],{"class":451},"components ",[295,515,456],{"class":455},[295,517,518],{"class":459}," Components",[295,520,463],{"class":455},[295,522,523],{"class":466},"create",[295,525,526],{"class":324},"()\n",[295,528,530,533,536],{"class":297,"line":529},11,[295,531,532],{"class":455},"    ->",[295,534,535],{"class":466},"schemas",[295,537,538],{"class":324},"(\n",[295,540,542,545,547,550,552,554,557,559],{"class":297,"line":541},12,[295,543,544],{"class":459},"        Schema",[295,546,463],{"class":455},[295,548,549],{"class":466},"object",[295,551,479],{"class":324},[295,553,492],{"class":491},[295,555,556],{"class":495},"Book",[295,558,492],{"class":491},[295,560,561],{"class":324},")\n",[295,563,565,568,571],{"class":297,"line":564},13,[295,566,567],{"class":455},"            ->",[295,569,570],{"class":466},"properties",[295,572,538],{"class":324},[295,574,576,579,581,584,586,588,591,593,596,598,601,603,605,608,610,612,614,617],{"class":297,"line":575},14,[295,577,578],{"class":459},"                Schema",[295,580,463],{"class":455},[295,582,583],{"class":466},"integer",[295,585,479],{"class":324},[295,587,492],{"class":491},[295,589,590],{"class":495},"id",[295,592,492],{"class":491},[295,594,595],{"class":324},")",[295,597,473],{"class":455},[295,599,600],{"class":466},"format",[295,602,479],{"class":324},[295,604,492],{"class":491},[295,606,607],{"class":495},"int64",[295,609,492],{"class":491},[295,611,595],{"class":324},[295,613,473],{"class":455},[295,615,616],{"class":466},"readOnly",[295,618,619],{"class":324},"(),\n",[295,621,623,625,627,630,632,634,637,639,641,643,646,648,652],{"class":297,"line":622},15,[295,624,578],{"class":459},[295,626,463],{"class":455},[295,628,629],{"class":466},"string",[295,631,479],{"class":324},[295,633,492],{"class":491},[295,635,636],{"class":495},"title",[295,638,492],{"class":491},[295,640,595],{"class":324},[295,642,473],{"class":455},[295,644,645],{"class":466},"minLength",[295,647,479],{"class":324},[295,649,651],{"class":650},"srdBf","1",[295,653,654],{"class":324},"),\n",[295,656,658],{"class":297,"line":657},16,[295,659,660],{"class":324},"            )\n",[295,662,664,666,669,671,673,675,677,680,683,685,687],{"class":297,"line":663},17,[295,665,567],{"class":455},[295,667,668],{"class":466},"required",[295,670,479],{"class":324},[295,672,492],{"class":491},[295,674,590],{"class":495},[295,676,492],{"class":491},[295,678,679],{"class":324},",",[295,681,682],{"class":491}," '",[295,684,636],{"class":495},[295,686,492],{"class":491},[295,688,654],{"class":324},[295,690,692,694,696,698,700,702,704,706],{"class":297,"line":691},18,[295,693,544],{"class":459},[295,695,463],{"class":455},[295,697,549],{"class":466},[295,699,479],{"class":324},[295,701,492],{"class":491},[295,703,496],{"class":495},[295,705,492],{"class":491},[295,707,561],{"class":324},[295,709,711,713,715,717,719,721,723,725,727,730,732],{"class":297,"line":710},19,[295,712,567],{"class":455},[295,714,570],{"class":466},[295,716,479],{"class":324},[295,718,433],{"class":459},[295,720,463],{"class":455},[295,722,629],{"class":466},[295,724,479],{"class":324},[295,726,492],{"class":491},[295,728,729],{"class":495},"message",[295,731,492],{"class":491},[295,733,734],{"class":324},"))\n",[295,736,737,739,741,743,745,747,749],{"class":297,"line":58},[295,738,567],{"class":455},[295,740,668],{"class":466},[295,742,479],{"class":324},[295,744,492],{"class":491},[295,746,729],{"class":495},[295,748,492],{"class":491},[295,750,654],{"class":324},[295,752,754],{"class":297,"line":753},21,[295,755,756],{"class":324},"    )\n",[295,758,760,762,765],{"class":297,"line":759},22,[295,761,532],{"class":455},[295,763,764],{"class":466},"parameters",[295,766,538],{"class":324},[295,768,770,773,775,778,780,782,785,787,789,791,794,796],{"class":297,"line":769},23,[295,771,772],{"class":459},"        Parameter",[295,774,463],{"class":455},[295,776,777],{"class":466},"path",[295,779,479],{"class":324},[295,781,492],{"class":491},[295,783,784],{"class":495},"book",[295,786,492],{"class":491},[295,788,679],{"class":324},[295,790,682],{"class":491},[295,792,793],{"class":495},"BookId",[295,795,492],{"class":491},[295,797,561],{"class":324},[295,799,801,803,805,807,809,811,813,815,817,819,821,823,825,827],{"class":297,"line":800},24,[295,802,567],{"class":455},[295,804,476],{"class":466},[295,806,479],{"class":324},[295,808,433],{"class":459},[295,810,463],{"class":455},[295,812,583],{"class":466},[295,814,470],{"class":324},[295,816,473],{"class":455},[295,818,600],{"class":466},[295,820,479],{"class":324},[295,822,492],{"class":491},[295,824,607],{"class":495},[295,826,492],{"class":491},[295,828,829],{"class":324},")),\n",[295,831,833],{"class":297,"line":832},25,[295,834,756],{"class":324},[295,836,838,840,843],{"class":297,"line":837},26,[295,839,532],{"class":455},[295,841,842],{"class":466},"requestBodies",[295,844,538],{"class":324},[295,846,848,851,853,855,857,859,861,863],{"class":297,"line":847},27,[295,849,850],{"class":459},"        RequestBody",[295,852,463],{"class":455},[295,854,523],{"class":466},[295,856,479],{"class":324},[295,858,492],{"class":491},[295,860,556],{"class":495},[295,862,492],{"class":491},[295,864,561],{"class":324},[295,866,868,870,872],{"class":297,"line":867},28,[295,869,567],{"class":455},[295,871,668],{"class":466},[295,873,526],{"class":324},[295,875,877,879,882,884,886,888,890,892,894,896,898,900,902,904,906,908,910,912],{"class":297,"line":876},29,[295,878,567],{"class":455},[295,880,881],{"class":466},"content",[295,883,479],{"class":324},[295,885,345],{"class":459},[295,887,463],{"class":455},[295,889,467],{"class":466},[295,891,470],{"class":324},[295,893,473],{"class":455},[295,895,476],{"class":466},[295,897,479],{"class":324},[295,899,433],{"class":459},[295,901,463],{"class":455},[295,903,486],{"class":466},[295,905,479],{"class":324},[295,907,492],{"class":491},[295,909,556],{"class":495},[295,911,492],{"class":491},[295,913,914],{"class":324},"))),\n",[295,916,917],{"class":297,"line":84},[295,918,756],{"class":324},[295,920,922,924,927],{"class":297,"line":921},31,[295,923,532],{"class":455},[295,925,926],{"class":466},"responses",[295,928,538],{"class":324},[295,930,932,935,937,940,942,944,947,949,951,954,956,958,960,962,965,968],{"class":297,"line":931},32,[295,933,934],{"class":459},"        Response",[295,936,463],{"class":455},[295,938,939],{"class":466},"notFound",[295,941,470],{"class":324},[295,943,473],{"class":455},[295,945,946],{"class":466},"objectId",[295,948,479],{"class":324},[295,950,492],{"class":491},[295,952,953],{"class":495},"NotFound",[295,955,492],{"class":491},[295,957,595],{"class":324},[295,959,473],{"class":455},[295,961,881],{"class":466},[295,963,964],{"class":324},"($",[295,966,967],{"class":451},"error",[295,969,654],{"class":324},[295,971,973],{"class":297,"line":972},33,[295,974,975],{"class":324},"    );\n",[295,977,979],{"class":297,"line":978},34,[295,980,442],{"emptyLinePlaceholder":441},[295,982,984,986,989,991,994,997,999,1002,1004,1006],{"class":297,"line":983},35,[295,985,448],{"class":324},[295,987,988],{"class":451},"document ",[295,990,456],{"class":455},[295,992,993],{"class":324}," $",[295,995,996],{"class":451},"document",[295,998,473],{"class":455},[295,1000,1001],{"class":466},"components",[295,1003,964],{"class":324},[295,1005,1001],{"class":451},[295,1007,1008],{"class":324},");\n",[1010,1011,1012,1020,1030],"ul",{},[1013,1014,1015,1016,1019],"li",{},"A schema's name is its first argument: ",[266,1017,1018],{},"Schema::object('Book')",".",[1013,1021,1022,1023,1026,1027,1019],{},"A parameter's first argument is its ",[266,1024,1025],{},"name","; the second is the component name: ",[266,1028,1029],{},"Parameter::path('book', 'BookId')",[1013,1031,1032,1033,1019],{},"A response shortcut is keyed by its status: rename it with ",[266,1034,1035],{},"objectId('NotFound')",[262,1037,1038,1039,1041,1042,1041,1044,1041,1046,1041,1049,1041,1051,1041,1054,1057,1058,1041,1061,1041,1064,1067,1068,1071,1072,1075],{},"The sections are ",[266,1040,535],{},", ",[266,1043,926],{},[266,1045,764],{},[266,1047,1048],{},"examples",[266,1050,842],{},[266,1052,1053],{},"headers",[266,1055,1056],{},"securitySchemes",",\n",[266,1059,1060],{},"links",[266,1062,1063],{},"callbacks",[266,1065,1066],{},"pathItems"," (3.1+) and ",[266,1069,1070],{},"mediaTypes"," (3.2), each with its ",[266,1073,1074],{},"add"," method.",[275,1077,1079],{"id":1078},"referring-to-a-component","Referring to a component",[262,1081,1082,1083,1085],{},"Each ",[266,1084,272],{}," builds the path of its section:",[1087,1088,1089,1102],"table",{},[1090,1091,1092],"thead",{},[1093,1094,1095,1099],"tr",{},[1096,1097,1098],"th",{},"Call",[1096,1100,1101],{},"Writes",[1103,1104,1105,1118,1130,1142,1154,1176],"tbody",{},[1093,1106,1107,1113],{},[1108,1109,1110],"td",{},[266,1111,1112],{},"Schema::ref('Book')",[1108,1114,1115],{},[266,1116,1117],{},"#\u002Fcomponents\u002Fschemas\u002FBook",[1093,1119,1120,1125],{},[1108,1121,1122],{},[266,1123,1124],{},"Response::ref('NotFound')",[1108,1126,1127],{},[266,1128,1129],{},"#\u002Fcomponents\u002Fresponses\u002FNotFound",[1093,1131,1132,1137],{},[1108,1133,1134],{},[266,1135,1136],{},"Parameter::ref('BookId')",[1108,1138,1139],{},[266,1140,1141],{},"#\u002Fcomponents\u002Fparameters\u002FBookId",[1093,1143,1144,1149],{},[1108,1145,1146],{},[266,1147,1148],{},"RequestBody::ref('Book')",[1108,1150,1151],{},[266,1152,1153],{},"#\u002Fcomponents\u002FrequestBodies\u002FBook",[1093,1155,1156,1173],{},[1108,1157,1158,1041,1161,1041,1164,1041,1167,1041,1170],{},[266,1159,1160],{},"Header::ref()",[266,1162,1163],{},"Example::ref()",[266,1165,1166],{},"Link::ref()",[266,1168,1169],{},"Callback::ref()",[266,1171,1172],{},"SecurityScheme::ref()",[1108,1174,1175],{},"their section",[1093,1177,1178,1183],{},[1108,1179,1180],{},[266,1181,1182],{},"MediaType::ref('BookJson', 'application\u002Fjson')",[1108,1184,1185,1188],{},[266,1186,1187],{},"#\u002Fcomponents\u002FmediaTypes\u002FBookJson"," (3.2)",[262,1190,1191,1192,1195,1196,1199,1200,1019],{},"A value containing ",[266,1193,1194],{},"#"," or ",[266,1197,1198],{},"\u002F"," is written as is, for an external file: ",[266,1201,1202],{},"Schema::ref('common.yaml#\u002FError')",[262,1204,1205],{},"When the reference sits in a map, its key is the second argument. A referenced response needs its status code:",[1207,1208,1211,1323],"example",{"input":1209,"output":1210},"Operation","toArray()",[1212,1213,1214],"template",{"v-slot:input":291},[286,1215,1217],{"className":288,"code":1216,"language":290,"meta":291,"style":291},"Operation::get()->responses(\n    Response::ok()->content(\n        MediaType::json()->schema(Schema::ref('Book')),\n    ),\n    Response::ref('NotFound', '404'),\n);\n",[266,1218,1219,1236,1254,1287,1292,1319],{"__ignoreMap":291},[295,1220,1221,1223,1225,1228,1230,1232,1234],{"class":297,"line":298},[295,1222,1209],{"class":459},[295,1224,463],{"class":455},[295,1226,1227],{"class":466},"get",[295,1229,470],{"class":324},[295,1231,473],{"class":455},[295,1233,926],{"class":466},[295,1235,538],{"class":324},[295,1237,1238,1241,1243,1246,1248,1250,1252],{"class":297,"line":328},[295,1239,1240],{"class":459},"    Response",[295,1242,463],{"class":455},[295,1244,1245],{"class":466},"ok",[295,1247,470],{"class":324},[295,1249,473],{"class":455},[295,1251,881],{"class":466},[295,1253,538],{"class":324},[295,1255,1256,1259,1261,1263,1265,1267,1269,1271,1273,1275,1277,1279,1281,1283,1285],{"class":297,"line":350},[295,1257,1258],{"class":459},"        MediaType",[295,1260,463],{"class":455},[295,1262,467],{"class":466},[295,1264,470],{"class":324},[295,1266,473],{"class":455},[295,1268,476],{"class":466},[295,1270,479],{"class":324},[295,1272,433],{"class":459},[295,1274,463],{"class":455},[295,1276,486],{"class":466},[295,1278,479],{"class":324},[295,1280,492],{"class":491},[295,1282,556],{"class":495},[295,1284,492],{"class":491},[295,1286,829],{"class":324},[295,1288,1289],{"class":297,"line":372},[295,1290,1291],{"class":324},"    ),\n",[295,1293,1294,1296,1298,1300,1302,1304,1306,1308,1310,1312,1315,1317],{"class":297,"line":394},[295,1295,1240],{"class":459},[295,1297,463],{"class":455},[295,1299,486],{"class":466},[295,1301,479],{"class":324},[295,1303,492],{"class":491},[295,1305,953],{"class":495},[295,1307,492],{"class":491},[295,1309,679],{"class":324},[295,1311,682],{"class":491},[295,1313,1314],{"class":495},"404",[295,1316,492],{"class":491},[295,1318,654],{"class":324},[295,1320,1321],{"class":297,"line":416},[295,1322,1008],{"class":324},[1212,1324,1325],{"v-slot:output":291},[286,1326,1329],{"className":1327,"code":1328,"language":467,"meta":291,"style":291},"language-json shiki shiki-themes material-theme-lighter github-light github-dark","{\n  \"responses\": {\n    \"200\": {\n      \"description\": \"OK\",\n      \"content\": {\n        \"application\u002Fjson\": {\n          \"schema\": { \"$ref\": \"#\u002Fcomponents\u002Fschemas\u002FBook\" }\n        }\n      }\n    },\n    \"404\": { \"$ref\": \"#\u002Fcomponents\u002Fresponses\u002FNotFound\" }\n  }\n}\n",[266,1330,1331,1336,1353,1367,1389,1401,1416,1450,1455,1460,1465,1493,1498],{"__ignoreMap":291},[295,1332,1333],{"class":297,"line":298},[295,1334,1335],{"class":324},"{\n",[295,1337,1338,1341,1344,1347,1350],{"class":297,"line":328},[295,1339,1340],{"class":309},"  \"",[295,1342,926],{"class":1343},"sseR_",[295,1345,1346],{"class":309},"\"",[295,1348,1349],{"class":324},":",[295,1351,1352],{"class":324}," {\n",[295,1354,1355,1358,1361,1363,1365],{"class":297,"line":350},[295,1356,1357],{"class":309},"    \"",[295,1359,1360],{"class":459},"200",[295,1362,1346],{"class":309},[295,1364,1349],{"class":324},[295,1366,1352],{"class":324},[295,1368,1369,1372,1375,1377,1379,1382,1385,1387],{"class":297,"line":372},[295,1370,1371],{"class":309},"      \"",[295,1373,1374],{"class":650},"description",[295,1376,1346],{"class":309},[295,1378,1349],{"class":324},[295,1380,1381],{"class":491}," \"",[295,1383,1384],{"class":495},"OK",[295,1386,1346],{"class":491},[295,1388,1057],{"class":324},[295,1390,1391,1393,1395,1397,1399],{"class":297,"line":394},[295,1392,1371],{"class":309},[295,1394,881],{"class":650},[295,1396,1346],{"class":309},[295,1398,1349],{"class":324},[295,1400,1352],{"class":324},[295,1402,1403,1406,1410,1412,1414],{"class":297,"line":416},[295,1404,1405],{"class":309},"        \"",[295,1407,1409],{"class":1408},"swQdS","application\u002Fjson",[295,1411,1346],{"class":309},[295,1413,1349],{"class":324},[295,1415,1352],{"class":324},[295,1417,1418,1421,1424,1426,1428,1431,1433,1437,1439,1441,1443,1445,1447],{"class":297,"line":438},[295,1419,1420],{"class":309},"          \"",[295,1422,476],{"class":1423},"sAQsV",[295,1425,1346],{"class":309},[295,1427,1349],{"class":324},[295,1429,1430],{"class":324}," {",[295,1432,1381],{"class":309},[295,1434,1436],{"class":1435},"sptTA","$ref",[295,1438,1346],{"class":309},[295,1440,1349],{"class":324},[295,1442,1381],{"class":491},[295,1444,1117],{"class":495},[295,1446,1346],{"class":491},[295,1448,1449],{"class":324}," }\n",[295,1451,1452],{"class":297,"line":445},[295,1453,1454],{"class":324},"        }\n",[295,1456,1457],{"class":297,"line":504},[295,1458,1459],{"class":324},"      }\n",[295,1461,1462],{"class":297,"line":29},[295,1463,1464],{"class":324},"    },\n",[295,1466,1467,1469,1471,1473,1475,1477,1479,1481,1483,1485,1487,1489,1491],{"class":297,"line":529},[295,1468,1357],{"class":309},[295,1470,1314],{"class":459},[295,1472,1346],{"class":309},[295,1474,1349],{"class":324},[295,1476,1430],{"class":324},[295,1478,1381],{"class":309},[295,1480,1436],{"class":650},[295,1482,1346],{"class":309},[295,1484,1349],{"class":324},[295,1486,1381],{"class":491},[295,1488,1129],{"class":495},[295,1490,1346],{"class":491},[295,1492,1449],{"class":324},[295,1494,1495],{"class":297,"line":541},[295,1496,1497],{"class":324},"  }\n",[295,1499,1500],{"class":297,"line":564},[295,1501,1502],{"class":324},"}\n",[262,1504,1505,1506,1509,1510,1019],{},"The same goes for a referenced schema used as a property: ",[266,1507,1508],{},"Schema::ref('User', 'owner')"," is the property ",[266,1511,1512],{},"owner",[275,1514,1516],{"id":1515},"schema-references-stay-schemas","Schema references stay schemas",[262,1518,1519,1522,1523,1525,1526,1057,1529,1041,1532,1535],{},[266,1520,1521],{},"Schema::ref()"," returns a ",[266,1524,433],{},", so you can chain what a referencing schema may carry: ",[266,1527,1528],{},"description()",[266,1530,1531],{},"readOnly()",[266,1533,1534],{},"nullable()","…",[1207,1537,1539,1590],{"input":433,"output":1538},"3.1.2 \u002F 3.0.4",[1212,1540,1541],{"v-slot:input":291},[286,1542,1544],{"className":288,"code":1543,"language":290,"meta":291,"style":291},"Schema::ref('User', 'owner')\n    ->description('Owner of the book');\n",[266,1545,1546,1573],{"__ignoreMap":291},[295,1547,1548,1550,1552,1554,1556,1558,1561,1563,1565,1567,1569,1571],{"class":297,"line":298},[295,1549,433],{"class":459},[295,1551,463],{"class":455},[295,1553,486],{"class":466},[295,1555,479],{"class":324},[295,1557,492],{"class":491},[295,1559,1560],{"class":495},"User",[295,1562,492],{"class":491},[295,1564,679],{"class":324},[295,1566,682],{"class":491},[295,1568,1512],{"class":495},[295,1570,492],{"class":491},[295,1572,561],{"class":324},[295,1574,1575,1577,1579,1581,1583,1586,1588],{"class":297,"line":328},[295,1576,532],{"class":455},[295,1578,1374],{"class":466},[295,1580,479],{"class":324},[295,1582,492],{"class":491},[295,1584,1585],{"class":495},"Owner of the book",[295,1587,492],{"class":491},[295,1589,1008],{"class":324},[1212,1591,1592],{"v-slot:output":291},[286,1593,1595],{"className":1327,"code":1594,"language":467,"meta":291,"style":291},"{ \"$ref\": \"#\u002Fcomponents\u002Fschemas\u002FUser\", \"description\": \"Owner of the book\" }\n\n{ \"description\": \"Owner of the book\", \"allOf\": [{ \"$ref\": \"#\u002Fcomponents\u002Fschemas\u002FUser\" }] }\n",[266,1596,1597,1635,1639],{"__ignoreMap":291},[295,1598,1599,1602,1604,1606,1608,1610,1612,1615,1617,1619,1621,1623,1625,1627,1629,1631,1633],{"class":297,"line":298},[295,1600,1601],{"class":324},"{",[295,1603,1381],{"class":309},[295,1605,1436],{"class":1343},[295,1607,1346],{"class":309},[295,1609,1349],{"class":324},[295,1611,1381],{"class":491},[295,1613,1614],{"class":495},"#\u002Fcomponents\u002Fschemas\u002FUser",[295,1616,1346],{"class":491},[295,1618,679],{"class":324},[295,1620,1381],{"class":309},[295,1622,1374],{"class":1343},[295,1624,1346],{"class":309},[295,1626,1349],{"class":324},[295,1628,1381],{"class":491},[295,1630,1585],{"class":495},[295,1632,1346],{"class":491},[295,1634,1449],{"class":324},[295,1636,1637],{"class":297,"line":328},[295,1638,442],{"emptyLinePlaceholder":441},[295,1640,1641,1643,1645,1647,1649,1651,1653,1655,1657,1659,1661,1664,1666,1668,1671,1673,1675,1677,1679,1681,1683,1685,1688],{"class":297,"line":350},[295,1642,1601],{"class":324},[295,1644,1381],{"class":309},[295,1646,1374],{"class":1343},[295,1648,1346],{"class":309},[295,1650,1349],{"class":324},[295,1652,1381],{"class":491},[295,1654,1585],{"class":495},[295,1656,1346],{"class":491},[295,1658,679],{"class":324},[295,1660,1381],{"class":309},[295,1662,1663],{"class":1343},"allOf",[295,1665,1346],{"class":309},[295,1667,1349],{"class":324},[295,1669,1670],{"class":324}," [{",[295,1672,1381],{"class":309},[295,1674,1436],{"class":459},[295,1676,1346],{"class":309},[295,1678,1349],{"class":324},[295,1680,1381],{"class":491},[295,1682,1614],{"class":495},[295,1684,1346],{"class":491},[295,1686,1687],{"class":324}," }]",[295,1689,1449],{"class":324},[262,1691,1692,1693,1695,1696,1698],{},"OpenAPI 3.0 ignores the siblings of a ",[266,1694,1436],{},", so the library wraps it in ",[266,1697,1663],{}," there.",[262,1700,1701,1702,1704,1705,1707,1708,1711,1712,1714],{},"The other ",[266,1703,272],{}," return a ",[266,1706,227],{},", which takes ",[266,1709,1710],{},"summary()"," and ",[266,1713,1528],{}," from OpenAPI 3.1.",[275,1716,1718],{"id":1717},"reference-objects","Reference objects",[262,1720,1721,1724,1725,1728],{},[266,1722,1723],{},"Reference::to()"," takes any reference; ",[266,1726,1727],{},"Reference::for()"," builds one from a component object, its class and objectId:",[286,1730,1732],{"className":288,"code":1731,"language":290,"meta":291,"style":291},"use Ark4ne\\OpenApiWriter\\Objects\\Reference;\n\n$notFound = Response::notFound()->objectId('NotFound');\n\n\u002F\u002F Both write #\u002Fcomponents\u002Fresponses\u002FNotFound\nReference::for($notFound);\nReference::to('#\u002Fcomponents\u002Fresponses\u002FNotFound', '404');\n",[266,1733,1734,1754,1758,1790,1794,1800,1815],{"__ignoreMap":291},[295,1735,1736,1738,1740,1742,1744,1746,1748,1750,1752],{"class":297,"line":298},[295,1737,302],{"class":301},[295,1739,306],{"class":305},[295,1741,310],{"class":309},[295,1743,313],{"class":305},[295,1745,310],{"class":309},[295,1747,233],{"class":305},[295,1749,310],{"class":309},[295,1751,227],{"class":305},[295,1753,325],{"class":324},[295,1755,1756],{"class":297,"line":328},[295,1757,442],{"emptyLinePlaceholder":441},[295,1759,1760,1762,1765,1767,1770,1772,1774,1776,1778,1780,1782,1784,1786,1788],{"class":297,"line":350},[295,1761,448],{"class":324},[295,1763,1764],{"class":451},"notFound ",[295,1766,456],{"class":455},[295,1768,1769],{"class":459}," Response",[295,1771,463],{"class":455},[295,1773,939],{"class":466},[295,1775,470],{"class":324},[295,1777,473],{"class":455},[295,1779,946],{"class":466},[295,1781,479],{"class":324},[295,1783,492],{"class":491},[295,1785,953],{"class":495},[295,1787,492],{"class":491},[295,1789,1008],{"class":324},[295,1791,1792],{"class":297,"line":372},[295,1793,442],{"emptyLinePlaceholder":441},[295,1795,1796],{"class":297,"line":394},[295,1797,1799],{"class":1798},"sutJx","\u002F\u002F Both write #\u002Fcomponents\u002Fresponses\u002FNotFound\n",[295,1801,1802,1804,1806,1809,1811,1813],{"class":297,"line":416},[295,1803,227],{"class":459},[295,1805,463],{"class":455},[295,1807,1808],{"class":466},"for",[295,1810,964],{"class":324},[295,1812,939],{"class":451},[295,1814,1008],{"class":324},[295,1816,1817,1819,1821,1824,1826,1828,1830,1832,1834,1836,1838,1840],{"class":297,"line":438},[295,1818,227],{"class":459},[295,1820,463],{"class":455},[295,1822,1823],{"class":466},"to",[295,1825,479],{"class":324},[295,1827,492],{"class":491},[295,1829,1129],{"class":495},[295,1831,492],{"class":491},[295,1833,679],{"class":324},[295,1835,682],{"class":491},[295,1837,1314],{"class":495},[295,1839,492],{"class":491},[295,1841,1008],{"class":324},[262,1843,1844,1845,1848,1849,1019],{},"The validator checks that every local reference resolves (",[266,1846,1847],{},"LocalReferencesRule","); see\n",[1850,1851,241],"a",{"href":242},[1853,1854,1855],"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 .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}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 .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}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 .sseR_, html code.shiki .sseR_{--shiki-light:#9C3EDA;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .swQdS, html code.shiki .swQdS{--shiki-light:#E53935;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sAQsV, html code.shiki .sAQsV{--shiki-light:#916B53;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sptTA, html code.shiki .sptTA{--shiki-light:#6182B8;--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}",{"title":291,"searchDepth":350,"depth":350,"links":1857},[1858,1859,1860,1861],{"id":277,"depth":328,"text":278},{"id":1078,"depth":328,"text":1079},{"id":1515,"depth":328,"text":1516},{"id":1717,"depth":328,"text":1718},"Declare reusable schemas, responses and parameters once, and refer to them by name.","md",{},"---\ntitle: Components and references\ndescription: Declare reusable schemas, responses and parameters once, and refer to them by name.\n---\n\nDeclare each reusable piece once in `Components`, under a name, then refer to it with `::ref()` wherever the\nspecification accepts a reference.\n\n## Declaring components\n\nEvery section of `Components` is a map: the objectId of each entry is the component name.\n\n```php\nuse Ark4ne\\OpenApiWriter\\Objects\\Components;\nuse Ark4ne\\OpenApiWriter\\Objects\\MediaType;\nuse Ark4ne\\OpenApiWriter\\Objects\\Parameter;\nuse Ark4ne\\OpenApiWriter\\Objects\\RequestBody;\nuse Ark4ne\\OpenApiWriter\\Objects\\Response;\nuse Ark4ne\\OpenApiWriter\\Objects\\Schema;\n\n$error = MediaType::json()->schema(Schema::ref('Error'));\n\n$components = Components::create()\n    ->schemas(\n        Schema::object('Book')\n            ->properties(\n                Schema::integer('id')->format('int64')->readOnly(),\n                Schema::string('title')->minLength(1),\n            )\n            ->required('id', 'title'),\n        Schema::object('Error')\n            ->properties(Schema::string('message'))\n            ->required('message'),\n    )\n    ->parameters(\n        Parameter::path('book', 'BookId')\n            ->schema(Schema::integer()->format('int64')),\n    )\n    ->requestBodies(\n        RequestBody::create('Book')\n            ->required()\n            ->content(MediaType::json()->schema(Schema::ref('Book'))),\n    )\n    ->responses(\n        Response::notFound()->objectId('NotFound')->content($error),\n    );\n\n$document = $document->components($components);\n```\n\n- A schema's name is its first argument: `Schema::object('Book')`.\n- A parameter's first argument is its `name`; the second is the component name: `Parameter::path('book', 'BookId')`.\n- A response shortcut is keyed by its status: rename it with `objectId('NotFound')`.\n\nThe sections are `schemas`, `responses`, `parameters`, `examples`, `requestBodies`, `headers`, `securitySchemes`,\n`links`, `callbacks`, `pathItems` (3.1+) and `mediaTypes` (3.2), each with its `add` method.\n\n## Referring to a component\n\nEach `::ref()` builds the path of its section:\n\n| Call | Writes |\n| --- | --- |\n| `Schema::ref('Book')` | `#\u002Fcomponents\u002Fschemas\u002FBook` |\n| `Response::ref('NotFound')` | `#\u002Fcomponents\u002Fresponses\u002FNotFound` |\n| `Parameter::ref('BookId')` | `#\u002Fcomponents\u002Fparameters\u002FBookId` |\n| `RequestBody::ref('Book')` | `#\u002Fcomponents\u002FrequestBodies\u002FBook` |\n| `Header::ref()`, `Example::ref()`, `Link::ref()`, `Callback::ref()`, `SecurityScheme::ref()` | their section |\n| `MediaType::ref('BookJson', 'application\u002Fjson')` | `#\u002Fcomponents\u002FmediaTypes\u002FBookJson` (3.2) |\n\nA value containing `#` or `\u002F` is written as is, for an external file: `Schema::ref('common.yaml#\u002FError')`.\n\nWhen the reference sits in a map, its key is the second argument. A referenced response needs its status code:\n\n::example{input=\"Operation\" output=\"toArray()\"}\n#input\n```php\nOperation::get()->responses(\n    Response::ok()->content(\n        MediaType::json()->schema(Schema::ref('Book')),\n    ),\n    Response::ref('NotFound', '404'),\n);\n```\n#output\n```json\n{\n  \"responses\": {\n    \"200\": {\n      \"description\": \"OK\",\n      \"content\": {\n        \"application\u002Fjson\": {\n          \"schema\": { \"$ref\": \"#\u002Fcomponents\u002Fschemas\u002FBook\" }\n        }\n      }\n    },\n    \"404\": { \"$ref\": \"#\u002Fcomponents\u002Fresponses\u002FNotFound\" }\n  }\n}\n```\n::\n\nThe same goes for a referenced schema used as a property: `Schema::ref('User', 'owner')` is the property `owner`.\n\n## Schema references stay schemas\n\n`Schema::ref()` returns a `Schema`, so you can chain what a referencing schema may carry: `description()`,\n`readOnly()`, `nullable()`…\n\n::example{input=\"Schema\" output=\"3.1.2 \u002F 3.0.4\"}\n#input\n```php\nSchema::ref('User', 'owner')\n    ->description('Owner of the book');\n```\n#output\n```json\n{ \"$ref\": \"#\u002Fcomponents\u002Fschemas\u002FUser\", \"description\": \"Owner of the book\" }\n\n{ \"description\": \"Owner of the book\", \"allOf\": [{ \"$ref\": \"#\u002Fcomponents\u002Fschemas\u002FUser\" }] }\n```\n::\n\nOpenAPI 3.0 ignores the siblings of a `$ref`, so the library wraps it in `allOf` there.\n\nThe other `::ref()` return a `Reference`, which takes `summary()` and `description()` from OpenAPI 3.1.\n\n## Reference objects\n\n`Reference::to()` takes any reference; `Reference::for()` builds one from a component object, its class and objectId:\n\n```php\nuse Ark4ne\\OpenApiWriter\\Objects\\Reference;\n\n$notFound = Response::notFound()->objectId('NotFound');\n\n\u002F\u002F Both write #\u002Fcomponents\u002Fresponses\u002FNotFound\nReference::for($notFound);\nReference::to('#\u002Fcomponents\u002Fresponses\u002FNotFound', '404');\n```\n\nThe validator checks that every local reference resolves (`LocalReferencesRule`); see\n[Validation rules](\u002Fopenapi-writer\u002Freference\u002Fvalidation-rules).\n",{"title":158,"description":1862},"AlFIjyudWplMDEWgw-w1dlSQtGvNx1p1OxPDN6CGR24",[1869,1871],{"title":154,"path":155,"stem":156,"description":1870,"children":-1},"Request bodies, media types, file uploads, responses, headers, examples and links.",{"title":162,"path":163,"stem":164,"description":1872,"children":-1},"Declare security schemes, require them for the whole API, and override them per operation.",1795438900760]