[{"data":1,"prerenderedAt":714},["ShallowReactive",2],{"libs":3,"navigation-laravel-openapi-generator":115,"\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fhow-it-works":296,"\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fhow-it-works-surround":709},[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,191,213,243,258,284],{"title":117,"since":118,"experimental":119,"icon":120,"path":121,"stem":122,"children":123,"page":119},"Getting started",null,false,"i-lucide-rocket","\u002Flaravel-openapi-generator\u002Fgetting-started","laravel-openapi-generator\u002F1.getting-started",[124,127,131],{"title":125,"path":92,"stem":126,"since":118,"experimental":119},"Introduction","laravel-openapi-generator\u002F1.getting-started\u002F1.introduction",{"title":128,"path":129,"stem":130,"since":118,"experimental":119},"Installation","\u002Flaravel-openapi-generator\u002Fgetting-started\u002Finstallation","laravel-openapi-generator\u002F1.getting-started\u002F2.installation",{"title":132,"path":133,"stem":134,"since":118,"experimental":119},"Quick start","\u002Flaravel-openapi-generator\u002Fgetting-started\u002Fquick-start","laravel-openapi-generator\u002F1.getting-started\u002F3.quick-start",{"title":136,"since":118,"experimental":119,"icon":137,"path":138,"stem":139,"children":140,"page":119},"Documenting endpoints","i-lucide-route","\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints","laravel-openapi-generator\u002F2.documenting-endpoints",[141,145,149,153,157,161,165],{"title":142,"path":143,"stem":144,"since":118,"experimental":119},"How it works","\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fhow-it-works","laravel-openapi-generator\u002F2.documenting-endpoints\u002F1.how-it-works",{"title":146,"path":147,"stem":148,"since":118,"experimental":119},"Routes & operations","\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Froutes-and-operations","laravel-openapi-generator\u002F2.documenting-endpoints\u002F2.routes-and-operations",{"title":150,"path":151,"stem":152,"since":118,"experimental":119},"Requests","\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Frequests","laravel-openapi-generator\u002F2.documenting-endpoints\u002F3.requests",{"title":154,"path":155,"stem":156,"since":118,"experimental":119},"Responses","\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fresponses","laravel-openapi-generator\u002F2.documenting-endpoints\u002F4.responses",{"title":158,"path":159,"stem":160,"since":118,"experimental":119},"Sampling","\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fsampling","laravel-openapi-generator\u002F2.documenting-endpoints\u002F5.sampling",{"title":162,"path":163,"stem":164,"since":118,"experimental":119},"Security & errors","\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fsecurity-and-errors","laravel-openapi-generator\u002F2.documenting-endpoints\u002F6.security-and-errors",{"title":166,"path":167,"stem":168,"since":118,"experimental":119},"Webhooks & callbacks","\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fwebhooks-and-callbacks","laravel-openapi-generator\u002F2.documenting-endpoints\u002F7.webhooks-and-callbacks",{"title":170,"since":118,"experimental":119,"icon":171,"path":172,"stem":173,"children":174,"page":119},"Documents","i-lucide-files","\u002Flaravel-openapi-generator\u002Fdocuments","laravel-openapi-generator\u002F3.documents",[175,179,183,187],{"title":176,"path":177,"stem":178,"since":118,"experimental":119},"Configuring a document","\u002Flaravel-openapi-generator\u002Fdocuments\u002Fconfiguring-a-document","laravel-openapi-generator\u002F3.documents\u002F1.configuring-a-document",{"title":180,"path":181,"stem":182,"since":118,"experimental":119},"Several documents","\u002Flaravel-openapi-generator\u002Fdocuments\u002Fseveral-documents","laravel-openapi-generator\u002F3.documents\u002F2.several-documents",{"title":184,"path":185,"stem":186,"since":118,"experimental":119},"Output","\u002Flaravel-openapi-generator\u002Fdocuments\u002Foutput","laravel-openapi-generator\u002F3.documents\u002F3.output",{"title":188,"path":189,"stem":190,"since":118,"experimental":119},"Translations","\u002Flaravel-openapi-generator\u002Fdocuments\u002Ftranslations","laravel-openapi-generator\u002F3.documents\u002F4.translations",{"title":192,"since":118,"experimental":119,"icon":193,"path":194,"stem":195,"children":196,"page":119},"Workflow","i-lucide-terminal","\u002Flaravel-openapi-generator\u002Fworkflow","laravel-openapi-generator\u002F4.workflow",[197,201,205,209],{"title":198,"path":199,"stem":200,"since":118,"experimental":119},"Diagnostics","\u002Flaravel-openapi-generator\u002Fworkflow\u002Fdiagnostics","laravel-openapi-generator\u002F4.workflow\u002F1.diagnostics",{"title":202,"path":203,"stem":204,"since":118,"experimental":119},"Continuous integration","\u002Flaravel-openapi-generator\u002Fworkflow\u002Fcontinuous-integration","laravel-openapi-generator\u002F4.workflow\u002F2.continuous-integration",{"title":206,"path":207,"stem":208,"since":118,"experimental":119},"Troubleshooting","\u002Flaravel-openapi-generator\u002Fworkflow\u002Ftroubleshooting","laravel-openapi-generator\u002F4.workflow\u002F3.troubleshooting",{"title":210,"path":211,"stem":212,"since":118,"experimental":119},"Agent skills","\u002Flaravel-openapi-generator\u002Fworkflow\u002Fagent-skills","laravel-openapi-generator\u002F4.workflow\u002F4.agent-skills",{"title":214,"since":118,"experimental":119,"icon":215,"path":216,"stem":217,"children":218,"page":119},"Extending","i-lucide-puzzle","\u002Flaravel-openapi-generator\u002Fextending","laravel-openapi-generator\u002F5.extending",[219,223,227,231,235,239],{"title":220,"path":221,"stem":222,"since":118,"experimental":119},"Overview","\u002Flaravel-openapi-generator\u002Fextending\u002Foverview","laravel-openapi-generator\u002F5.extending\u002F1.overview",{"title":224,"path":225,"stem":226,"since":118,"experimental":119},"Rule mappers","\u002Flaravel-openapi-generator\u002Fextending\u002Frule-mappers","laravel-openapi-generator\u002F5.extending\u002F2.rule-mappers",{"title":228,"path":229,"stem":230,"since":118,"experimental":119},"Request & response extractors","\u002Flaravel-openapi-generator\u002Fextending\u002Frequest-and-response-extractors","laravel-openapi-generator\u002F5.extending\u002F3.request-and-response-extractors",{"title":232,"path":233,"stem":234,"since":118,"experimental":119},"Operations & strategies","\u002Flaravel-openapi-generator\u002Fextending\u002Foperations-and-strategies","laravel-openapi-generator\u002F5.extending\u002F4.operations-and-strategies",{"title":236,"path":237,"stem":238,"since":118,"experimental":119},"Samplers","\u002Flaravel-openapi-generator\u002Fextending\u002Fsamplers","laravel-openapi-generator\u002F5.extending\u002F5.samplers",{"title":240,"path":241,"stem":242,"since":118,"experimental":119},"Passes & middlewares","\u002Flaravel-openapi-generator\u002Fextending\u002Fpasses-and-middlewares","laravel-openapi-generator\u002F5.extending\u002F6.passes-and-middlewares",{"title":244,"since":118,"experimental":119,"icon":245,"path":246,"stem":247,"children":248,"page":119},"Integrations","i-lucide-plug","\u002Flaravel-openapi-generator\u002Fintegrations","laravel-openapi-generator\u002F6.integrations",[249,253],{"title":250,"path":251,"stem":252,"since":118,"experimental":119},"JSON:API","\u002Flaravel-openapi-generator\u002Fintegrations\u002Fjson-api","laravel-openapi-generator\u002F6.integrations\u002F1.json-api",{"title":254,"path":255,"stem":256,"since":257,"experimental":119},"API revisions","\u002Flaravel-openapi-generator\u002Fintegrations\u002Fapi-revisions","laravel-openapi-generator\u002F6.integrations\u002F2.api-revisions","1.2",{"title":259,"since":118,"experimental":119,"icon":260,"path":261,"stem":262,"children":263,"page":119},"Reference","i-lucide-library","\u002Flaravel-openapi-generator\u002Freference","laravel-openapi-generator\u002F7.reference",[264,268,272,276,280],{"title":265,"path":266,"stem":267,"since":118,"experimental":119},"Configuration","\u002Flaravel-openapi-generator\u002Freference\u002Fconfiguration","laravel-openapi-generator\u002F7.reference\u002F1.configuration",{"title":269,"path":270,"stem":271,"since":118,"experimental":119},"Attributes","\u002Flaravel-openapi-generator\u002Freference\u002Fattributes","laravel-openapi-generator\u002F7.reference\u002F2.attributes",{"title":273,"path":274,"stem":275,"since":118,"experimental":119},"Commands","\u002Flaravel-openapi-generator\u002Freference\u002Fcommands","laravel-openapi-generator\u002F7.reference\u002F3.commands",{"title":277,"path":278,"stem":279,"since":118,"experimental":119},"Validation rules","\u002Flaravel-openapi-generator\u002Freference\u002Fvalidation-rules","laravel-openapi-generator\u002F7.reference\u002F4.validation-rules",{"title":281,"path":282,"stem":283,"since":118,"experimental":119},"PHPDoc types","\u002Flaravel-openapi-generator\u002Freference\u002Fphpdoc-types","laravel-openapi-generator\u002F7.reference\u002F5.phpdoc-types",{"title":285,"path":286,"children":287},"Releases","\u002Flaravel-openapi-generator\u002Freleases",[288,292],{"title":289,"path":290,"stem":291,"since":118,"experimental":119},"Upgrade guide","\u002Flaravel-openapi-generator\u002Fupgrade","laravel-openapi-generator\u002FUPGRADE",{"title":293,"path":294,"stem":295,"since":118,"experimental":119},"Changelog","\u002Flaravel-openapi-generator\u002Fchangelog","laravel-openapi-generator\u002FCHANGELOG",{"id":297,"title":142,"body":298,"description":702,"experimental":119,"extension":703,"links":118,"meta":704,"navigation":705,"path":143,"rawbody":706,"seo":707,"since":118,"stem":144,"__hash__":708},"laravel_openapi_generator\u002Flaravel-openapi-generator\u002F2.documenting-endpoints\u002F1.how-it-works.md",{"type":299,"value":300,"toc":695},"minimark",[301,314,319,323,383,387,475,479,486,594,615,619,670,674,691],[302,303,304,305,309,310,313],"p",{},"The generator does not parse annotations: it ",[306,307,308],"strong",{},"observes"," the application. It collects the routes, builds one\noperation per route and method from what the code declares, runs the resources on sampled models, completes the\ndocument (security, errors, components), and hands it to ",[311,312,105],"a",{"href":114},", which writes it in the\nOpenAPI version of the document.",[315,316,318],"h2",{"id":317},"from-the-routes-to-the-document","From the routes to the document",[320,321],"mermaid-diagram",{"caption":318,"svg":322},"\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" class=\"mermaid mermaid-sequence\" viewBox=\"-50 -10 1051 490\" width=\"100%\" role=\"img\" aria-roledescription=\"sequence\" data-mermaid-version=\"13.0.0-alpha.3\" style=\"max-width:1051px;--_ab:var(--mermaid-actorBkg,var(--_mb));--_mb:var(--mermaid-mainBkg,var(--_p));--_p:var(--mermaid-primaryColor,#fff4dd);--_ar:var(--mermaid-actorBorder,var(--_nb));--_nb:var(--mermaid-nodeBorder,var(--_pb));--_pb:var(--mermaid-primaryBorderColor,color-mix(in srgb,var(--_p) 85%,black));--_sw:var(--mermaid-strokeWidth,1px);--_at:var(--mermaid-actorTextColor,var(--_pt));--_pt:var(--mermaid-primaryTextColor,#333333);--_alc:var(--mermaid-actorLineColor,var(--_ar));--_sc:var(--mermaid-signalColor,var(--_tx));--_tx:var(--mermaid-textColor,var(--_pt));--_stc:var(--mermaid-signalTextColor,var(--_tx));--_nk:var(--mermaid-noteBkgColor,#fff5ad);--_no:var(--mermaid-noteBorderColor,color-mix(in srgb,var(--_nk) 70%,black));--_nx:var(--mermaid-noteTextColor,color(from color(from var(--_nk) 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)));--_ff:var(--mermaid-fontFamily,&quot;trebuchet ms&quot;, verdana, arial, sans-serif);--_fs:var(--mermaid-fontSize,16px)\" font-family=\"var(--_ff)\" font-size=\"var(--_fs)\">\u003Cg class=\"participants\">\u003Cg class=\"participant participant-participant\" data-id=\"Routes\" data-ast=\"p:Routes\">\u003Cline class=\"actor-line\" data-id=\"Routes\" x1=\"75\" y1=\"65\" x2=\"75\" y2=\"479.34\" stroke=\"var(--_alc)\" stroke-width=\"2\"\u002F>\u003Cg class=\"actor-top\" data-id=\"Routes\">\u003Crect class=\"actor\" fill=\"var(--_ab)\" stroke=\"var(--_ar)\" stroke-width=\"var(--_sw)\" x=\"0\" y=\"0\" width=\"150\" height=\"65\" rx=\"3\" ry=\"3\"\u002F>\u003Ctext class=\"actor actor-box\" data-id=\"Routes\" fill=\"var(--_at)\" x=\"75\" y=\"38.24\" text-anchor=\"middle\">Routes\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"participant participant-participant\" data-id=\"Operations\" data-ast=\"p:Operations\">\u003Cline class=\"actor-line\" data-id=\"Operations\" x1=\"275\" y1=\"65\" x2=\"275\" y2=\"479.34\" stroke=\"var(--_alc)\" stroke-width=\"2\"\u002F>\u003Cg class=\"actor-top\" data-id=\"Operations\">\u003Crect class=\"actor\" fill=\"var(--_ab)\" stroke=\"var(--_ar)\" stroke-width=\"var(--_sw)\" x=\"200\" y=\"0\" width=\"150\" height=\"65\" rx=\"3\" ry=\"3\"\u002F>\u003Ctext class=\"actor actor-box\" data-id=\"Operations\" fill=\"var(--_at)\" x=\"275\" y=\"38.24\" text-anchor=\"middle\">Operations\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"participant participant-participant\" data-id=\"Samples\" data-ast=\"p:Samples\">\u003Cline class=\"actor-line\" data-id=\"Samples\" x1=\"475\" y1=\"65\" x2=\"475\" y2=\"479.34\" stroke=\"var(--_alc)\" stroke-width=\"2\"\u002F>\u003Cg class=\"actor-top\" data-id=\"Samples\">\u003Crect class=\"actor\" fill=\"var(--_ab)\" stroke=\"var(--_ar)\" stroke-width=\"var(--_sw)\" x=\"400\" y=\"0\" width=\"150\" height=\"65\" rx=\"3\" ry=\"3\"\u002F>\u003Ctext class=\"actor actor-box\" data-id=\"Samples\" fill=\"var(--_at)\" x=\"475\" y=\"38.24\" text-anchor=\"middle\">Samples\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"participant participant-participant\" data-id=\"Passes\" data-ast=\"p:Passes\">\u003Cline class=\"actor-line\" data-id=\"Passes\" x1=\"675\" y1=\"65\" x2=\"675\" y2=\"479.34\" stroke=\"var(--_alc)\" stroke-width=\"2\"\u002F>\u003Cg class=\"actor-top\" data-id=\"Passes\">\u003Crect class=\"actor\" fill=\"var(--_ab)\" stroke=\"var(--_ar)\" stroke-width=\"var(--_sw)\" x=\"600\" y=\"0\" width=\"150\" height=\"65\" rx=\"3\" ry=\"3\"\u002F>\u003Ctext class=\"actor actor-box\" data-id=\"Passes\" fill=\"var(--_at)\" x=\"675\" y=\"38.24\" text-anchor=\"middle\">Passes\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"participant participant-participant\" data-id=\"Writer\" data-ast=\"p:Writer\">\u003Cline class=\"actor-line\" data-id=\"Writer\" x1=\"875\" y1=\"65\" x2=\"875\" y2=\"479.34\" stroke=\"var(--_alc)\" stroke-width=\"2\"\u002F>\u003Cg class=\"actor-top\" data-id=\"Writer\">\u003Crect class=\"actor\" fill=\"var(--_ab)\" stroke=\"var(--_ar)\" stroke-width=\"var(--_sw)\" x=\"800\" y=\"0\" width=\"150\" height=\"65\" rx=\"3\" ry=\"3\"\u002F>\u003Ctext class=\"actor actor-box\" data-id=\"Writer\" fill=\"var(--_at)\" x=\"875\" y=\"38.24\" text-anchor=\"middle\">Writer\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"notes\">\u003Cg class=\"note-over\" data-id=\"note:1\" data-ast=\"note:1\">\u003Crect class=\"note\" x=\"0\" y=\"75\" width=\"150\" height=\"57.15\" fill=\"var(--_nk)\" stroke=\"var(--_no)\"\u002F>\u003Ctext class=\"noteText\" data-id=\"note:1\" fill=\"var(--_nx)\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"75\" y=\"100.02\">include\u003C\u002Ftspan>\u003Ctspan x=\"75\" y=\"118.6\">exclude\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"note-over\" data-id=\"note:2\" data-ast=\"note:2\">\u003Crect class=\"note\" x=\"193.88\" y=\"152.15\" width=\"162.24\" height=\"75.73\" fill=\"var(--_nk)\" stroke=\"var(--_no)\"\u002F>\u003Ctext class=\"noteText\" data-id=\"note:2\" fill=\"var(--_nx)\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"275\" y=\"177.18\">PHPDoc, attributes,\u003C\u002Ftspan>\u003Ctspan x=\"275\" y=\"195.75\">form request,\u003C\u002Ftspan>\u003Ctspan x=\"275\" y=\"214.33\">return type\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"note-over\" data-id=\"note:3\" data-ast=\"note:3\">\u003Crect class=\"note\" x=\"396.46\" y=\"247.88\" width=\"157.09\" height=\"57.15\" fill=\"var(--_nk)\" stroke=\"var(--_no)\"\u002F>\u003Ctext class=\"noteText\" data-id=\"note:3\" fill=\"var(--_nx)\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"475\" y=\"272.9\">resources run\u003C\u002Ftspan>\u003Ctspan x=\"475\" y=\"291.48\">on sampled models\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"note-over\" data-id=\"note:4\" data-ast=\"note:4\">\u003Crect class=\"note\" x=\"600\" y=\"325.03\" width=\"150\" height=\"57.15\" fill=\"var(--_nk)\" stroke=\"var(--_no)\"\u002F>\u003Ctext class=\"noteText\" data-id=\"note:4\" fill=\"var(--_nx)\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"675\" y=\"350.06\">security, errors,\u003C\u002Ftspan>\u003Ctspan x=\"675\" y=\"368.63\">components, tags\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003Cg class=\"note-over\" data-id=\"note:5\" data-ast=\"note:5\">\u003Crect class=\"note\" x=\"799.85\" y=\"402.18\" width=\"150.3\" height=\"57.15\" fill=\"var(--_nk)\" stroke=\"var(--_no)\"\u002F>\u003Ctext class=\"noteText\" data-id=\"note:5\" fill=\"var(--_nx)\" text-anchor=\"middle\" xml:space=\"preserve\">\u003Ctspan x=\"875\" y=\"427.21\">3.0 \u002F 3.1 \u002F 3.2,\u003C\u002Ftspan>\u003Ctspan x=\"875\" y=\"445.78\">validated, written\u003C\u002Ftspan>\u003C\u002Ftext>\u003C\u002Fg>\u003C\u002Fg>\u003Cg class=\"messages\">\u003Cg class=\"message\" data-id=\"m:Routes&gt;Operations\" data-ast=\"m:Routes&gt;Operations\">\u003Cline class=\"messageLine0\" fill=\"none\" stroke=\"var(--_sc)\" stroke-width=\"1.5\" x1=\"76\" y1=\"142.15\" x2=\"271\" y2=\"142.15\"\u002F>\u003Cpolygon class=\"arrowhead\" points=\"262.1,137.15 273.1,142.15 263.1,147.15\" fill=\"var(--_sc)\" stroke=\"var(--_sc)\" stroke-width=\"1\"\u002F>\u003C\u002Fg>\u003Cg class=\"message\" data-id=\"m:Operations&gt;Samples\" data-ast=\"m:Operations&gt;Samples\">\u003Cline class=\"messageLine0\" fill=\"none\" stroke=\"var(--_sc)\" stroke-width=\"1.5\" x1=\"276\" y1=\"237.88\" x2=\"471\" y2=\"237.88\"\u002F>\u003Cpolygon class=\"arrowhead\" points=\"462.1,232.88 473.1,237.88 463.1,242.88\" fill=\"var(--_sc)\" stroke=\"var(--_sc)\" stroke-width=\"1\"\u002F>\u003C\u002Fg>\u003Cg class=\"message\" data-id=\"m:Samples&gt;Passes\" data-ast=\"m:Samples&gt;Passes\">\u003Cline class=\"messageLine0\" fill=\"none\" stroke=\"var(--_sc)\" stroke-width=\"1.5\" x1=\"476\" y1=\"315.03\" x2=\"671\" y2=\"315.03\"\u002F>\u003Cpolygon class=\"arrowhead\" points=\"662.1,310.03 673.1,315.03 663.1,320.03\" fill=\"var(--_sc)\" stroke=\"var(--_sc)\" stroke-width=\"1\"\u002F>\u003C\u002Fg>\u003Cg class=\"message\" data-id=\"m:Passes&gt;Writer\" data-ast=\"m:Passes&gt;Writer\">\u003Cline class=\"messageLine0\" fill=\"none\" stroke=\"var(--_sc)\" stroke-width=\"1.5\" x1=\"676\" y1=\"392.18\" x2=\"871\" y2=\"392.18\"\u002F>\u003Cpolygon class=\"arrowhead\" points=\"862.1,387.18 873.1,392.18 863.1,397.18\" fill=\"var(--_sc)\" stroke=\"var(--_sc)\" stroke-width=\"1\"\u002F>\u003C\u002Fg>\u003C\u002Fg>\u003C\u002Fsvg>",[324,325,326,345,351,363,373],"ol",{},[327,328,329,332,333,337,338,341,342,344],"li",{},[306,330,331],{},"Routes."," Every route matching ",[334,335,336],"code",{},"routes.include"," and not ",[334,339,340],{},"routes.exclude"," of the document is collected, one\noperation per HTTP method. See ",[311,343,146],{"href":147},".",[327,346,347,350],{},[306,348,349],{},"Operations."," The PHPDoc and the attributes give the metadata; the form request and its rules give the parameters\nand the body; the return type gives the responses.",[327,352,353,356,357,360,361,344],{},[306,354,355],{},"Samples."," Each resource is described by running ",[334,358,359],{},"toArray()"," on a sampled model. See\n",[311,362,158],{"href":159},[327,364,365,368,369,372],{},[306,366,367],{},"Passes."," Changes over the whole document: the security and the error responses of the middlewares, the 404 of the\nbound models, the 422 of the validation, the responses of the ",[334,370,371],{},"@throws",", the shared components.",[327,374,375,378,379,382],{},[306,376,377],{},"Writing."," The writer converts what the version of the document needs (",[334,380,381],{},"nullable"," in 3.0, webhooks from 3.1…), and\nthe document is validated before it is written.",[315,384,386],{"id":385},"what-is-inferred","What is inferred",[388,389,390,403],"table",{},[391,392,393],"thead",{},[394,395,396,400],"tr",{},[397,398,399],"th",{},"Source",[397,401,402],{},"Gives",[404,405,406,419,436,452,464],"tbody",{},[394,407,408,416],{},[409,410,411,412,415],"td",{},"The route: URI, methods, name, domain, middlewares, ",[334,413,414],{},"where"," constraints",[409,417,418],{},"the path and its parameters, the operation id, the servers of a domain, the security and the 401, 403, 419 and 429 of the middlewares",[394,420,421,424],{},[409,422,423],{},"The PHPDoc of the action",[409,425,426,427,430,431,430,433],{},"the summary (first line), the description (the rest, CommonMark), ",[334,428,429],{},"@deprecated",", ",[334,432,371],{},[334,434,435],{},"@return",[394,437,438,441],{},[409,439,440],{},"The parameters of the action",[409,442,443,444,447,448,451],{},"the form request and its ",[334,445,446],{},"rules()",", the types of the path parameters (",[334,449,450],{},"int",", a bound model and its 404, a backed enum)",[394,453,454,457],{},[409,455,456],{},"The return type",[409,458,459,460,463],{},"the responses: resources, collections, paginators, ",[334,461,462],{},"JsonResponse",", models, array shapes, files, streams, redirects",[394,465,466,469],{},[409,467,468],{},"The resources",[409,470,471,472,474],{},"their schema, from ",[334,473,359],{}," run on sampled models",[315,476,478],{"id":477},"what-you-declare","What you declare",[302,480,481,482,485],{},"What the code cannot tell is declared with PHP attributes, in ",[334,483,484],{},"Ark4ne\\OpenApi\\Attributes",", never with PHPDoc tags:",[487,488,493],"pre",{"className":489,"code":490,"language":491,"meta":492,"style":492},"language-php shiki shiki-themes material-theme-lighter github-light github-dark","#[Response(\n    200,\n    resource: BookResource::class,\n    paginator: LengthAwarePaginator::class,\n)]\npublic function index(): AnonymousResourceCollection\n","php","",[334,494,495,512,522,546,563,572],{"__ignoreMap":492},[496,497,500,504,508],"span",{"class":498,"line":499},"line",1,[496,501,503],{"class":502},"su5hD","#[",[496,505,507],{"class":506},"s_hVV","Response",[496,509,511],{"class":510},"sP7_E","(\n",[496,513,515,519],{"class":498,"line":514},2,[496,516,518],{"class":517},"srdBf","    200",[496,520,521],{"class":510},",\n",[496,523,525,529,532,536,540,544],{"class":498,"line":524},3,[496,526,528],{"class":527},"sbgvK","    resource",[496,530,531],{"class":510},":",[496,533,535],{"class":534},"sZMiF"," BookResource",[496,537,539],{"class":538},"smGrS","::",[496,541,543],{"class":542},"sw1J6","class",[496,545,521],{"class":510},[496,547,549,552,554,557,559,561],{"class":498,"line":548},4,[496,550,551],{"class":527},"    paginator",[496,553,531],{"class":510},[496,555,556],{"class":534}," LengthAwarePaginator",[496,558,539],{"class":538},[496,560,543],{"class":542},[496,562,521],{"class":510},[496,564,566,569],{"class":498,"line":565},5,[496,567,568],{"class":510},")",[496,570,571],{"class":502},"]\n",[496,573,575,579,582,586,589,591],{"class":498,"line":574},6,[496,576,578],{"class":577},"sbsja","public",[496,580,581],{"class":577}," function",[496,583,585],{"class":584},"sGLFI"," index",[496,587,588],{"class":510},"()",[496,590,531],{"class":538},[496,592,593],{"class":534}," AnonymousResourceCollection\n",[302,595,596,597,604,605,611,612,344],{},"The return type says ",[598,599,600,601],"em",{},"a collection of ",[334,602,603],{},"BookResource","; it cannot say ",[598,606,607,608],{},"paginated by a ",[334,609,610],{},"LengthAwarePaginator",". The\nattribute does. Every attribute is listed in the ",[311,613,614],{"href":270},"attributes reference",[315,616,618],{"id":617},"which-one-wins","Which one wins",[620,621,622,637,652,663],"ul",{},[327,623,624,625,628,629,632,633,636],{},"An ",[306,626,627],{},"attribute"," replaces what is inferred for the same thing: ",[334,630,631],{},"#[Operation(summary: …)]"," over the PHPDoc,\n",[334,634,635],{},"#[Response(201)]"," over the response inferred for 201.",[327,638,639,640,643,644,647,648,651],{},"An attribute on the ",[306,641,642],{},"controller class"," applies to each of its actions; one on the ",[306,645,646],{},"action"," overrides it\n(",[334,649,650],{},"#[Response]"," status by status, the parameters name by name).",[327,653,654,655,658,659,662],{},"The attributes of a ",[306,656,657],{},"parent class"," or a ",[306,660,661],{},"parent method"," are merged under those of the child.",[327,664,665,666,669],{},"The PHPDoc and the attributes win over the ",[306,667,668],{},"naming strategies"," of the configuration (summary, tags, operation id).",[315,671,673],{"id":672},"when-the-generator-does-not-understand","When the generator does not understand",[302,675,676,677,680,681,684,685,688,689,344],{},"The generator never fails on application code it does not understand: it leaves the part out and records a\n",[306,678,679],{},"diagnostic"," (an info, a warning or an error), grouped by route. Read them with ",[334,682,683],{},"openapi:generate -v"," or\n",[334,686,687],{},"openapi:inspect \u003Croute>",", fix the cause in the code, and never edit the generated file: every run rewrites it. See\n",[311,690,198],{"href":199},[692,693,694],"style",{},"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 .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--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 .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--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 .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sw1J6, html code.shiki .sw1J6{--shiki-light:#F76D47;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}",{"title":492,"searchDepth":524,"depth":524,"links":696},[697,698,699,700,701],{"id":317,"depth":514,"text":318},{"id":385,"depth":514,"text":386},{"id":477,"depth":514,"text":478},{"id":617,"depth":514,"text":618},{"id":672,"depth":514,"text":673},"What the generator reads in your application, in which order, and where attributes take over.","md",{},true,"---\ntitle: How it works\ndescription: What the generator reads in your application, in which order, and where attributes take over.\n---\n\nThe generator does not parse annotations: it **observes** the application. It collects the routes, builds one\noperation per route and method from what the code declares, runs the resources on sampled models, completes the\ndocument (security, errors, components), and hands it to [OpenAPI Writer](\u002Fopenapi-writer), which writes it in the\nOpenAPI version of the document.\n\n## From the routes to the document\n\n```mermaid [From the routes to the document]\n---\nconfig:\n  sequence:\n    mirrorActors: false\n---\nsequenceDiagram\n  participant Routes\n  participant Operations\n  participant Samples\n  participant Passes\n  participant Writer\n  Note over Routes: include\u003Cbr\u002F>exclude\n  Routes->>Operations: \n  Note over Operations: PHPDoc, attributes,\u003Cbr\u002F>form request,\u003Cbr\u002F>return type\n  Operations->>Samples: \n  Note over Samples: resources run\u003Cbr\u002F>on sampled models\n  Samples->>Passes: \n  Note over Passes: security, errors,\u003Cbr\u002F>components, tags\n  Passes->>Writer: \n  Note over Writer: 3.0 \u002F 3.1 \u002F 3.2,\u003Cbr\u002F>validated, written\n```\n\n1. **Routes.** Every route matching `routes.include` and not `routes.exclude` of the document is collected, one\n   operation per HTTP method. See [Routes & operations](\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Froutes-and-operations).\n2. **Operations.** The PHPDoc and the attributes give the metadata; the form request and its rules give the parameters\n   and the body; the return type gives the responses.\n3. **Samples.** Each resource is described by running `toArray()` on a sampled model. See\n   [Sampling](\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fsampling).\n4. **Passes.** Changes over the whole document: the security and the error responses of the middlewares, the 404 of the\n   bound models, the 422 of the validation, the responses of the `@throws`, the shared components.\n5. **Writing.** The writer converts what the version of the document needs (`nullable` in 3.0, webhooks from 3.1…), and\n   the document is validated before it is written.\n\n## What is inferred\n\n| Source | Gives |\n| --- | --- |\n| The route: URI, methods, name, domain, middlewares, `where` constraints | the path and its parameters, the operation id, the servers of a domain, the security and the 401, 403, 419 and 429 of the middlewares |\n| The PHPDoc of the action | the summary (first line), the description (the rest, CommonMark), `@deprecated`, `@throws`, `@return` |\n| The parameters of the action | the form request and its `rules()`, the types of the path parameters (`int`, a bound model and its 404, a backed enum) |\n| The return type | the responses: resources, collections, paginators, `JsonResponse`, models, array shapes, files, streams, redirects |\n| The resources | their schema, from `toArray()` run on sampled models |\n\n## What you declare\n\nWhat the code cannot tell is declared with PHP attributes, in `Ark4ne\\OpenApi\\Attributes`, never with PHPDoc tags:\n\n```php\n#[Response(\n    200,\n    resource: BookResource::class,\n    paginator: LengthAwarePaginator::class,\n)]\npublic function index(): AnonymousResourceCollection\n```\n\nThe return type says *a collection of `BookResource`*; it cannot say *paginated by a `LengthAwarePaginator`*. The\nattribute does. Every attribute is listed in the [attributes reference](\u002Flaravel-openapi-generator\u002Freference\u002Fattributes).\n\n## Which one wins\n\n- An **attribute** replaces what is inferred for the same thing: `#[Operation(summary: …)]` over the PHPDoc,\n  `#[Response(201)]` over the response inferred for 201.\n- An attribute on the **controller class** applies to each of its actions; one on the **action** overrides it\n  (`#[Response]` status by status, the parameters name by name).\n- The attributes of a **parent class** or a **parent method** are merged under those of the child.\n- The PHPDoc and the attributes win over the **naming strategies** of the configuration (summary, tags, operation id).\n\n## When the generator does not understand\n\nThe generator never fails on application code it does not understand: it leaves the part out and records a\n**diagnostic** (an info, a warning or an error), grouped by route. Read them with `openapi:generate -v` or\n`openapi:inspect \u003Croute>`, fix the cause in the code, and never edit the generated file: every run rewrites it. See\n[Diagnostics](\u002Flaravel-openapi-generator\u002Fworkflow\u002Fdiagnostics).\n",{"title":142,"description":702},"F82G2vg1CEvc-9SeN3kZ2pUUgA_vJ2IrbW1pIYMlT_8",[710,712],{"title":132,"path":133,"stem":134,"description":711,"children":-1},"Document a first endpoint from a model, a form request, a resource and a controller.",{"title":146,"path":147,"stem":148,"description":713,"children":-1},"Choose the routes of a document, and give each operation its summary, description, tags and identifier.",1795438899420]