[{"data":1,"prerenderedAt":1735},["ShallowReactive",2],{"libs":3,"navigation-laravel-openapi-generator":115,"\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fsecurity-and-errors":296,"\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fsecurity-and-errors-surround":1730},[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":162,"body":298,"description":1724,"experimental":119,"extension":1725,"links":118,"meta":1726,"navigation":922,"path":163,"rawbody":1727,"seo":1728,"since":118,"stem":164,"__hash__":1729},"laravel_openapi_generator\u002Flaravel-openapi-generator\u002F2.documenting-endpoints\u002F6.security-and-errors.md",{"type":299,"value":300,"toc":1716},"minimark",[301,305,310,529,536,541,547,869,874,878,884,1030,1033,1041,1045,1144,1175,1298,1308,1312,1318,1410,1413,1689,1698,1712],[302,303,304],"p",{},"The security of an operation and most of its error responses come from what the route already does: its middlewares,\nits bound models, its form request and the exceptions its action throws.",[306,307,309],"h2",{"id":308},"security-from-the-middlewares","Security from the middlewares",[311,312,313,329],"table",{},[314,315,316],"thead",{},[317,318,319,323,326],"tr",{},[320,321,322],"th",{},"Middleware",[320,324,325],{},"Security scheme",[320,327,328],{},"Also adds",[330,331,332,358,381,400,415,434,452,467,485,509],"tbody",{},[317,333,334,341,355],{},[335,336,337],"td",{},[338,339,340],"code",{},"auth:sanctum",[335,342,343,346,347,350,351,354],{},[338,344,345],{},"sanctum"," (bearer token), or ",[338,348,349],{},"session"," + ",[338,352,353],{},"xsrf"," (the cookie of a SPA)",[335,356,357],{},"401",[317,359,360,365,379],{},[335,361,362],{},[338,363,364],{},"auth:api",[335,366,367,370,371,374,375,378],{},[338,368,369],{},"passport"," (OAuth2 authorization code on ",[338,372,373],{},"\u002Foauth\u002Fauthorize"," and ",[338,376,377],{},"\u002Foauth\u002Ftoken",")",[335,380,357],{},[317,382,383,392,398],{},[335,384,385,388,389],{},[338,386,387],{},"auth",", ",[338,390,391],{},"auth:\u003Cguard>",[335,393,394,397],{},[338,395,396],{},"bearer",", or a bearer token named after the guard",[335,399,357],{},[317,401,402,407,413],{},[335,403,404],{},[338,405,406],{},"auth.basic",[335,408,409,412],{},[338,410,411],{},"basic"," (HTTP basic)",[335,414,357],{},[317,416,417,426,432],{},[335,418,419,388,422,425],{},[338,420,421],{},"abilities:",[338,423,424],{},"ability:"," (Sanctum)",[335,427,428,429,431],{},"the scopes of the ",[338,430,345],{}," requirement from 3.1; a sentence of the description before",[335,433],{},[317,435,436,445,450],{},[335,437,438,388,441,444],{},[338,439,440],{},"scopes:",[338,442,443],{},"scope:"," (Passport)",[335,446,428,447,449],{},[338,448,369],{}," requirement, declared in its flows",[335,451],{},[317,453,454,462,464],{},[335,455,456,388,459],{},[338,457,458],{},"can:",[338,460,461],{},"Authorize",[335,463],{},[335,465,466],{},"403",[317,468,469,474,476],{},[335,470,471],{},[338,472,473],{},"signed",[335,475],{},[335,477,478,374,481,484],{},[338,479,480],{},"signature",[338,482,483],{},"expires"," query parameters, 403",[317,486,487,492,494],{},[335,488,489],{},[338,490,491],{},"throttle",[335,493],{},[335,495,496,497,388,500,388,503,388,506],{},"429 with ",[338,498,499],{},"X-RateLimit-Limit",[338,501,502],{},"X-RateLimit-Remaining",[338,504,505],{},"Retry-After",[338,507,508],{},"X-RateLimit-Reset",[317,510,511,521,523],{},[335,512,513,516,517,520],{},[338,514,515],{},"ValidateCsrfToken"," (the ",[338,518,519],{},"web"," group)",[335,522],{},[335,524,525,528],{},[338,526,527],{},"X-CSRF-TOKEN"," header and 419, on the methods that change something",[302,530,531,532,535],{},"Each guard of ",[338,533,534],{},"auth:sanctum,api"," is an alternative requirement.",[537,538,540],"h3",{"id":539},"your-own-schemes","Your own schemes",[302,542,543,546],{},[338,544,545],{},"security_schemes"," completes or replaces the schemes the middlewares give, by name. Write each scheme as an OpenAPI\nSecurity Scheme Object: its keys are the OpenAPI field names, in camelCase.",[548,549,555],"pre",{"className":550,"code":551,"filename":552,"language":553,"meta":554,"style":554},"language-php shiki shiki-themes material-theme-lighter github-light github-dark","'documents' => [\n    'v1' => [\n        'security_schemes' => [\n            'passport' => [\n                'type' => 'oauth2',\n                'flows' => ['authorizationCode' => [\n                    'authorizationUrl' => 'https:\u002F\u002Fexample.com\u002Foauth\u002Fauthorize',\n                    'tokenUrl' => 'https:\u002F\u002Fexample.com\u002Foauth\u002Ftoken',\n                    'scopes' => ['books:read' => 'Read the books'],\n                ]],\n            ],\n            'oidc' => [\n                'type' => 'openIdConnect',\n                'openIdConnectUrl' => 'https:\u002F\u002Fexample.com'\n                    . '\u002F.well-known\u002Fopenid-configuration',\n            ],\n        ],\n        'security' => [],   \u002F\u002F names of the schemes required on every operation\n    ],\n],\n","config\u002Fopenapi.php","php","",[338,556,557,580,595,609,623,647,673,695,716,749,754,760,774,794,814,829,834,840,859,865],{"__ignoreMap":554},[558,559,562,566,570,572,576],"span",{"class":560,"line":561},"line",1,[558,563,565],{"class":564},"sjJ54","'",[558,567,569],{"class":568},"s_sjI","documents",[558,571,565],{"class":564},[558,573,575],{"class":574},"smGrS"," =>",[558,577,579],{"class":578},"sP7_E"," [\n",[558,581,583,586,589,591,593],{"class":560,"line":582},2,[558,584,585],{"class":564},"    '",[558,587,588],{"class":568},"v1",[558,590,565],{"class":564},[558,592,575],{"class":574},[558,594,579],{"class":578},[558,596,598,601,603,605,607],{"class":560,"line":597},3,[558,599,600],{"class":564},"        '",[558,602,545],{"class":568},[558,604,565],{"class":564},[558,606,575],{"class":574},[558,608,579],{"class":578},[558,610,612,615,617,619,621],{"class":560,"line":611},4,[558,613,614],{"class":564},"            '",[558,616,369],{"class":568},[558,618,565],{"class":564},[558,620,575],{"class":574},[558,622,579],{"class":578},[558,624,626,629,632,634,636,639,642,644],{"class":560,"line":625},5,[558,627,628],{"class":564},"                '",[558,630,631],{"class":568},"type",[558,633,565],{"class":564},[558,635,575],{"class":574},[558,637,638],{"class":564}," '",[558,640,641],{"class":568},"oauth2",[558,643,565],{"class":564},[558,645,646],{"class":578},",\n",[558,648,650,652,655,657,659,662,664,667,669,671],{"class":560,"line":649},6,[558,651,628],{"class":564},[558,653,654],{"class":568},"flows",[558,656,565],{"class":564},[558,658,575],{"class":574},[558,660,661],{"class":578}," [",[558,663,565],{"class":564},[558,665,666],{"class":568},"authorizationCode",[558,668,565],{"class":564},[558,670,575],{"class":574},[558,672,579],{"class":578},[558,674,676,679,682,684,686,688,691,693],{"class":560,"line":675},7,[558,677,678],{"class":564},"                    '",[558,680,681],{"class":568},"authorizationUrl",[558,683,565],{"class":564},[558,685,575],{"class":574},[558,687,638],{"class":564},[558,689,690],{"class":568},"https:\u002F\u002Fexample.com\u002Foauth\u002Fauthorize",[558,692,565],{"class":564},[558,694,646],{"class":578},[558,696,698,700,703,705,707,709,712,714],{"class":560,"line":697},8,[558,699,678],{"class":564},[558,701,702],{"class":568},"tokenUrl",[558,704,565],{"class":564},[558,706,575],{"class":574},[558,708,638],{"class":564},[558,710,711],{"class":568},"https:\u002F\u002Fexample.com\u002Foauth\u002Ftoken",[558,713,565],{"class":564},[558,715,646],{"class":578},[558,717,719,721,724,726,728,730,732,735,737,739,741,744,746],{"class":560,"line":718},9,[558,720,678],{"class":564},[558,722,723],{"class":568},"scopes",[558,725,565],{"class":564},[558,727,575],{"class":574},[558,729,661],{"class":578},[558,731,565],{"class":564},[558,733,734],{"class":568},"books:read",[558,736,565],{"class":564},[558,738,575],{"class":574},[558,740,638],{"class":564},[558,742,743],{"class":568},"Read the books",[558,745,565],{"class":564},[558,747,748],{"class":578},"],\n",[558,750,751],{"class":560,"line":29},[558,752,753],{"class":578},"                ]],\n",[558,755,757],{"class":560,"line":756},11,[558,758,759],{"class":578},"            ],\n",[558,761,763,765,768,770,772],{"class":560,"line":762},12,[558,764,614],{"class":564},[558,766,767],{"class":568},"oidc",[558,769,565],{"class":564},[558,771,575],{"class":574},[558,773,579],{"class":578},[558,775,777,779,781,783,785,787,790,792],{"class":560,"line":776},13,[558,778,628],{"class":564},[558,780,631],{"class":568},[558,782,565],{"class":564},[558,784,575],{"class":574},[558,786,638],{"class":564},[558,788,789],{"class":568},"openIdConnect",[558,791,565],{"class":564},[558,793,646],{"class":578},[558,795,797,799,802,804,806,808,811],{"class":560,"line":796},14,[558,798,628],{"class":564},[558,800,801],{"class":568},"openIdConnectUrl",[558,803,565],{"class":564},[558,805,575],{"class":574},[558,807,638],{"class":564},[558,809,810],{"class":568},"https:\u002F\u002Fexample.com",[558,812,813],{"class":564},"'\n",[558,815,817,820,822,825,827],{"class":560,"line":816},15,[558,818,819],{"class":574},"                    .",[558,821,638],{"class":564},[558,823,824],{"class":568},"\u002F.well-known\u002Fopenid-configuration",[558,826,565],{"class":564},[558,828,646],{"class":578},[558,830,832],{"class":560,"line":831},16,[558,833,759],{"class":578},[558,835,837],{"class":560,"line":836},17,[558,838,839],{"class":578},"        ],\n",[558,841,843,845,848,850,852,855],{"class":560,"line":842},18,[558,844,600],{"class":564},[558,846,847],{"class":568},"security",[558,849,565],{"class":564},[558,851,575],{"class":574},[558,853,854],{"class":578}," [],",[558,856,858],{"class":857},"sutJx","   \u002F\u002F names of the schemes required on every operation\n",[558,860,862],{"class":560,"line":861},19,[558,863,864],{"class":578},"    ],\n",[558,866,867],{"class":560,"line":58},[558,868,748],{"class":578},[302,870,871,873],{},[338,872,847],{}," lists the schemes required by default on every operation, on top of those of the middlewares.",[537,875,877],{"id":876},"declaring-the-security","Declaring the security",[302,879,880,883],{},[338,881,882],{},"#[Security]"," replaces the requirements of the middlewares. It is repeatable: each attribute is an alternative.",[548,885,887],{"className":550,"code":886,"language":553,"meta":554,"style":554},"use Ark4ne\\OpenApi\\Attributes\\Security;\n\n#[Security('oidc', scopes: ['books:write'])]\n#[Security('passport', scopes: ['books:write'])]\npublic function store(StoreBookRequest $request): BookResource\n",[338,888,889,918,924,966,998],{"__ignoreMap":554},[558,890,891,895,899,903,906,908,910,912,915],{"class":560,"line":561},[558,892,894],{"class":893},"sw1J6","use",[558,896,898],{"class":897},"s_hVV"," Ark4ne",[558,900,902],{"class":901},"s39Yj","\\",[558,904,905],{"class":897},"OpenApi",[558,907,902],{"class":901},[558,909,269],{"class":897},[558,911,902],{"class":901},[558,913,914],{"class":897},"Security",[558,916,917],{"class":578},";\n",[558,919,920],{"class":560,"line":582},[558,921,923],{"emptyLinePlaceholder":922},true,"\n",[558,925,926,930,932,935,937,939,941,944,948,951,953,955,958,960,963],{"class":560,"line":597},[558,927,929],{"class":928},"su5hD","#[",[558,931,914],{"class":897},[558,933,934],{"class":578},"(",[558,936,565],{"class":564},[558,938,767],{"class":568},[558,940,565],{"class":564},[558,942,943],{"class":578},",",[558,945,947],{"class":946},"sbgvK"," scopes",[558,949,950],{"class":578},":",[558,952,661],{"class":578},[558,954,565],{"class":564},[558,956,957],{"class":568},"books:write",[558,959,565],{"class":564},[558,961,962],{"class":578},"])",[558,964,965],{"class":928},"]\n",[558,967,968,970,972,974,976,978,980,982,984,986,988,990,992,994,996],{"class":560,"line":611},[558,969,929],{"class":928},[558,971,914],{"class":897},[558,973,934],{"class":578},[558,975,565],{"class":564},[558,977,369],{"class":568},[558,979,565],{"class":564},[558,981,943],{"class":578},[558,983,947],{"class":946},[558,985,950],{"class":578},[558,987,661],{"class":578},[558,989,565],{"class":564},[558,991,957],{"class":568},[558,993,565],{"class":564},[558,995,962],{"class":578},[558,997,965],{"class":928},[558,999,1000,1004,1007,1011,1013,1017,1020,1023,1025,1027],{"class":560,"line":625},[558,1001,1003],{"class":1002},"sbsja","public",[558,1005,1006],{"class":1002}," function",[558,1008,1010],{"class":1009},"sGLFI"," store",[558,1012,934],{"class":578},[558,1014,1016],{"class":1015},"sZMiF","StoreBookRequest",[558,1018,1019],{"class":578}," $",[558,1021,1022],{"class":928},"request",[558,1024,378],{"class":578},[558,1026,950],{"class":574},[558,1028,1029],{"class":1015}," BookResource\n",[302,1031,1032],{},"On the controller, it applies to each action; on the action, it replaces those of the class.",[302,1034,1035,1036,1040],{},"To add what a middleware of your own means (a header, a scheme, an error), write a\n",[1037,1038,1039],"a",{"href":241},"middleware mapper",".",[306,1042,1044],{"id":1043},"error-responses","Error responses",[311,1046,1047,1057],{},[314,1048,1049],{},[317,1050,1051,1054],{},[320,1052,1053],{},"Status",[320,1055,1056],{},"Comes from",[330,1058,1059,1074,1093,1104,1112,1123,1132],{},[317,1060,1061,1063],{},[335,1062,357],{},[335,1064,1065,388,1067,388,1069,1071,1072],{},[338,1066,387],{},[338,1068,391],{},[338,1070,406],{},", the default ",[338,1073,847],{},[317,1075,1076,1078],{},[335,1077,466],{},[335,1079,1080,388,1082,388,1084,1086,1087,388,1090],{},[338,1081,458],{},[338,1083,461],{},[338,1085,473],{},", a form request that redefines ",[338,1088,1089],{},"authorize()",[338,1091,1092],{},"@throws AuthorizationException",[317,1094,1095,1098],{},[335,1096,1097],{},"404",[335,1099,1100,1101],{},"a bound model or backed enum in the path, ",[338,1102,1103],{},"@throws ModelNotFoundException",[317,1105,1106,1109],{},[335,1107,1108],{},"419",[335,1110,1111],{},"the CSRF middleware",[317,1113,1114,1117],{},[335,1115,1116],{},"422",[335,1118,1119,1120],{},"a form request with rules, ",[338,1121,1122],{},"@throws ValidationException",[317,1124,1125,1128],{},[335,1126,1127],{},"429",[335,1129,1130],{},[338,1131,491],{},[317,1133,1134,1137],{},[335,1135,1136],{},"any",[335,1138,1139,1140,1143],{},"the ",[338,1141,1142],{},"@throws"," of the action",[302,1145,1146,1147,1150,1151,388,1154,388,1157,1160,1161,1150,1164,1167,1168,1150,1171,1174],{},"They are shared responses of ",[338,1148,1149],{},"components.responses"," (",[338,1152,1153],{},"Unauthenticated",[338,1155,1156],{},"NotFound",[338,1158,1159],{},"ValidationFailed","…), with the\nbodies Laravel renders: ",[338,1162,1163],{},"Error",[338,1165,1166],{},"{\"message\": …}",") and ",[338,1169,1170],{},"ValidationError",[338,1172,1173],{},"{\"message\": …, \"errors\": {…}}",").",[548,1176,1180],{"className":1177,"code":1178,"language":1179,"meta":554,"style":554},"language-json shiki shiki-themes material-theme-lighter github-light github-dark","\"responses\": {\n  \"201\": { \"…\": \"…\" },\n  \"401\": { \"$ref\": \"#\u002Fcomponents\u002Fresponses\u002FUnauthenticated\" },\n  \"422\": { \"$ref\": \"#\u002Fcomponents\u002Fresponses\u002FValidationFailed\" }\n}\n","json",[338,1181,1182,1198,1233,1263,1293],{"__ignoreMap":554},[558,1183,1184,1187,1190,1192,1195],{"class":560,"line":561},[558,1185,1186],{"class":564},"\"",[558,1188,1189],{"class":568},"responses",[558,1191,1186],{"class":564},[558,1193,1194],{"class":928},": ",[558,1196,1197],{"class":578},"{\n",[558,1199,1200,1203,1207,1209,1211,1214,1217,1220,1222,1224,1226,1228,1230],{"class":560,"line":582},[558,1201,1202],{"class":901},"  \"",[558,1204,1206],{"class":1205},"sseR_","201",[558,1208,1186],{"class":901},[558,1210,950],{"class":578},[558,1212,1213],{"class":578}," {",[558,1215,1216],{"class":901}," \"",[558,1218,1219],{"class":1015},"…",[558,1221,1186],{"class":901},[558,1223,950],{"class":578},[558,1225,1216],{"class":564},[558,1227,1219],{"class":568},[558,1229,1186],{"class":564},[558,1231,1232],{"class":578}," },\n",[558,1234,1235,1237,1239,1241,1243,1245,1247,1250,1252,1254,1256,1259,1261],{"class":560,"line":597},[558,1236,1202],{"class":901},[558,1238,357],{"class":1205},[558,1240,1186],{"class":901},[558,1242,950],{"class":578},[558,1244,1213],{"class":578},[558,1246,1216],{"class":901},[558,1248,1249],{"class":1015},"$ref",[558,1251,1186],{"class":901},[558,1253,950],{"class":578},[558,1255,1216],{"class":564},[558,1257,1258],{"class":568},"#\u002Fcomponents\u002Fresponses\u002FUnauthenticated",[558,1260,1186],{"class":564},[558,1262,1232],{"class":578},[558,1264,1265,1267,1269,1271,1273,1275,1277,1279,1281,1283,1285,1288,1290],{"class":560,"line":611},[558,1266,1202],{"class":901},[558,1268,1116],{"class":1205},[558,1270,1186],{"class":901},[558,1272,950],{"class":578},[558,1274,1213],{"class":578},[558,1276,1216],{"class":901},[558,1278,1249],{"class":1015},[558,1280,1186],{"class":901},[558,1282,950],{"class":578},[558,1284,1216],{"class":564},[558,1286,1287],{"class":568},"#\u002Fcomponents\u002Fresponses\u002FValidationFailed",[558,1289,1186],{"class":564},[558,1291,1292],{"class":578}," }\n",[558,1294,1295],{"class":560,"line":625},[558,1296,1297],{"class":578},"}\n",[302,1299,1300,1301,374,1304,1307],{},"With the ",[1037,1302,1303],{"href":251},"JSON:API integration",[338,1305,1306],{},"integrations.json_api.errors",",\nthe bodies are JSON:API error documents.",[306,1309,1311],{"id":1310},"exceptions-of-the-action","Exceptions of the action",[302,1313,1314,1315,1317],{},"Each ",[338,1316,1142],{}," of the action becomes a response:",[548,1319,1321],{"className":550,"code":1320,"language":553,"meta":554,"style":554},"\u002F**\n * Book a seat.\n *\n * @throws SeatTakenException\n * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n *\u002F\npublic function book(string $seat): JsonResponse\n",[338,1322,1323,1328,1333,1338,1350,1379,1384],{"__ignoreMap":554},[558,1324,1325],{"class":560,"line":561},[558,1326,1327],{"class":857},"\u002F**\n",[558,1329,1330],{"class":560,"line":582},[558,1331,1332],{"class":857}," * Book a seat.\n",[558,1334,1335],{"class":560,"line":597},[558,1336,1337],{"class":857}," *\n",[558,1339,1340,1343,1346],{"class":560,"line":611},[558,1341,1342],{"class":857}," * ",[558,1344,1142],{"class":1345},"sp_-d",[558,1347,1349],{"class":1348},"sCdfi"," SeatTakenException\n",[558,1351,1352,1354,1356,1360,1364,1366,1369,1371,1374,1376],{"class":560,"line":625},[558,1353,1342],{"class":857},[558,1355,1142],{"class":1345},[558,1357,1359],{"class":1358},"slwOJ"," \\",[558,1361,1363],{"class":1362},"sfi6f","Illuminate",[558,1365,902],{"class":1358},[558,1367,1368],{"class":1362},"Auth",[558,1370,902],{"class":1358},[558,1372,1373],{"class":1362},"Access",[558,1375,902],{"class":1358},[558,1377,1378],{"class":1348},"AuthorizationException\n",[558,1380,1381],{"class":560,"line":649},[558,1382,1383],{"class":857}," *\u002F\n",[558,1385,1386,1388,1390,1393,1395,1398,1400,1403,1405,1407],{"class":560,"line":675},[558,1387,1003],{"class":1002},[558,1389,1006],{"class":1002},[558,1391,1392],{"class":1009}," book",[558,1394,934],{"class":578},[558,1396,1397],{"class":893},"string",[558,1399,1019],{"class":578},[558,1401,1402],{"class":928},"seat",[558,1404,378],{"class":578},[558,1406,950],{"class":574},[558,1408,1409],{"class":1015}," JsonResponse\n",[302,1411,1412],{},"The status and the body of an exception come from, in order:",[1414,1415,1416,1519,1655,1682],"ol",{},[1417,1418,1419,1422,1423,1503,1506,1507,388,1510,388,1512,374,1515,1518],"li",{},[338,1420,1421],{},"#[Response]"," on the exception class, or on a parent class:",[548,1424,1426],{"className":550,"code":1425,"language":553,"meta":554,"style":554},"use Ark4ne\\OpenApi\\Attributes\\Response;\n\n#[Response(409, description: 'The seat is already taken')]\nfinal class SeatTakenException extends RuntimeException {}\n",[338,1427,1428,1449,1453,1483],{"__ignoreMap":554},[558,1429,1430,1432,1434,1436,1438,1440,1442,1444,1447],{"class":560,"line":561},[558,1431,894],{"class":893},[558,1433,898],{"class":897},[558,1435,902],{"class":901},[558,1437,905],{"class":897},[558,1439,902],{"class":901},[558,1441,269],{"class":897},[558,1443,902],{"class":901},[558,1445,1446],{"class":897},"Response",[558,1448,917],{"class":578},[558,1450,1451],{"class":560,"line":582},[558,1452,923],{"emptyLinePlaceholder":922},[558,1454,1455,1457,1459,1461,1465,1467,1470,1472,1474,1477,1479,1481],{"class":560,"line":597},[558,1456,929],{"class":928},[558,1458,1446],{"class":897},[558,1460,934],{"class":578},[558,1462,1464],{"class":1463},"srdBf","409",[558,1466,943],{"class":578},[558,1468,1469],{"class":946}," description",[558,1471,950],{"class":578},[558,1473,638],{"class":564},[558,1475,1476],{"class":568},"The seat is already taken",[558,1478,565],{"class":564},[558,1480,378],{"class":578},[558,1482,965],{"class":928},[558,1484,1485,1488,1491,1494,1497,1500],{"class":560,"line":611},[558,1486,1487],{"class":1002},"final",[558,1489,1490],{"class":1002}," class",[558,1492,1493],{"class":946}," SeatTakenException",[558,1495,1496],{"class":1002}," extends",[558,1498,1499],{"class":1015}," RuntimeException",[558,1501,1502],{"class":578}," {}\n",[1504,1505],"br",{},"Without body, the response has the error body; it accepts ",[338,1508,1509],{},"resource",[338,1511,631],{},[338,1513,1514],{},"headers",[338,1516,1517],{},"example"," as on an\naction.",[1417,1520,1521,1524,1525,1528,1529],{},[338,1522,1523],{},"exceptions.map"," of the configuration, for the exceptions you cannot annotate and those ",[338,1526,1527],{},"bootstrap\u002Fapp.php"," renders\nthrough closures. The exception or its closest parent class wins:",[548,1530,1532],{"className":550,"code":1531,"filename":552,"language":553,"meta":554,"style":554},"'exceptions' => [\n    'read_throws' => true,\n    'map' => [\n        PaymentRequiredException::class => 402,\n        SeatTakenException::class => [\n            'status' => 409,\n            'description' => 'Seat taken',\n        ],\n    ],\n],\n",[338,1533,1534,1547,1563,1576,1594,1607,1623,1643,1647,1651],{"__ignoreMap":554},[558,1535,1536,1538,1541,1543,1545],{"class":560,"line":561},[558,1537,565],{"class":564},[558,1539,1540],{"class":568},"exceptions",[558,1542,565],{"class":564},[558,1544,575],{"class":574},[558,1546,579],{"class":578},[558,1548,1549,1551,1554,1556,1558,1561],{"class":560,"line":582},[558,1550,585],{"class":564},[558,1552,1553],{"class":568},"read_throws",[558,1555,565],{"class":564},[558,1557,575],{"class":574},[558,1559,1560],{"class":901}," true",[558,1562,646],{"class":578},[558,1564,1565,1567,1570,1572,1574],{"class":560,"line":597},[558,1566,585],{"class":564},[558,1568,1569],{"class":568},"map",[558,1571,565],{"class":564},[558,1573,575],{"class":574},[558,1575,579],{"class":578},[558,1577,1578,1581,1584,1587,1589,1592],{"class":560,"line":611},[558,1579,1580],{"class":1015},"        PaymentRequiredException",[558,1582,1583],{"class":574},"::",[558,1585,1586],{"class":893},"class",[558,1588,575],{"class":574},[558,1590,1591],{"class":1463}," 402",[558,1593,646],{"class":578},[558,1595,1596,1599,1601,1603,1605],{"class":560,"line":625},[558,1597,1598],{"class":1015},"        SeatTakenException",[558,1600,1583],{"class":574},[558,1602,1586],{"class":893},[558,1604,575],{"class":574},[558,1606,579],{"class":578},[558,1608,1609,1611,1614,1616,1618,1621],{"class":560,"line":649},[558,1610,614],{"class":564},[558,1612,1613],{"class":568},"status",[558,1615,565],{"class":564},[558,1617,575],{"class":574},[558,1619,1620],{"class":1463}," 409",[558,1622,646],{"class":578},[558,1624,1625,1627,1630,1632,1634,1636,1639,1641],{"class":560,"line":675},[558,1626,614],{"class":564},[558,1628,1629],{"class":568},"description",[558,1631,565],{"class":564},[558,1633,575],{"class":574},[558,1635,638],{"class":564},[558,1637,1638],{"class":568},"Seat taken",[558,1640,565],{"class":564},[558,1642,646],{"class":578},[558,1644,1645],{"class":560,"line":697},[558,1646,839],{"class":578},[558,1648,1649],{"class":560,"line":718},[558,1650,864],{"class":578},[558,1652,1653],{"class":560,"line":29},[558,1654,748],{"class":578},[1417,1656,1657,1658,1661,1662,1665,1666,1669,1670,1673,1674,1677,1678,1681],{},"Laravel's rendering: ",[338,1659,1660],{},"AuthenticationException"," 401, ",[338,1663,1664],{},"AuthorizationException"," 403, ",[338,1667,1668],{},"ModelNotFoundException"," 404,\n",[338,1671,1672],{},"TokenMismatchException"," 419, ",[338,1675,1676],{},"ValidationException"," 422, ",[338,1679,1680],{},"ThrottleRequestsException"," 429, subclasses included.",[1417,1683,1684,1685,1688],{},"Symfony's HTTP exceptions whose class fixes the status (",[338,1686,1687],{},"NotFoundHttpException","…), and an HTTP exception of the\napplication whose constructor without arguments sets its status.",[302,1690,1691,1692,1694,1695,1040],{},"Several causes of one status become one response: a declared ",[338,1693,1421],{}," wins, otherwise their descriptions are put\ntogether and different bodies become ",[338,1696,1697],{},"oneOf",[302,1699,1700,1701,1704,1705,1708,1709,1711],{},"Set ",[338,1702,1703],{},"exceptions.read_throws"," to ",[338,1706,1707],{},"false"," to ignore the ",[338,1710,1142],{}," tags.",[1713,1714,1715],"style",{},"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 .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sutJx, html code.shiki .sutJx{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .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 .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0}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}html pre.shiki code .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sseR_, html code.shiki .sseR_{--shiki-light:#9C3EDA;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sp_-d, html code.shiki .sp_-d{--shiki-light:#F76D47;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .sCdfi, html code.shiki .sCdfi{--shiki-light:#E2931D;--shiki-light-font-style:italic;--shiki-default:#005CC5;--shiki-default-font-style:inherit;--shiki-dark:#79B8FF;--shiki-dark-font-style:inherit}html pre.shiki code .slwOJ, html code.shiki .slwOJ{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#005CC5;--shiki-default-font-style:inherit;--shiki-dark:#79B8FF;--shiki-dark-font-style:inherit}html pre.shiki code .sfi6f, html code.shiki .sfi6f{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#005CC5;--shiki-default-font-style:inherit;--shiki-dark:#79B8FF;--shiki-dark-font-style:inherit}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":554,"searchDepth":597,"depth":597,"links":1717},[1718,1722,1723],{"id":308,"depth":582,"text":309,"children":1719},[1720,1721],{"id":539,"depth":597,"text":540},{"id":876,"depth":597,"text":877},{"id":1043,"depth":582,"text":1044},{"id":1310,"depth":582,"text":1311},"Security requirements from the middlewares, and the error responses the generator adds to each operation.","md",{},"---\ntitle: Security & errors\ndescription: Security requirements from the middlewares, and the error responses the generator adds to each operation.\n---\n\nThe security of an operation and most of its error responses come from what the route already does: its middlewares,\nits bound models, its form request and the exceptions its action throws.\n\n## Security from the middlewares\n\n| Middleware | Security scheme | Also adds |\n| --- | --- | --- |\n| `auth:sanctum` | `sanctum` (bearer token), or `session` + `xsrf` (the cookie of a SPA) | 401 |\n| `auth:api` | `passport` (OAuth2 authorization code on `\u002Foauth\u002Fauthorize` and `\u002Foauth\u002Ftoken`) | 401 |\n| `auth`, `auth:\u003Cguard>` | `bearer`, or a bearer token named after the guard | 401 |\n| `auth.basic` | `basic` (HTTP basic) | 401 |\n| `abilities:`, `ability:` (Sanctum) | the scopes of the `sanctum` requirement from 3.1; a sentence of the description before | |\n| `scopes:`, `scope:` (Passport) | the scopes of the `passport` requirement, declared in its flows | |\n| `can:`, `Authorize` | | 403 |\n| `signed` | | `signature` and `expires` query parameters, 403 |\n| `throttle` | | 429 with `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `Retry-After`, `X-RateLimit-Reset` |\n| `ValidateCsrfToken` (the `web` group) | | `X-CSRF-TOKEN` header and 419, on the methods that change something |\n\nEach guard of `auth:sanctum,api` is an alternative requirement.\n\n### Your own schemes\n\n`security_schemes` completes or replaces the schemes the middlewares give, by name. Write each scheme as an OpenAPI\nSecurity Scheme Object: its keys are the OpenAPI field names, in camelCase.\n\n```php [config\u002Fopenapi.php]\n'documents' => [\n    'v1' => [\n        'security_schemes' => [\n            'passport' => [\n                'type' => 'oauth2',\n                'flows' => ['authorizationCode' => [\n                    'authorizationUrl' => 'https:\u002F\u002Fexample.com\u002Foauth\u002Fauthorize',\n                    'tokenUrl' => 'https:\u002F\u002Fexample.com\u002Foauth\u002Ftoken',\n                    'scopes' => ['books:read' => 'Read the books'],\n                ]],\n            ],\n            'oidc' => [\n                'type' => 'openIdConnect',\n                'openIdConnectUrl' => 'https:\u002F\u002Fexample.com'\n                    . '\u002F.well-known\u002Fopenid-configuration',\n            ],\n        ],\n        'security' => [],   \u002F\u002F names of the schemes required on every operation\n    ],\n],\n```\n\n`security` lists the schemes required by default on every operation, on top of those of the middlewares.\n\n### Declaring the security\n\n`#[Security]` replaces the requirements of the middlewares. It is repeatable: each attribute is an alternative.\n\n```php\nuse Ark4ne\\OpenApi\\Attributes\\Security;\n\n#[Security('oidc', scopes: ['books:write'])]\n#[Security('passport', scopes: ['books:write'])]\npublic function store(StoreBookRequest $request): BookResource\n```\n\nOn the controller, it applies to each action; on the action, it replaces those of the class.\n\nTo add what a middleware of your own means (a header, a scheme, an error), write a\n[middleware mapper](\u002Flaravel-openapi-generator\u002Fextending\u002Fpasses-and-middlewares).\n\n## Error responses\n\n| Status | Comes from |\n| --- | --- |\n| 401 | `auth`, `auth:\u003Cguard>`, `auth.basic`, the default `security` |\n| 403 | `can:`, `Authorize`, `signed`, a form request that redefines `authorize()`, `@throws AuthorizationException` |\n| 404 | a bound model or backed enum in the path, `@throws ModelNotFoundException` |\n| 419 | the CSRF middleware |\n| 422 | a form request with rules, `@throws ValidationException` |\n| 429 | `throttle` |\n| any | the `@throws` of the action |\n\nThey are shared responses of `components.responses` (`Unauthenticated`, `NotFound`, `ValidationFailed`…), with the\nbodies Laravel renders: `Error` (`{\"message\": …}`) and `ValidationError` (`{\"message\": …, \"errors\": {…}}`).\n\n```json\n\"responses\": {\n  \"201\": { \"…\": \"…\" },\n  \"401\": { \"$ref\": \"#\u002Fcomponents\u002Fresponses\u002FUnauthenticated\" },\n  \"422\": { \"$ref\": \"#\u002Fcomponents\u002Fresponses\u002FValidationFailed\" }\n}\n```\n\nWith the [JSON:API integration](\u002Flaravel-openapi-generator\u002Fintegrations\u002Fjson-api) and `integrations.json_api.errors`,\nthe bodies are JSON:API error documents.\n\n## Exceptions of the action\n\nEach `@throws` of the action becomes a response:\n\n```php\n\u002F**\n * Book a seat.\n *\n * @throws SeatTakenException\n * @throws \\Illuminate\\Auth\\Access\\AuthorizationException\n *\u002F\npublic function book(string $seat): JsonResponse\n```\n\nThe status and the body of an exception come from, in order:\n\n1. `#[Response]` on the exception class, or on a parent class:\n\n   ```php\n   use Ark4ne\\OpenApi\\Attributes\\Response;\n\n   #[Response(409, description: 'The seat is already taken')]\n   final class SeatTakenException extends RuntimeException {}\n   ```\n\n   Without body, the response has the error body; it accepts `resource`, `type`, `headers` and `example` as on an\n   action.\n\n2. `exceptions.map` of the configuration, for the exceptions you cannot annotate and those `bootstrap\u002Fapp.php` renders\n   through closures. The exception or its closest parent class wins:\n\n   ```php [config\u002Fopenapi.php]\n   'exceptions' => [\n       'read_throws' => true,\n       'map' => [\n           PaymentRequiredException::class => 402,\n           SeatTakenException::class => [\n               'status' => 409,\n               'description' => 'Seat taken',\n           ],\n       ],\n   ],\n   ```\n\n3. Laravel's rendering: `AuthenticationException` 401, `AuthorizationException` 403, `ModelNotFoundException` 404,\n   `TokenMismatchException` 419, `ValidationException` 422, `ThrottleRequestsException` 429, subclasses included.\n\n4. Symfony's HTTP exceptions whose class fixes the status (`NotFoundHttpException`…), and an HTTP exception of the\n   application whose constructor without arguments sets its status.\n\nSeveral causes of one status become one response: a declared `#[Response]` wins, otherwise their descriptions are put\ntogether and different bodies become `oneOf`.\n\nSet `exceptions.read_throws` to `false` to ignore the `@throws` tags.\n",{"title":162,"description":1724},"QEdj_Msz3NXHsa6PYkE_GSZJwx_g-jWPDxVSxC1scK4",[1731,1733],{"title":158,"path":159,"stem":160,"description":1732,"children":-1},"How resources are described by running them on sampled models, and how to help when a resource fails.",{"title":166,"path":167,"stem":168,"description":1734,"children":-1},"Document the requests your application sends, to subscribers and to URLs the client gives.",1795438903298]