[{"data":1,"prerenderedAt":1351},["ShallowReactive",2],{"libs":3,"navigation-laravel-openapi-generator":115,"\u002Flaravel-openapi-generator\u002Fextending\u002Fsamplers":296,"\u002Flaravel-openapi-generator\u002Fextending\u002Fsamplers-surround":1346},[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":236,"body":298,"description":1340,"experimental":119,"extension":1341,"links":118,"meta":1342,"navigation":445,"path":237,"rawbody":1343,"seo":1344,"since":118,"stem":238,"__hash__":1345},"laravel_openapi_generator\u002Flaravel-openapi-generator\u002F5.extending\u002F5.samplers.md",{"type":299,"value":300,"toc":1336},"minimark",[301,309,396,399,1192,1248,1253,1300,1306,1310,1320,1332],[302,303,304,305,308],"p",{},"A sampler builds the instances a resource is run on (see\n",[306,307,158],"a",{"href":159},"). The first sampler that supports the request, by\ndecreasing priority, builds the samples:",[310,311,312,328],"table",{},[313,314,315],"thead",{},[316,317,318,322,325],"tr",{},[319,320,321],"th",{},"Built-in sampler",[319,323,324],{},"Priority",[319,326,327],{},"Samples",[329,330,331,350,370,383],"tbody",{},[316,332,333,340,343],{},[334,335,336],"td",{},[337,338,339],"code",{},"ResourceFactorySampler",[334,341,342],{},"400",[334,344,345,346,349],{},"what the ",[337,347,348],{},"#[ResourceFactory]"," of the resource returns",[316,351,352,357,360],{},[334,353,354],{},[337,355,356],{},"ModelFactorySampler",[334,358,359],{},"300",[334,361,362,363,366,367],{},"a model with a factory: ",[337,364,365],{},"create()"," in the transaction, else ",[337,368,369],{},"make()",[316,371,372,377,380],{},[334,373,374],{},[337,375,376],{},"EnumSampler",[334,378,379],{},"200",[334,381,382],{},"the cases of an enum",[316,384,385,390,393],{},[334,386,387],{},[337,388,389],{},"FakeObjectSampler",[334,391,392],{},"100",[334,394,395],{},"a model filled from its declared types, or a fake object",[302,397,398],{},"A sampler that throws lets the next one try. Write one when a model needs a particular state to render every key of\nits resource, and you would rather not change its factory:",[400,401,404,961],"example",{"input":402,"output":403},"app\u002FDocs\u002FOrderSampler.php","components.schemas.Order",[405,406,408],"template",{"v-slot:input":407},"",[409,410,414],"pre",{"className":411,"code":412,"language":413,"meta":407,"style":407},"language-php shiki shiki-themes material-theme-lighter github-light github-dark","namespace App\\Docs;\n\nuse App\\Models\\Order;\nuse Ark4ne\\OpenApi\\Context\\GenerationContext;\nuse Ark4ne\\OpenApi\\Sampling\\SampleRequest;\nuse Ark4ne\\OpenApi\\Sampling\\Sampler;\n\nfinal class OrderSampler implements Sampler\n{\n    public const PRIORITY = 500;\n\n    public function priority(): int\n    {\n        return self::PRIORITY;\n    }\n\n    public function supports(\n        SampleRequest $request,\n        GenerationContext $context,\n    ): bool {\n        return $request->target === Order::class;\n    }\n\n    public function sample(\n        SampleRequest $request,\n        GenerationContext $context,\n    ): array {\n        return array_map(\n            static fn(int $i): Order => new Order([\n                'id' => $i,\n                'status' => 'paid',\n                'total' => 19.99 * $i,\n            ]),\n            range(1, $request->count),\n        );\n    }\n}\n","php",[337,415,416,440,447,469,494,516,538,543,562,568,589,594,615,621,639,645,650,663,680,693,706,734,739,744,756,767,778,790,801,839,860,882,912,918,944,950,955],{"__ignoreMap":407},[417,418,421,425,429,433,436],"span",{"class":419,"line":420},"line",1,[417,422,424],{"class":423},"sw1J6","namespace",[417,426,428],{"class":427},"sbgvK"," App",[417,430,432],{"class":431},"stp6e","\\",[417,434,435],{"class":427},"Docs",[417,437,439],{"class":438},"sP7_E",";\n",[417,441,443],{"class":419,"line":442},2,[417,444,446],{"emptyLinePlaceholder":445},true,"\n",[417,448,450,453,456,459,462,464,467],{"class":419,"line":449},3,[417,451,452],{"class":423},"use",[417,454,428],{"class":455},"s_hVV",[417,457,432],{"class":458},"s39Yj",[417,460,461],{"class":455},"Models",[417,463,432],{"class":458},[417,465,466],{"class":455},"Order",[417,468,439],{"class":438},[417,470,472,474,477,479,482,484,487,489,492],{"class":419,"line":471},4,[417,473,452],{"class":423},[417,475,476],{"class":455}," Ark4ne",[417,478,432],{"class":458},[417,480,481],{"class":455},"OpenApi",[417,483,432],{"class":458},[417,485,486],{"class":455},"Context",[417,488,432],{"class":458},[417,490,491],{"class":455},"GenerationContext",[417,493,439],{"class":438},[417,495,497,499,501,503,505,507,509,511,514],{"class":419,"line":496},5,[417,498,452],{"class":423},[417,500,476],{"class":455},[417,502,432],{"class":458},[417,504,481],{"class":455},[417,506,432],{"class":458},[417,508,158],{"class":455},[417,510,432],{"class":458},[417,512,513],{"class":455},"SampleRequest",[417,515,439],{"class":438},[417,517,519,521,523,525,527,529,531,533,536],{"class":419,"line":518},6,[417,520,452],{"class":423},[417,522,476],{"class":455},[417,524,432],{"class":458},[417,526,481],{"class":455},[417,528,432],{"class":458},[417,530,158],{"class":455},[417,532,432],{"class":458},[417,534,535],{"class":455},"Sampler",[417,537,439],{"class":438},[417,539,541],{"class":419,"line":540},7,[417,542,446],{"emptyLinePlaceholder":445},[417,544,546,550,553,556,559],{"class":419,"line":545},8,[417,547,549],{"class":548},"sbsja","final",[417,551,552],{"class":548}," class",[417,554,555],{"class":427}," OrderSampler",[417,557,558],{"class":548}," implements",[417,560,561],{"class":427}," Sampler\n",[417,563,565],{"class":419,"line":564},9,[417,566,567],{"class":438},"{\n",[417,569,570,573,576,579,583,587],{"class":419,"line":29},[417,571,572],{"class":548},"    public",[417,574,575],{"class":548}," const",[417,577,578],{"class":455}," PRIORITY",[417,580,582],{"class":581},"smGrS"," =",[417,584,586],{"class":585},"srdBf"," 500",[417,588,439],{"class":438},[417,590,592],{"class":419,"line":591},11,[417,593,446],{"emptyLinePlaceholder":445},[417,595,597,599,602,606,609,612],{"class":419,"line":596},12,[417,598,572],{"class":548},[417,600,601],{"class":548}," function",[417,603,605],{"class":604},"sGLFI"," priority",[417,607,608],{"class":438},"()",[417,610,611],{"class":581},":",[417,613,614],{"class":423}," int\n",[417,616,618],{"class":419,"line":617},13,[417,619,620],{"class":438},"    {\n",[417,622,624,628,631,634,637],{"class":419,"line":623},14,[417,625,627],{"class":626},"sVHd0","        return",[417,629,630],{"class":548}," self",[417,632,633],{"class":581},"::",[417,635,636],{"class":455},"PRIORITY",[417,638,439],{"class":438},[417,640,642],{"class":419,"line":641},15,[417,643,644],{"class":438},"    }\n",[417,646,648],{"class":419,"line":647},16,[417,649,446],{"emptyLinePlaceholder":445},[417,651,653,655,657,660],{"class":419,"line":652},17,[417,654,572],{"class":548},[417,656,601],{"class":548},[417,658,659],{"class":604}," supports",[417,661,662],{"class":438},"(\n",[417,664,666,670,673,677],{"class":419,"line":665},18,[417,667,669],{"class":668},"sZMiF","        SampleRequest",[417,671,672],{"class":438}," $",[417,674,676],{"class":675},"su5hD","request",[417,678,679],{"class":438},",\n",[417,681,683,686,688,691],{"class":419,"line":682},19,[417,684,685],{"class":668},"        GenerationContext",[417,687,672],{"class":438},[417,689,690],{"class":675},"context",[417,692,679],{"class":438},[417,694,695,698,700,703],{"class":419,"line":58},[417,696,697],{"class":438},"    )",[417,699,611],{"class":581},[417,701,702],{"class":423}," bool",[417,704,705],{"class":438}," {\n",[417,707,709,711,713,715,718,721,724,727,729,732],{"class":419,"line":708},21,[417,710,627],{"class":626},[417,712,672],{"class":438},[417,714,676],{"class":675},[417,716,717],{"class":581},"->",[417,719,720],{"class":675},"target ",[417,722,723],{"class":581},"===",[417,725,726],{"class":668}," Order",[417,728,633],{"class":581},[417,730,731],{"class":423},"class",[417,733,439],{"class":438},[417,735,737],{"class":419,"line":736},22,[417,738,644],{"class":438},[417,740,742],{"class":419,"line":741},23,[417,743,446],{"emptyLinePlaceholder":445},[417,745,747,749,751,754],{"class":419,"line":746},24,[417,748,572],{"class":548},[417,750,601],{"class":548},[417,752,753],{"class":604}," sample",[417,755,662],{"class":438},[417,757,759,761,763,765],{"class":419,"line":758},25,[417,760,669],{"class":668},[417,762,672],{"class":438},[417,764,676],{"class":675},[417,766,679],{"class":438},[417,768,770,772,774,776],{"class":419,"line":769},26,[417,771,685],{"class":668},[417,773,672],{"class":438},[417,775,690],{"class":675},[417,777,679],{"class":438},[417,779,781,783,785,788],{"class":419,"line":780},27,[417,782,697],{"class":438},[417,784,611],{"class":581},[417,786,787],{"class":423}," array",[417,789,705],{"class":438},[417,791,793,795,799],{"class":419,"line":792},28,[417,794,627],{"class":626},[417,796,798],{"class":797},"sptTA"," array_map",[417,800,662],{"class":438},[417,802,804,807,810,813,816,818,821,824,826,828,831,834,836],{"class":419,"line":803},29,[417,805,806],{"class":548},"            static",[417,808,809],{"class":548}," fn",[417,811,812],{"class":438},"(",[417,814,815],{"class":423},"int",[417,817,672],{"class":438},[417,819,820],{"class":675},"i",[417,822,823],{"class":438},")",[417,825,611],{"class":581},[417,827,726],{"class":668},[417,829,830],{"class":438}," =>",[417,832,833],{"class":423}," new",[417,835,726],{"class":668},[417,837,838],{"class":438},"([\n",[417,840,841,845,849,852,854,856,858],{"class":419,"line":84},[417,842,844],{"class":843},"sjJ54","                '",[417,846,848],{"class":847},"s_sjI","id",[417,850,851],{"class":843},"'",[417,853,830],{"class":581},[417,855,672],{"class":438},[417,857,820],{"class":675},[417,859,679],{"class":438},[417,861,863,865,868,870,872,875,878,880],{"class":419,"line":862},31,[417,864,844],{"class":843},[417,866,867],{"class":847},"status",[417,869,851],{"class":843},[417,871,830],{"class":581},[417,873,874],{"class":843}," '",[417,876,877],{"class":847},"paid",[417,879,851],{"class":843},[417,881,679],{"class":438},[417,883,885,887,890,892,894,897,900,903,906,908,910],{"class":419,"line":884},32,[417,886,844],{"class":843},[417,888,889],{"class":847},"total",[417,891,851],{"class":843},[417,893,830],{"class":581},[417,895,896],{"class":585}," 19",[417,898,899],{"class":458},".",[417,901,902],{"class":585},"99",[417,904,905],{"class":581}," *",[417,907,672],{"class":438},[417,909,820],{"class":675},[417,911,679],{"class":438},[417,913,915],{"class":419,"line":914},33,[417,916,917],{"class":438},"            ]),\n",[417,919,921,924,926,929,932,934,936,938,941],{"class":419,"line":920},34,[417,922,923],{"class":797},"            range",[417,925,812],{"class":438},[417,927,928],{"class":585},"1",[417,930,931],{"class":438},",",[417,933,672],{"class":438},[417,935,676],{"class":675},[417,937,717],{"class":581},[417,939,940],{"class":675},"count",[417,942,943],{"class":438},"),\n",[417,945,947],{"class":419,"line":946},35,[417,948,949],{"class":438},"        );\n",[417,951,953],{"class":419,"line":952},36,[417,954,644],{"class":438},[417,956,958],{"class":419,"line":957},37,[417,959,960],{"class":438},"}\n",[405,962,963],{"v-slot:output":407},[409,964,968],{"className":965,"code":966,"language":967,"meta":407,"style":407},"language-json shiki shiki-themes material-theme-lighter github-light github-dark","{\n  \"type\": \"object\",\n  \"required\": [\"id\", \"status\", \"total\"],\n  \"properties\": {\n    \"id\": { \"type\": \"integer\", \"example\": 1 },\n    \"status\": { \"type\": \"string\", \"example\": \"paid\" },\n    \"total\": { \"type\": \"number\", \"example\": 19.99 }\n  }\n}\n","json",[337,969,970,974,998,1037,1050,1095,1140,1183,1188],{"__ignoreMap":407},[417,971,972],{"class":419,"line":420},[417,973,567],{"class":438},[417,975,976,979,983,986,988,991,994,996],{"class":419,"line":442},[417,977,978],{"class":458},"  \"",[417,980,982],{"class":981},"sseR_","type",[417,984,985],{"class":458},"\"",[417,987,611],{"class":438},[417,989,990],{"class":843}," \"",[417,992,993],{"class":847},"object",[417,995,985],{"class":843},[417,997,679],{"class":438},[417,999,1000,1002,1005,1007,1009,1012,1014,1016,1018,1020,1022,1024,1026,1028,1030,1032,1034],{"class":419,"line":449},[417,1001,978],{"class":458},[417,1003,1004],{"class":981},"required",[417,1006,985],{"class":458},[417,1008,611],{"class":438},[417,1010,1011],{"class":438}," [",[417,1013,985],{"class":843},[417,1015,848],{"class":847},[417,1017,985],{"class":843},[417,1019,931],{"class":438},[417,1021,990],{"class":843},[417,1023,867],{"class":847},[417,1025,985],{"class":843},[417,1027,931],{"class":438},[417,1029,990],{"class":843},[417,1031,889],{"class":847},[417,1033,985],{"class":843},[417,1035,1036],{"class":438},"],\n",[417,1038,1039,1041,1044,1046,1048],{"class":419,"line":471},[417,1040,978],{"class":458},[417,1042,1043],{"class":981},"properties",[417,1045,985],{"class":458},[417,1047,611],{"class":438},[417,1049,705],{"class":438},[417,1051,1052,1055,1057,1059,1061,1064,1066,1068,1070,1072,1074,1077,1079,1081,1083,1085,1087,1089,1092],{"class":419,"line":496},[417,1053,1054],{"class":458},"    \"",[417,1056,848],{"class":668},[417,1058,985],{"class":458},[417,1060,611],{"class":438},[417,1062,1063],{"class":438}," {",[417,1065,990],{"class":458},[417,1067,982],{"class":585},[417,1069,985],{"class":458},[417,1071,611],{"class":438},[417,1073,990],{"class":843},[417,1075,1076],{"class":847},"integer",[417,1078,985],{"class":843},[417,1080,931],{"class":438},[417,1082,990],{"class":458},[417,1084,400],{"class":585},[417,1086,985],{"class":458},[417,1088,611],{"class":438},[417,1090,1091],{"class":585}," 1",[417,1093,1094],{"class":438}," },\n",[417,1096,1097,1099,1101,1103,1105,1107,1109,1111,1113,1115,1117,1120,1122,1124,1126,1128,1130,1132,1134,1136,1138],{"class":419,"line":518},[417,1098,1054],{"class":458},[417,1100,867],{"class":668},[417,1102,985],{"class":458},[417,1104,611],{"class":438},[417,1106,1063],{"class":438},[417,1108,990],{"class":458},[417,1110,982],{"class":585},[417,1112,985],{"class":458},[417,1114,611],{"class":438},[417,1116,990],{"class":843},[417,1118,1119],{"class":847},"string",[417,1121,985],{"class":843},[417,1123,931],{"class":438},[417,1125,990],{"class":458},[417,1127,400],{"class":585},[417,1129,985],{"class":458},[417,1131,611],{"class":438},[417,1133,990],{"class":843},[417,1135,877],{"class":847},[417,1137,985],{"class":843},[417,1139,1094],{"class":438},[417,1141,1142,1144,1146,1148,1150,1152,1154,1156,1158,1160,1162,1165,1167,1169,1171,1173,1175,1177,1180],{"class":419,"line":540},[417,1143,1054],{"class":458},[417,1145,889],{"class":668},[417,1147,985],{"class":458},[417,1149,611],{"class":438},[417,1151,1063],{"class":438},[417,1153,990],{"class":458},[417,1155,982],{"class":585},[417,1157,985],{"class":458},[417,1159,611],{"class":438},[417,1161,990],{"class":843},[417,1163,1164],{"class":847},"number",[417,1166,985],{"class":843},[417,1168,931],{"class":438},[417,1170,990],{"class":458},[417,1172,400],{"class":585},[417,1174,985],{"class":458},[417,1176,611],{"class":438},[417,1178,1179],{"class":585}," 19.99",[417,1181,1182],{"class":438}," }\n",[417,1184,1185],{"class":419,"line":545},[417,1186,1187],{"class":438},"  }\n",[417,1189,1190],{"class":419,"line":564},[417,1191,960],{"class":438},[409,1193,1196],{"className":411,"code":1194,"filename":1195,"language":413,"meta":407,"style":407},"'extensions' => [\n    'samplers' => [App\\Docs\\OrderSampler::class],\n],\n","config\u002Fopenapi.php",[337,1197,1198,1212,1244],{"__ignoreMap":407},[417,1199,1200,1202,1205,1207,1209],{"class":419,"line":420},[417,1201,851],{"class":843},[417,1203,1204],{"class":847},"extensions",[417,1206,851],{"class":843},[417,1208,830],{"class":581},[417,1210,1211],{"class":438}," [\n",[417,1213,1214,1217,1220,1222,1224,1226,1229,1231,1233,1235,1238,1240,1242],{"class":419,"line":442},[417,1215,1216],{"class":843},"    '",[417,1218,1219],{"class":847},"samplers",[417,1221,851],{"class":843},[417,1223,830],{"class":581},[417,1225,1011],{"class":438},[417,1227,1228],{"class":455},"App",[417,1230,432],{"class":458},[417,1232,435],{"class":455},[417,1234,432],{"class":458},[417,1236,1237],{"class":668},"OrderSampler",[417,1239,633],{"class":581},[417,1241,731],{"class":423},[417,1243,1036],{"class":438},[417,1245,1246],{"class":419,"line":449},[417,1247,1036],{"class":438},[1249,1250,1252],"h2",{"id":1251},"the-sample-request","The sample request",[310,1254,1255,1265],{},[313,1256,1257],{},[316,1258,1259,1262],{},[319,1260,1261],{},"Property",[319,1263,1264],{},"Holds",[329,1266,1267,1277,1287],{},[316,1268,1269,1274],{},[334,1270,1271],{},[337,1272,1273],{},"target",[334,1275,1276],{},"the class to sample: the model a resource receives, or an enum",[316,1278,1279,1284],{},[334,1280,1281],{},[337,1282,1283],{},"resource",[334,1285,1286],{},"the resource that receives the samples, when there is one",[316,1288,1289,1293],{},[334,1290,1291],{},[337,1292,940],{},[334,1294,1295,1296,1299],{},"how many instances to return: 1 for a resource, ",[337,1297,1298],{},"sampling.collection_size"," for a collection",[302,1301,1302,1303,1305],{},"Return exactly ",[337,1304,940],{}," instances. Return different values from one instance to the next: a value that is the same in\nevery sample is read as a discriminator.",[1249,1307,1309],{"id":1308},"keep-the-database-clean","Keep the database clean",[302,1311,1312,1313,1315,1316,1319],{},"A sampler runs inside the sampling session: what it writes through Eloquent on a connection with a transaction is\nrolled back at the end of the generation. Prefer ",[337,1314,369],{}," and ",[337,1317,1318],{},"new Model([...])"," anyway: a sampler should not depend on\nthe transaction to leave the database as it was.",[1321,1322,1323],"note",{},[302,1324,1325,1326,1331],{},"To build what a single resource receives when it is not a model (a DTO, an array), use\n",[306,1327,1329],{"href":1328},"\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fsampling#resources-that-do-not-receive-a-model",[337,1330,348],{},"\non the resource: samplers are asked for models and enums.",[1333,1334,1335],"style",{},"html pre.shiki code .sw1J6, html code.shiki .sw1J6{--shiki-light:#F76D47;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .stp6e, html code.shiki .stp6e{--shiki-light:#39ADB5;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--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 .s39Yj, html code.shiki .s39Yj{--shiki-light:#39ADB5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--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 .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--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 .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--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 .sptTA, html code.shiki .sptTA{--shiki-light:#6182B8;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sseR_, html code.shiki .sseR_{--shiki-light:#9C3EDA;--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":407,"searchDepth":449,"depth":449,"links":1337},[1338,1339],{"id":1251,"depth":442,"text":1252},{"id":1308,"depth":442,"text":1309},"Build the samples of a model your own way, when its factory and its declared types are not enough.","md",{},"---\ntitle: Samplers\ndescription: Build the samples of a model your own way, when its factory and its declared types are not enough.\n---\n\nA sampler builds the instances a resource is run on (see\n[Sampling](\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fsampling)). The first sampler that supports the request, by\ndecreasing priority, builds the samples:\n\n| Built-in sampler | Priority | Samples |\n| --- | --- | --- |\n| `ResourceFactorySampler` | 400 | what the `#[ResourceFactory]` of the resource returns |\n| `ModelFactorySampler` | 300 | a model with a factory: `create()` in the transaction, else `make()` |\n| `EnumSampler` | 200 | the cases of an enum |\n| `FakeObjectSampler` | 100 | a model filled from its declared types, or a fake object |\n\nA sampler that throws lets the next one try. Write one when a model needs a particular state to render every key of\nits resource, and you would rather not change its factory:\n\n::example{input=\"app\u002FDocs\u002FOrderSampler.php\" output=\"components.schemas.Order\"}\n#input\n```php\nnamespace App\\Docs;\n\nuse App\\Models\\Order;\nuse Ark4ne\\OpenApi\\Context\\GenerationContext;\nuse Ark4ne\\OpenApi\\Sampling\\SampleRequest;\nuse Ark4ne\\OpenApi\\Sampling\\Sampler;\n\nfinal class OrderSampler implements Sampler\n{\n    public const PRIORITY = 500;\n\n    public function priority(): int\n    {\n        return self::PRIORITY;\n    }\n\n    public function supports(\n        SampleRequest $request,\n        GenerationContext $context,\n    ): bool {\n        return $request->target === Order::class;\n    }\n\n    public function sample(\n        SampleRequest $request,\n        GenerationContext $context,\n    ): array {\n        return array_map(\n            static fn(int $i): Order => new Order([\n                'id' => $i,\n                'status' => 'paid',\n                'total' => 19.99 * $i,\n            ]),\n            range(1, $request->count),\n        );\n    }\n}\n```\n#output\n```json\n{\n  \"type\": \"object\",\n  \"required\": [\"id\", \"status\", \"total\"],\n  \"properties\": {\n    \"id\": { \"type\": \"integer\", \"example\": 1 },\n    \"status\": { \"type\": \"string\", \"example\": \"paid\" },\n    \"total\": { \"type\": \"number\", \"example\": 19.99 }\n  }\n}\n```\n::\n\n```php [config\u002Fopenapi.php]\n'extensions' => [\n    'samplers' => [App\\Docs\\OrderSampler::class],\n],\n```\n\n## The sample request\n\n| Property | Holds |\n| --- | --- |\n| `target` | the class to sample: the model a resource receives, or an enum |\n| `resource` | the resource that receives the samples, when there is one |\n| `count` | how many instances to return: 1 for a resource, `sampling.collection_size` for a collection |\n\nReturn exactly `count` instances. Return different values from one instance to the next: a value that is the same in\nevery sample is read as a discriminator.\n\n## Keep the database clean\n\nA sampler runs inside the sampling session: what it writes through Eloquent on a connection with a transaction is\nrolled back at the end of the generation. Prefer `make()` and `new Model([...])` anyway: a sampler should not depend on\nthe transaction to leave the database as it was.\n\n::note\nTo build what a single resource receives when it is not a model (a DTO, an array), use\n[`#[ResourceFactory]`](\u002Flaravel-openapi-generator\u002Fdocumenting-endpoints\u002Fsampling#resources-that-do-not-receive-a-model)\non the resource: samplers are asked for models and enums.\n::\n",{"title":236,"description":1340},"CUELU04xedoltIlFXNdOaxoqhG7dw1KbqsN_fiuXqy4",[1347,1349],{"title":232,"path":233,"stem":234,"description":1348,"children":-1},"Add metadata to the operations, and name summaries, tags, operation ids and query parameters your own way.",{"title":240,"path":241,"stem":242,"description":1350,"children":-1},"Change the whole document with a pass, and tell the generator what a middleware of your application means.",1795438904369]