[{"data":1,"prerenderedAt":3445},["ShallowReactive",2],{"libs":3,"navigation-laravel-json-api":115,"\u002Flaravel-json-api\u002Fupgrade":294,"\u002Flaravel-json-api\u002Fupgrade-surround":3442},[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,165,187,216,234,248,282],{"title":117,"since":118,"experimental":119,"icon":120,"path":121,"stem":122,"children":123,"page":119},"Getting started",null,false,"i-lucide-rocket","\u002Flaravel-json-api\u002Fgetting-started","laravel-json-api\u002F1.getting-started",[124,127,131],{"title":125,"path":42,"stem":126,"since":118,"experimental":119},"Introduction","laravel-json-api\u002F1.getting-started\u002F1.introduction",{"title":128,"path":129,"stem":130,"since":118,"experimental":119},"Installation","\u002Flaravel-json-api\u002Fgetting-started\u002Finstallation","laravel-json-api\u002F1.getting-started\u002F2.installation",{"title":132,"path":133,"stem":134,"since":118,"experimental":119},"Quick start","\u002Flaravel-json-api\u002Fgetting-started\u002Fquick-start","laravel-json-api\u002F1.getting-started\u002F3.quick-start",{"title":136,"since":118,"experimental":119,"icon":137,"path":138,"stem":139,"children":140,"page":119},"Resources","i-lucide-box","\u002Flaravel-json-api\u002Fresources","laravel-json-api\u002F2.resources",[141,145,149,153,157,161],{"title":142,"path":143,"stem":144,"since":118,"experimental":119},"Anatomy of a resource","\u002Flaravel-json-api\u002Fresources\u002Fanatomy","laravel-json-api\u002F2.resources\u002F1.anatomy",{"title":146,"path":147,"stem":148,"since":118,"experimental":119},"Attributes & values","\u002Flaravel-json-api\u002Fresources\u002Fattributes","laravel-json-api\u002F2.resources\u002F2.attributes",{"title":150,"path":151,"stem":152,"since":118,"experimental":119},"Conditions","\u002Flaravel-json-api\u002Fresources\u002Fconditions","laravel-json-api\u002F2.resources\u002F3.conditions",{"title":154,"path":155,"stem":156,"since":118,"experimental":119},"Relationships","\u002Flaravel-json-api\u002Fresources\u002Frelationships","laravel-json-api\u002F2.resources\u002F4.relationships",{"title":158,"path":159,"stem":160,"since":118,"experimental":119},"Links & meta","\u002Flaravel-json-api\u002Fresources\u002Flinks-and-meta","laravel-json-api\u002F2.resources\u002F5.links-and-meta",{"title":162,"path":163,"stem":164,"since":118,"experimental":119},"Collections & pagination","\u002Flaravel-json-api\u002Fresources\u002Fcollections","laravel-json-api\u002F2.resources\u002F6.collections",{"title":166,"since":118,"experimental":119,"icon":167,"path":168,"stem":169,"children":170,"page":119},"Requests","i-lucide-arrow-down-up","\u002Flaravel-json-api\u002Frequests","laravel-json-api\u002F3.requests",[171,175,179,183],{"title":172,"path":173,"stem":174,"since":118,"experimental":119},"Includes & sparse fieldsets","\u002Flaravel-json-api\u002Frequests\u002Fincludes-and-fieldsets","laravel-json-api\u002F3.requests\u002F1.includes-and-fieldsets",{"title":176,"path":177,"stem":178,"since":118,"experimental":119},"Validating requests","\u002Flaravel-json-api\u002Frequests\u002Fvalidation","laravel-json-api\u002F3.requests\u002F2.validation",{"title":180,"path":181,"stem":182,"since":118,"experimental":119},"Write requests","\u002Flaravel-json-api\u002Frequests\u002Fwrite-requests","laravel-json-api\u002F3.requests\u002F3.write-requests",{"title":184,"path":185,"stem":186,"since":118,"experimental":119},"Errors & content negotiation","\u002Flaravel-json-api\u002Frequests\u002Ferrors","laravel-json-api\u002F3.requests\u002F4.errors",{"title":188,"since":118,"experimental":119,"icon":50,"path":189,"stem":190,"children":191,"page":119},"API revisions","\u002Flaravel-json-api\u002Frevisions","laravel-json-api\u002F4.revisions",[192,196,200,204,208,212],{"title":193,"path":194,"stem":195,"since":118,"experimental":119},"Overview & declaring revisions","\u002Flaravel-json-api\u002Frevisions\u002Foverview","laravel-json-api\u002F4.revisions\u002F1.overview",{"title":197,"path":198,"stem":199,"since":118,"experimental":119},"Changing a field","\u002Flaravel-json-api\u002Frevisions\u002Fchanging-a-field","laravel-json-api\u002F4.revisions\u002F2.changing-a-field",{"title":201,"path":202,"stem":203,"since":118,"experimental":119},"Adding, removing, new types","\u002Flaravel-json-api\u002Frevisions\u002Fadding-and-removing","laravel-json-api\u002F4.revisions\u002F3.adding-and-removing",{"title":205,"path":206,"stem":207,"since":118,"experimental":119},"Guards","\u002Flaravel-json-api\u002Frevisions\u002Fguards","laravel-json-api\u002F4.revisions\u002F4.guards",{"title":209,"path":210,"stem":211,"since":118,"experimental":119},"Write requests across revisions","\u002Flaravel-json-api\u002Frevisions\u002Fwrite-requests","laravel-json-api\u002F4.revisions\u002F5.write-requests",{"title":213,"path":214,"stem":215,"since":118,"experimental":119},"Checking & retiring a revision","\u002Flaravel-json-api\u002Frevisions\u002Fchecking-and-retiring","laravel-json-api\u002F4.revisions\u002F6.checking-and-retiring",{"title":217,"since":118,"experimental":119,"icon":218,"path":219,"stem":220,"children":221,"page":119},"Tooling","i-lucide-wrench","\u002Flaravel-json-api\u002Ftooling","laravel-json-api\u002F5.tooling",[222,226,230],{"title":223,"path":224,"stem":225,"since":118,"experimental":119},"Checking resources","\u002Flaravel-json-api\u002Ftooling\u002Fchecking-resources","laravel-json-api\u002F5.tooling\u002F1.checking-resources",{"title":227,"path":228,"stem":229,"since":118,"experimental":119},"Static analysis","\u002Flaravel-json-api\u002Ftooling\u002Fstatic-analysis","laravel-json-api\u002F5.tooling\u002F2.static-analysis",{"title":231,"path":232,"stem":233,"since":118,"experimental":119},"Deployment","\u002Flaravel-json-api\u002Ftooling\u002Fdeployment","laravel-json-api\u002F5.tooling\u002F3.deployment",{"title":235,"since":118,"experimental":119,"icon":236,"path":237,"stem":238,"children":239,"page":119},"Integrations","i-lucide-plug","\u002Flaravel-json-api\u002Fintegrations","laravel-json-api\u002F6.integrations",[240,244],{"title":241,"path":242,"stem":243,"since":118,"experimental":119},"Laravel's native JSON:API","\u002Flaravel-json-api\u002Fintegrations\u002Fnative-json-api","laravel-json-api\u002F6.integrations\u002F1.native-json-api",{"title":245,"path":246,"stem":247,"since":118,"experimental":119},"OpenAPI","\u002Flaravel-json-api\u002Fintegrations\u002Fopenapi","laravel-json-api\u002F6.integrations\u002F2.openapi",{"title":249,"since":118,"experimental":119,"icon":250,"path":251,"stem":252,"children":253,"page":119},"Reference","i-lucide-library","\u002Flaravel-json-api\u002Freference","laravel-json-api\u002F7.reference",[254,258,262,266,270,274,278],{"title":255,"path":256,"stem":257,"since":118,"experimental":119},"Configuration","\u002Flaravel-json-api\u002Freference\u002Fconfiguration","laravel-json-api\u002F7.reference\u002F1.configuration",{"title":259,"path":260,"stem":261,"since":118,"experimental":119},"Value helpers","\u002Flaravel-json-api\u002Freference\u002Fvalue-helpers","laravel-json-api\u002F7.reference\u002F2.value-helpers",{"title":263,"path":264,"stem":265,"since":118,"experimental":119},"Relation helpers","\u002Flaravel-json-api\u002Freference\u002Frelation-helpers","laravel-json-api\u002F7.reference\u002F3.relation-helpers",{"title":267,"path":268,"stem":269,"since":118,"experimental":119},"PHP attributes","\u002Flaravel-json-api\u002Freference\u002Fphp-attributes","laravel-json-api\u002F7.reference\u002F4.php-attributes",{"title":271,"path":272,"stem":273,"since":118,"experimental":119},"Commands","\u002Flaravel-json-api\u002Freference\u002Fcommands","laravel-json-api\u002F7.reference\u002F5.commands",{"title":275,"path":276,"stem":277,"since":118,"experimental":119},"Diagnostics","\u002Flaravel-json-api\u002Freference\u002Fdiagnostics","laravel-json-api\u002F7.reference\u002F6.diagnostics",{"title":279,"path":280,"stem":281,"since":118,"experimental":119},"Extension points","\u002Flaravel-json-api\u002Freference\u002Fextension-points","laravel-json-api\u002F7.reference\u002F7.extension-points",{"title":283,"path":284,"children":285},"Releases","\u002Flaravel-json-api\u002Freleases",[286,290],{"title":287,"path":288,"stem":289,"since":118,"experimental":119},"Upgrade guide","\u002Flaravel-json-api\u002Fupgrade","laravel-json-api\u002FUPGRADE",{"title":291,"path":292,"stem":293,"since":118,"experimental":119},"Changelog","\u002Flaravel-json-api\u002Fchangelog","laravel-json-api\u002FCHANGELOG",{"id":295,"title":287,"body":296,"description":1011,"experimental":119,"extension":3437,"links":118,"meta":3438,"navigation":1079,"path":288,"rawbody":3439,"seo":3440,"since":118,"stem":289,"__hash__":3441},"laravel_json_api\u002Flaravel-json-api\u002FUPGRADE.md",{"type":297,"value":298,"toc":3403},"minimark",[299,303,308,317,322,335,341,344,688,714,718,768,895,901,945,963,967,973,984,987,998,1002,1005,1115,1119,1137,1205,1208,1218,1222,1490,1494,1514,1573,1581,1585,1861,1865,1891,2052,2056,2077,2142,2157,2161,2203,2214,2218,2238,2255,2268,2285,2306,2406,2431,2439,2457,2464,2521,2616,2635,2639,2664,2667,2818,2822,2828,2877,2881,2905,2960,2964,3212,3216,3278,3283,3307,3311,3328,3331,3370,3387,3390,3399],[300,301,287],"h1",{"id":302},"upgrade-guide",[304,305,307],"h2",{"id":306},"from-20-to-30","From 2.0 to 3.0",[309,310,311,312,316],"p",{},"The design behind these changes is ",[313,314,315],"code",{},"docs\u002Frfc\u002Fapi-revisions-integration.md",".",[318,319,321],"h3",{"id":320},"requirements","Requirements",[309,323,324,326,327,330,331,334],{},[313,325,59],{}," ",[313,328,329],{},"^1.0"," is required and installed with the package; ",[313,332,333],{},"JsonApiServiceProvider"," registers its\nprovider. An application that declares no revision configures nothing: it keeps one shape, the head.",[318,336,338,339],{"id":337},"values-are-declared-and-rendered-by-ark4nelaravel-api-revisions","Values are declared, and rendered by ",[313,340,59],{},[309,342,343],{},"The helpers keep their names and return the descriptors of the base. What changes in a resource:",[345,346,347,360],"table",{},[348,349,350],"thead",{},[351,352,353,357],"tr",{},[354,355,356],"th",{},"2.0",[354,358,359],{},"3.0",[361,362,363,381,401,415,435,447,460,479,492,508,521,539,560,587,604,617,636,646,666],"tbody",{},[351,364,365,372],{},[366,367,368,371],"td",{},[313,369,370],{},"'name' => $this->resource->name"," (a plain value)",[366,373,374,377,378],{},[313,375,376],{},"'name' => $this->string()",", or a closure: ",[313,379,380],{},"'name' => fn() => $this->resource->name",[351,382,383,392],{},[366,384,385,388,389],{},[313,386,387],{},"toResourceMeta()"," returning ",[313,390,391],{},"['version' => 3]",[366,393,394,397,398],{},[313,395,396],{},"['version' => fn() => 3]",", or ",[313,399,400],{},"$this->integer(fn() => 3)",[351,402,403,410],{},[366,404,405,406,409],{},"a member without name (",[313,407,408],{},"$this->string('email')",")",[366,411,412],{},[313,413,414],{},"'email' => $this->string()",[351,416,417,427],{},[366,418,419,422,423,426],{},[313,420,421],{},"$this->when($condition, $value)",", ",[313,424,425],{},"$this->whenHas('email')"," in a hook",[366,428,429,422,432],{},[313,430,431],{},"$this->string()->when(fn() => …)",[313,433,434],{},"->whenHas()",[351,436,437,442],{},[366,438,439],{},[313,440,441],{},"$this->mergeWhen($condition, [...])",[366,443,444],{},[313,445,446],{},"$this->applyWhen(fn() => $condition, [...])",[351,448,449,454],{},[366,450,451],{},[313,452,453],{},"$this->applyWhen($bool, [...])",[366,455,456,459],{},[313,457,458],{},"$this->applyWhen(fn() => $bool, [...])",": a closure, read for each resource",[351,461,462,470],{},[366,463,464,422,467],{},[313,465,466],{},"->when(true)",[313,468,469],{},"->when(fn(Request $request, $model, string $attribute) => …)",[366,471,472,475,476,409],{},[313,473,474],{},"->when(fn($model, string $attribute) => …)",", run before the value as in 2.0; the request is the one of the hook (",[313,477,478],{},"use ($request)",[351,480,481,486],{},[366,482,483],{},[313,484,485],{},"$this->whenInFields($request, 'name', $value)",[366,487,488,489],{},"the value is a descriptor or a closure: ",[313,490,491],{},"$this->whenInFields($request, 'name', fn() => $value)",[351,493,494,502],{},[366,495,496,422,499],{},[313,497,498],{},"$this->enum()->of(State::class)",[313,500,501],{},"$this->enum()",[366,503,504,507],{},[313,505,506],{},"$this->enum(State::class)"," (a backed enum)",[351,509,510,515],{},[366,511,512],{},[313,513,514],{},"$this->struct(fn() => ['city' => $this->string()])",[366,516,517,520],{},[313,518,519],{},"$this->struct(['city' => $this->string()])","; with a source, the members are read on its value",[351,522,523,531],{},[366,524,525,422,528],{},[313,526,527],{},"$this->array()->of($this->string())",[313,529,530],{},"->of('money')",[366,532,533,422,536],{},[313,534,535],{},"$this->arrayOf($this->string())",[313,537,538],{},"$this->arrayOf($this->money())",[351,540,541,549],{},[366,542,543,422,546],{},[313,544,545],{},"$this->float()->precision(1)",[313,547,548],{},"->truncate()",[366,550,551,552,555,556,559],{},"unchanged: ",[313,553,554],{},"$this->float()"," returns ",[313,557,558],{},"Descriptors\\Schemas\\FloatSchema",", a float of the base that rounds",[351,561,562,579],{},[366,563,564,567,568,571,572,575,576],{},[313,565,566],{},"->nullable(false)"," rendering ",[313,569,570],{},"0"," or ",[313,573,574],{},"''"," for ",[313,577,578],{},"null",[366,580,581,583,584,409],{},[313,582,578],{}," is a value error (",[313,585,586],{},"revisions.strict_values",[351,588,589,594],{},[366,590,591],{},[313,592,593],{},"->was(X, value: $this->integer())",[366,595,596,599,600,603],{},[313,597,598],{},"->was(X, schema: $this->integer())",", with ",[313,601,602],{},"down:"," when the base knows no conversion",[351,605,606,612],{},[366,607,608,611],{},[313,609,610],{},"->was(X, value: $this->one(OldResource::class))"," on a relationship",[366,613,614],{},[313,615,616],{},"->was(X, schema: $this->one(OldResource::class))",[351,618,619,629],{},[366,620,621,622,625,626],{},"a descriptor with ",[313,623,624],{},"was()"," in ",[313,627,628],{},"toLinks()",[366,630,631,632,635],{},"a plain link; compute it with ",[313,633,634],{},"ApiRevision::current()"," if it changes",[351,637,638,643],{},[366,639,640],{},[313,641,642],{},"protected static function toDefinition()",[366,644,645],{},"removed: the definition is compiled from the hooks",[351,647,648,656],{},[366,649,650,422,653],{},[313,651,652],{},"JsonApi::valueType('money', MoneyValue::class)",[313,654,655],{},"describer.types",[366,657,658,659,662,663],{},"a ",[313,660,661],{},"Descriptor"," of the base registered with ",[313,664,665],{},"TypeRegistry::register('money', MoneySchema::class)",[351,667,668,676],{},[366,669,670,422,673],{},[313,671,672],{},"describer.datetime",[313,674,675],{},"describer.strict",[366,677,678,422,681,684,685],{},[313,679,680],{},"date_time_format",[313,682,683],{},"strict_values"," of ",[313,686,687],{},"config\u002Frevisions.php",[309,689,690,691,695,696,699,700,702,703,422,706,709,710,713],{},"The hooks of values run ",[692,693,694],"strong",{},"once per response",", on a template instance whose ",[313,697,698],{},"$this->resource"," is set to each model\nbefore its values are read: a closure reading ",[313,701,698],{}," works as before, an expression evaluated in the hook\n(",[313,704,705],{},"$this->resource->name",[313,707,708],{},"$request->user()->isAdmin()"," as a plain boolean) is the same for every resource and is\nrefused where it would be a value. ",[313,711,712],{},"php artisan jsonapi:check"," names every member to rewrite.",[318,715,717],{"id":716},"definitions","Definitions",[309,719,720,723,724,727,728,730,731,733,734,422,737,740,741,744,745,748,749,751,752,755,756,759,760,763,764,767],{},[313,721,722],{},"Definitions::for($class, $revision)"," gives one definition per revision; ",[313,725,726],{},"ResourceDefinition::$revision"," is ",[313,729,578],{}," for\nthe head (the newest revision). Its values are the model of ",[313,732,59],{},": ",[313,735,736],{},"$attributes",[313,738,739],{},"$meta","\nand ",[313,742,743],{},"$documentMeta"," are ",[313,746,747],{},"Shape","s (",[313,750,578],{}," where the resource has no values), ",[313,753,754],{},"attribute($name)"," a ",[313,757,758],{},"FieldDefinition","\nread by its name at the revision. ",[313,761,762],{},"Definition\\AttributeDefinition"," and ",[313,765,766],{},"ValueType"," are removed:",[345,769,770,778],{},[348,771,772],{},[351,773,774,776],{},[354,775,356],{},[354,777,359],{},[361,779,780,792,808,835,857,869,882],{},[351,781,782,787],{},[366,783,784],{},[313,785,786],{},"array_keys($definition->attributes)",[366,788,789],{},[313,790,791],{},"$definition->attributes?->names()",[351,793,794,799],{},[366,795,796],{},[313,797,798],{},"$attribute->type === ValueType::String",[366,800,801,804,805,409],{},[313,802,803],{},"$attribute->type->kind === Kind::String"," (",[313,806,807],{},"Ark4ne\\ApiRevisions\\Definition\\Kind",[351,809,810,824],{},[366,811,812,422,815,422,818,422,821],{},[313,813,814],{},"$attribute->format",[313,816,817],{},"->enum",[313,819,820],{},"->items",[313,822,823],{},"->children",[366,825,826,422,829,422,831,422,833],{},[313,827,828],{},"$attribute->type->format",[313,830,817],{},[313,832,820],{},[313,834,823],{},[351,836,837,845],{},[366,838,839,840,763,842],{},"a custom type: its ",[313,841,766],{},[313,843,844],{},"format",[366,846,847,422,850,853,854],{},[313,848,849],{},"Kind::Custom",[313,851,852],{},"$attribute->type->name"," and its JSON Schema ",[313,855,856],{},"->fragment",[351,858,859,864],{},[366,860,861],{},[313,862,863],{},"$attribute->sparse",[366,865,866],{},[313,867,868],{},"$definition->isSparse($name)",[351,870,871,877],{},[366,872,873,876],{},[313,874,875],{},"$definition->links"," (definitions by name)",[366,878,879,881],{},[313,880,875],{},", the names",[351,883,884,892],{},[366,885,886,422,889],{},[313,887,888],{},"$attribute->source",[313,890,891],{},"->computed",[366,893,894],{},"removed",[309,896,897,900],{},[313,898,899],{},"jsonapi:cache"," writes every revision, without the shapes (those of the base): run it again after the upgrade; a file\nof 2.0 is ignored.",[309,902,903,763,905,908,909,911,912,915,916,763,919,744,922,422,925,928,929,932,933,936,937,940,941,944],{},[313,904,712],{},[313,906,907],{},"ResourceAssertions"," run the check of ",[313,910,59],{}," on the\nresources: the history of their fields is checked with its codes, and the diagnostics ",[313,913,914],{},"reserved-name",",\n",[313,917,918],{},"name-collision",[313,920,921],{},"unavailable-resource",[313,923,924],{},"jsonapi-reserved-name",[313,926,927],{},"jsonapi-name-collision"," and\n",[313,930,931],{},"jsonapi-absent-resource",". They are no longer among ",[313,934,935],{},"ResourceDefinition::$diagnostics",": a tool reading them there\ncalls ",[313,938,939],{},"Compilation\\ResourceChecker",". ",[313,942,943],{},"php artisan revision:check"," checks every declaring class of the application,\nrequests included, and its lock.",[309,946,947,948,951,952,955,956,422,959,962],{},"A body that changes across the revisions is declared in the ",[313,949,950],{},"body()"," of a request using ",[313,953,954],{},"RevisionedRequest","\n(",[313,957,958],{},"$this->resourceObject(attributes: …, relationships: …)",[313,960,961],{},"Http\\Body","): see the README, \"Write requests across\nrevisions\".",[304,964,966],{"id":965},"from-1x-to-20","From 1.x to 2.0",[968,969,970],"blockquote",{},[309,971,972],{},"This section gives the code of 2.0. Upgrading from 1.x to 3.0, apply it, then \"From 2.0 to 3.0\" above, whose\ntables replace what 3.0 changed again (values, value types, configuration of the dates, definitions).",[309,974,975,976,979,980,983],{},"Coding agents can follow the ",[313,977,978],{},"laravel-json-api-upgrade"," skill shipped in the package\n(",[313,981,982],{},"vendor\u002Fark4ne\u002Flaravel-json-api\u002Fskills\u002Flaravel-json-api-upgrade\u002F","): the same changes as a procedure, with a mapping\nof every 1.x construct and tested examples.",[318,985,321],{"id":986},"requirements-1",[309,988,989,990,992,993,571,996,316],{},"PHP ",[313,991,10],{}," and Laravel ",[313,994,995],{},"^12.46",[313,997,74],{},[318,999,1001],{"id":1000},"descriptors-are-immutable","Descriptors are immutable",[309,1003,1004],{},"Every fluent method of a descriptor returns a copy. Chained calls are unchanged; a descriptor modified on its own line\nmust keep the returned value:",[1006,1007,1012],"pre",{"className":1008,"code":1009,"language":1010,"meta":1011,"style":1011},"language-php shiki shiki-themes material-theme-lighter github-light github-dark","\u002F\u002F 1.x\n$title = $this->string();\n$title->nullable(false);\n\n\u002F\u002F 2.0\n$title = $this->string()->nullable(false);\n","php","",[313,1013,1014,1023,1052,1074,1081,1087],{"__ignoreMap":1011},[1015,1016,1019],"span",{"class":1017,"line":1018},"line",1,[1015,1020,1022],{"class":1021},"sutJx","\u002F\u002F 1.x\n",[1015,1024,1026,1030,1034,1038,1042,1045,1049],{"class":1017,"line":1025},2,[1015,1027,1029],{"class":1028},"sP7_E","$",[1015,1031,1033],{"class":1032},"su5hD","title ",[1015,1035,1037],{"class":1036},"smGrS","=",[1015,1039,1041],{"class":1040},"s39Yj"," $this",[1015,1043,1044],{"class":1036},"->",[1015,1046,1048],{"class":1047},"sGLFI","string",[1015,1050,1051],{"class":1028},"();\n",[1015,1053,1055,1057,1060,1062,1065,1068,1071],{"class":1017,"line":1054},3,[1015,1056,1029],{"class":1028},[1015,1058,1059],{"class":1032},"title",[1015,1061,1044],{"class":1036},[1015,1063,1064],{"class":1047},"nullable",[1015,1066,1067],{"class":1028},"(",[1015,1069,1070],{"class":1040},"false",[1015,1072,1073],{"class":1028},");\n",[1015,1075,1077],{"class":1017,"line":1076},4,[1015,1078,1080],{"emptyLinePlaceholder":1079},true,"\n",[1015,1082,1084],{"class":1017,"line":1083},5,[1015,1085,1086],{"class":1021},"\u002F\u002F 2.0\n",[1015,1088,1090,1092,1094,1096,1098,1100,1102,1105,1107,1109,1111,1113],{"class":1017,"line":1089},6,[1015,1091,1029],{"class":1028},[1015,1093,1033],{"class":1032},[1015,1095,1037],{"class":1036},[1015,1097,1041],{"class":1040},[1015,1099,1044],{"class":1036},[1015,1101,1048],{"class":1047},[1015,1103,1104],{"class":1028},"()",[1015,1106,1044],{"class":1036},[1015,1108,1064],{"class":1047},[1015,1110,1067],{"class":1028},[1015,1112,1070],{"class":1040},[1015,1114,1073],{"class":1028},[318,1116,1118],{"id":1117},"service-provider","Service provider",[309,1120,1121,1122,1125,1126,625,1129,1132,1133,1136],{},"The provider is now ",[313,1123,1124],{},"Ark4ne\\JsonApi\\Laravel\\JsonApiServiceProvider",". Package discovery registers it; if your\napplication lists ",[313,1127,1128],{},"Ark4ne\\JsonApi\\Providers\\LaravelJsonApiProvider",[313,1130,1131],{},"bootstrap\u002Fproviders.php"," or\n",[313,1134,1135],{},"config\u002Fapp.php",", replace it:",[1006,1138,1140],{"className":1008,"code":1139,"language":1010,"meta":1011,"style":1011},"\u002F\u002F 1.x\nArk4ne\\JsonApi\\Providers\\LaravelJsonApiProvider::class,\n\u002F\u002F 2.0\nArk4ne\\JsonApi\\Laravel\\JsonApiServiceProvider::class,\n",[313,1141,1142,1146,1178,1182],{"__ignoreMap":1011},[1015,1143,1144],{"class":1017,"line":1018},[1015,1145,1022],{"class":1021},[1015,1147,1148,1152,1155,1158,1160,1163,1165,1169,1172,1176],{"class":1017,"line":1025},[1015,1149,1151],{"class":1150},"s_hVV","Ark4ne",[1015,1153,1154],{"class":1040},"\\",[1015,1156,1157],{"class":1150},"JsonApi",[1015,1159,1154],{"class":1040},[1015,1161,1162],{"class":1150},"Providers",[1015,1164,1154],{"class":1040},[1015,1166,1168],{"class":1167},"sZMiF","LaravelJsonApiProvider",[1015,1170,1171],{"class":1036},"::",[1015,1173,1175],{"class":1174},"sw1J6","class",[1015,1177,915],{"class":1028},[1015,1179,1180],{"class":1017,"line":1054},[1015,1181,1086],{"class":1021},[1015,1183,1184,1186,1188,1190,1192,1195,1197,1199,1201,1203],{"class":1017,"line":1076},[1015,1185,1151],{"class":1150},[1015,1187,1154],{"class":1040},[1015,1189,1157],{"class":1150},[1015,1191,1154],{"class":1040},[1015,1193,1194],{"class":1150},"Laravel",[1015,1196,1154],{"class":1040},[1015,1198,333],{"class":1167},[1015,1200,1171],{"class":1036},[1015,1202,1175],{"class":1174},[1015,1204,915],{"class":1028},[318,1206,255],{"id":1207},"configuration",[309,1209,1210,1213,1214,1217],{},[313,1211,1212],{},"config\u002Fjsonapi.php"," is validated at boot: a value of the wrong type throws an ",[313,1215,1216],{},"InvalidConfigurationException"," that\nnames the key. Compare your published file with the package one for the new keys.",[318,1219,1221],{"id":1220},"values","Values",[1223,1224,1225,1341,1372,1397,1410],"ul",{},[1226,1227,1228,804,1234,422,1237,1240,1241,1244,1245,1247,1248,1251,1252,1255,1256,1259,1260,1263,1264,1266,1267,1269,1270,1272,1273,940,1275,1278,1279,316,1282],"li",{},[692,1229,1230,1233],{},[313,1231,1232],{},"$this->date()"," renders a date without time",[313,1235,1236],{},"2026-10-31",[313,1238,1239],{},"Y-m-d","); a date and time is ",[313,1242,1243],{},"$this->datetime()",",\nin the format of ",[313,1246,672],{}," (ex-",[313,1249,1250],{},"describer.date",", ATOM by default). Replace ",[313,1253,1254],{},"->date("," by ",[313,1257,1258],{},"->datetime(","\nwherever the time is rendered: a resource left with ",[313,1261,1262],{},"date()"," loses the time without error. A published\n",[313,1265,1212],{}," still setting ",[313,1268,1250],{}," throws an ",[313,1271,1216],{}," at boot: rename it\n",[313,1274,672],{},[313,1276,1277],{},"Values\\ValueDate"," is the date without time; the 1.x class is\n",[313,1280,1281],{},"Values\\ValueDateTime",[1006,1283,1285],{"className":1008,"code":1284,"language":1010,"meta":1011,"style":1011},"\u002F\u002F 1.x: 2026-10-31T10:00:00+00:00\n'published-at' => $this->date(),\n\u002F\u002F 2.0: the same output\n'published-at' => $this->datetime(),\n",[313,1286,1287,1292,1317,1322],{"__ignoreMap":1011},[1015,1288,1289],{"class":1017,"line":1018},[1015,1290,1291],{"class":1021},"\u002F\u002F 1.x: 2026-10-31T10:00:00+00:00\n",[1015,1293,1294,1298,1302,1304,1307,1309,1311,1314],{"class":1017,"line":1025},[1015,1295,1297],{"class":1296},"sjJ54","'",[1015,1299,1301],{"class":1300},"s_sjI","published-at",[1015,1303,1297],{"class":1296},[1015,1305,1306],{"class":1036}," =>",[1015,1308,1041],{"class":1040},[1015,1310,1044],{"class":1036},[1015,1312,1313],{"class":1047},"date",[1015,1315,1316],{"class":1028},"(),\n",[1015,1318,1319],{"class":1017,"line":1054},[1015,1320,1321],{"class":1021},"\u002F\u002F 2.0: the same output\n",[1015,1323,1324,1326,1328,1330,1332,1334,1336,1339],{"class":1017,"line":1076},[1015,1325,1297],{"class":1296},[1015,1327,1301],{"class":1300},[1015,1329,1297],{"class":1296},[1015,1331,1306],{"class":1036},[1015,1333,1041],{"class":1040},[1015,1335,1044],{"class":1036},[1015,1337,1338],{"class":1047},"datetime",[1015,1340,1316],{"class":1028},[1226,1342,1343,1344,1347,1348,575,1351,1354,1355,1358,1359,575,1362,1364,1365,1368,1369,1371],{},"A float with a precision is rounded instead of floored: ",[313,1345,1346],{},"$this->float()->precision(2)"," renders ",[313,1349,1350],{},"1.24",[313,1352,1353],{},"1.239","\n(1.x: ",[313,1356,1357],{},"1.23","), ",[313,1360,1361],{},"1.15",[313,1363,1361],{}," (1.x: ",[313,1366,1367],{},"1.14","). Add ",[313,1370,548],{}," to truncate.",[1226,1373,1374,1375,1347,1378,575,1380,1364,1382,1385,1386,1388,1389,1392,1393,1396],{},"A date declared ",[313,1376,1377],{},"nullable(false)",[313,1379,578],{},[313,1381,578],{},[313,1383,1384],{},"1970-01-01T00:00:00+00:00","). With\n",[313,1387,675],{},", true by default when ",[313,1390,1391],{},"APP_DEBUG"," is, it throws a ",[313,1394,1395],{},"RenderingException"," instead: make the value\nnullable, or give it a value.",[1226,1398,1399,1402,1403,1405,1406,1409],{},[313,1400,1401],{},"enum()->of(State::class)"," validates the value: a raw value is cast through the enum, and a value that is not one\nof its cases throws a ",[313,1404,1395],{},". Remove ",[313,1407,1408],{},"of()",", or fix the data, where a value outside the enum is\nexpected.",[1226,1411,1412,1413,1416,1417,1473,1476,1479,1480,422,1483,422,1486,1489],{},"A custom value extending ",[313,1414,1415],{},"Descriptors\\Values\\Value"," receives the configuration:",[1006,1418,1420],{"className":1008,"code":1419,"language":1010,"meta":1011,"style":1011},"protected function value(mixed $of, Request $request, Configuration $configuration): mixed\n",[313,1421,1422],{"__ignoreMap":1011},[1015,1423,1424,1428,1431,1434,1436,1439,1442,1445,1448,1451,1453,1456,1458,1461,1463,1465,1467,1470],{"class":1017,"line":1018},[1015,1425,1427],{"class":1426},"sbsja","protected",[1015,1429,1430],{"class":1426}," function",[1015,1432,1433],{"class":1047}," value",[1015,1435,1067],{"class":1028},[1015,1437,1438],{"class":1174},"mixed",[1015,1440,1441],{"class":1028}," $",[1015,1443,1444],{"class":1032},"of",[1015,1446,1447],{"class":1028},",",[1015,1449,1450],{"class":1167}," Request",[1015,1452,1441],{"class":1028},[1015,1454,1455],{"class":1032},"request",[1015,1457,1447],{"class":1028},[1015,1459,1460],{"class":1167}," Configuration",[1015,1462,1441],{"class":1028},[1015,1464,1207],{"class":1032},[1015,1466,409],{"class":1028},[1015,1468,1469],{"class":1036},":",[1015,1471,1472],{"class":1174}," mixed\n",[1474,1475],"br",{},[313,1477,1478],{},"Support\\Config"," is removed: read the defaults (",[313,1481,1482],{},"$configuration->nullable",[313,1484,1485],{},"datetimeFormat",[313,1487,1488],{},"precision",") from it.",[318,1491,1493],{"id":1492},"collections","Collections",[309,1495,1496,1499,1500,1503,1504,1507,1508,1511,1512,1469],{},[313,1497,1498],{},"collection()"," returns a ",[313,1501,1502],{},"JsonApiCollection",", no longer an anonymous subclass. ",[313,1505,1506],{},"$preserveKeys"," is ignored: ",[313,1509,1510],{},"data"," is a\nJSON list whatever the keys of the collection. To return a collection class of your own, override ",[313,1513,1498],{},[1006,1515,1517],{"className":1008,"code":1516,"language":1010,"meta":1011,"style":1011},"public static function collection($resource): UserCollection\n{\n    return new UserCollection($resource);\n}\n",[313,1518,1519,1545,1550,1568],{"__ignoreMap":1011},[1015,1520,1521,1524,1527,1529,1532,1535,1538,1540,1542],{"class":1017,"line":1018},[1015,1522,1523],{"class":1426},"public",[1015,1525,1526],{"class":1426}," static",[1015,1528,1430],{"class":1426},[1015,1530,1531],{"class":1047}," collection",[1015,1533,1534],{"class":1028},"($",[1015,1536,1537],{"class":1032},"resource",[1015,1539,409],{"class":1028},[1015,1541,1469],{"class":1036},[1015,1543,1544],{"class":1167}," UserCollection\n",[1015,1546,1547],{"class":1017,"line":1025},[1015,1548,1549],{"class":1028},"{\n",[1015,1551,1552,1556,1559,1562,1564,1566],{"class":1017,"line":1054},[1015,1553,1555],{"class":1554},"sVHd0","    return",[1015,1557,1558],{"class":1174}," new",[1015,1560,1561],{"class":1167}," UserCollection",[1015,1563,1534],{"class":1028},[1015,1565,1537],{"class":1032},[1015,1567,1073],{"class":1028},[1015,1569,1570],{"class":1017,"line":1076},[1015,1571,1572],{"class":1028},"}\n",[309,1574,1575,727,1578,1580],{},[313,1576,1577],{},"float()",[313,1579,1427],{},", like the other value helpers: call it from the resource only.",[318,1582,1584],{"id":1583},"relationships-and-loading","Relationships and loading",[1223,1586,1587,1609,1742,1762,1775,1785,1794,1805,1826,1844],{},[1226,1588,1589,1592,1593,733,1596,575,1599,1602,1603,804,1605,1608],{},[313,1590,1591],{},"relationship.when-included"," is replaced by ",[313,1594,1595],{},"relationship.linkage",[313,1597,1598],{},"'included'",[313,1600,1601],{},"true","; remove the key for\n",[313,1604,1070],{},[313,1606,1607],{},"'always'",", the default). A published configuration keeping the old key throws at boot.",[1226,1610,1611,1612,1615,1616,1619,1620,1623,1624,1626,1627],{},"A relationship read from a relation (",[313,1613,1614],{},"$this->one(UserResource::class)",") loads it, in batch, even when it is not\nincluded. Add ",[313,1617,1618],{},"->withLoad(false)"," where an application loads it itself, or ",[313,1621,1622],{},"->whenIncluded()"," to render its ",[313,1625,1510],{},"\nonly when included.",[1006,1628,1630],{"className":1008,"code":1629,"language":1010,"meta":1011,"style":1011},"\u002F\u002F 1.x: the relation is read as it is, loaded resource by resource if it is not\n'author' => $this->one(UserResource::class),\n\u002F\u002F 2.0: loaded in batch; to load it yourself, or render it only when included\n'author' => $this->one(UserResource::class)->withLoad(false),\n'author' => $this->one(UserResource::class)->whenIncluded(),\n",[313,1631,1632,1637,1667,1672,1709],{"__ignoreMap":1011},[1015,1633,1634],{"class":1017,"line":1018},[1015,1635,1636],{"class":1021},"\u002F\u002F 1.x: the relation is read as it is, loaded resource by resource if it is not\n",[1015,1638,1639,1641,1644,1646,1648,1650,1652,1655,1657,1660,1662,1664],{"class":1017,"line":1025},[1015,1640,1297],{"class":1296},[1015,1642,1643],{"class":1300},"author",[1015,1645,1297],{"class":1296},[1015,1647,1306],{"class":1036},[1015,1649,1041],{"class":1040},[1015,1651,1044],{"class":1036},[1015,1653,1654],{"class":1047},"one",[1015,1656,1067],{"class":1028},[1015,1658,1659],{"class":1167},"UserResource",[1015,1661,1171],{"class":1036},[1015,1663,1175],{"class":1174},[1015,1665,1666],{"class":1028},"),\n",[1015,1668,1669],{"class":1017,"line":1054},[1015,1670,1671],{"class":1021},"\u002F\u002F 2.0: loaded in batch; to load it yourself, or render it only when included\n",[1015,1673,1674,1676,1678,1680,1682,1684,1686,1688,1690,1692,1694,1696,1698,1700,1703,1705,1707],{"class":1017,"line":1076},[1015,1675,1297],{"class":1296},[1015,1677,1643],{"class":1300},[1015,1679,1297],{"class":1296},[1015,1681,1306],{"class":1036},[1015,1683,1041],{"class":1040},[1015,1685,1044],{"class":1036},[1015,1687,1654],{"class":1047},[1015,1689,1067],{"class":1028},[1015,1691,1659],{"class":1167},[1015,1693,1171],{"class":1036},[1015,1695,1175],{"class":1174},[1015,1697,409],{"class":1028},[1015,1699,1044],{"class":1036},[1015,1701,1702],{"class":1047},"withLoad",[1015,1704,1067],{"class":1028},[1015,1706,1070],{"class":1040},[1015,1708,1666],{"class":1028},[1015,1710,1711,1713,1715,1717,1719,1721,1723,1725,1727,1729,1731,1733,1735,1737,1740],{"class":1017,"line":1083},[1015,1712,1297],{"class":1296},[1015,1714,1643],{"class":1300},[1015,1716,1297],{"class":1296},[1015,1718,1306],{"class":1036},[1015,1720,1041],{"class":1040},[1015,1722,1044],{"class":1036},[1015,1724,1654],{"class":1047},[1015,1726,1067],{"class":1028},[1015,1728,1659],{"class":1167},[1015,1730,1171],{"class":1036},[1015,1732,1175],{"class":1174},[1015,1734,409],{"class":1028},[1015,1736,1044],{"class":1036},[1015,1738,1739],{"class":1047},"whenIncluded",[1015,1741,1316],{"class":1028},[1226,1743,1744,1747,1748,1751,1752,1755,1756,1364,1759,1761],{},[313,1745,1746],{},"->withLoad(true)"," loads the relation the relationship is read from: ",[313,1749,1750],{},"$this->one(PostResource::class, 'post')"," under\nthe name ",[313,1753,1754],{},"main-post"," loads ",[313,1757,1758],{},"post",[313,1760,1754],{},").",[1226,1763,1764,1765,1768,1769,1771,1772,316],{},"A ",[313,1766,1767],{},"withLoad(['comments' => fn($query) => …])"," constraint now filters the linkage too: the identifiers listed in\n",[313,1770,1510],{}," are those of ",[313,1773,1774],{},"included",[1226,1776,1777,1778,1781,1782,1784],{},"A relationship with ",[313,1779,1780],{},"->whenLoaded()"," is loaded when included. Add ",[313,1783,1618],{}," to keep the 1.x behaviour.",[1226,1786,1787,1790,1791,316],{},[313,1788,1789],{},"whenIncluded($request, $type, $value)"," of the resources is renamed ",[313,1792,1793],{},"whenInIncludes($request, $relationship, $value)",[1226,1795,1796,727,1799,804,1802,1761],{},[313,1797,1798],{},"RelationshipDefinition::$whenIncluded",[313,1800,1801],{},"$linkage",[313,1803,1804],{},"Configuration\\Linkage|null",[1226,1806,1807,1810,1811,1814,1815,422,1818,1821,1822,1825],{},[313,1808,1809],{},"RelationshipDefinition::$related"," is a list of resource classes (",[313,1812,1813],{},"$relationship->related[0]"," for a relationship\nthat is not polymorphic), empty for a relationship to Laravel's native resources (",[313,1816,1817],{},"isNative()",[313,1819,1820],{},"$native","). Run\n",[313,1823,1824],{},"php artisan jsonapi:cache"," again after upgrading.",[1226,1827,1828,1831,1832,1835,1836,1839,1840,1843],{},[313,1829,1830],{},"Filters"," is immutable: ",[313,1833,1834],{},"->filters(fn(Filters $filters) => $filters->can('view'))"," works as before, but a closure\ncalling ",[313,1837,1838],{},"can()"," \u002F ",[313,1841,1842],{},"when()"," without returning their result loses the rules. Chain them and return the result.",[1226,1845,1846,727,1849,1852,1853,1856,1857,1860],{},[313,1847,1848],{},"Relationship::links()",[313,1850,1851],{},"links(?Closure $links = null, string|Closure|null $self = null, string|Closure|null $related = null)",": a subclass overriding ",[313,1854,1855],{},"links(Closure $links)"," must take the new signature. ",[313,1858,1859],{},"links()"," without any\nlink throws.",[318,1862,1864],{"id":1863},"static-helpers","Static helpers",[309,1866,1867,422,1870,422,1873,422,1876,763,1879,1882,1883,1886,1887,1890],{},[313,1868,1869],{},"Support\\Includes",[313,1871,1872],{},"Support\\Fields",[313,1874,1875],{},"Support\\With",[313,1877,1878],{},"Support\\Supported",[313,1880,1881],{},"Support\\Traits\\HasLocalCache"," are\nremoved, with ",[313,1884,1885],{},"PrepareData::prepareData()"," and the Octane ",[313,1888,1889],{},"RequestReceived"," listener (each request gets its own\ncontext, nothing to reset). Read the requested include and fields from the context of the request:",[1006,1892,1894],{"className":1008,"code":1893,"language":1010,"meta":1011,"style":1011},"\u002F\u002F 1.x\nIncludes::include($request, 'posts');\nFields::has($request, 'title', 'post');\n\u002F\u002F 2.0\n$context = app(JsonApiContext::class);\n$context->include->has('posts');           \u002F\u002F IncludeTree\n$context->fields->allows('post', 'title'); \u002F\u002F SparseFieldsets\n",[313,1895,1896,1900,1926,1958,1962,1985,2014],{"__ignoreMap":1011},[1015,1897,1898],{"class":1017,"line":1018},[1015,1899,1022],{"class":1021},[1015,1901,1902,1905,1907,1910,1912,1914,1916,1919,1922,1924],{"class":1017,"line":1025},[1015,1903,1904],{"class":1167},"Includes",[1015,1906,1171],{"class":1036},[1015,1908,1909],{"class":1047},"include",[1015,1911,1534],{"class":1028},[1015,1913,1455],{"class":1032},[1015,1915,1447],{"class":1028},[1015,1917,1918],{"class":1296}," '",[1015,1920,1921],{"class":1300},"posts",[1015,1923,1297],{"class":1296},[1015,1925,1073],{"class":1028},[1015,1927,1928,1931,1933,1936,1938,1940,1942,1944,1946,1948,1950,1952,1954,1956],{"class":1017,"line":1054},[1015,1929,1930],{"class":1167},"Fields",[1015,1932,1171],{"class":1036},[1015,1934,1935],{"class":1047},"has",[1015,1937,1534],{"class":1028},[1015,1939,1455],{"class":1032},[1015,1941,1447],{"class":1028},[1015,1943,1918],{"class":1296},[1015,1945,1059],{"class":1300},[1015,1947,1297],{"class":1296},[1015,1949,1447],{"class":1028},[1015,1951,1918],{"class":1296},[1015,1953,1758],{"class":1300},[1015,1955,1297],{"class":1296},[1015,1957,1073],{"class":1028},[1015,1959,1960],{"class":1017,"line":1076},[1015,1961,1086],{"class":1021},[1015,1963,1964,1966,1969,1971,1974,1976,1979,1981,1983],{"class":1017,"line":1083},[1015,1965,1029],{"class":1028},[1015,1967,1968],{"class":1032},"context ",[1015,1970,1037],{"class":1036},[1015,1972,1973],{"class":1047}," app",[1015,1975,1067],{"class":1028},[1015,1977,1978],{"class":1167},"JsonApiContext",[1015,1980,1171],{"class":1036},[1015,1982,1175],{"class":1174},[1015,1984,1073],{"class":1028},[1015,1986,1987,1989,1992,1994,1996,1998,2000,2002,2004,2006,2008,2011],{"class":1017,"line":1089},[1015,1988,1029],{"class":1028},[1015,1990,1991],{"class":1032},"context",[1015,1993,1044],{"class":1036},[1015,1995,1909],{"class":1032},[1015,1997,1044],{"class":1036},[1015,1999,1935],{"class":1047},[1015,2001,1067],{"class":1028},[1015,2003,1297],{"class":1296},[1015,2005,1921],{"class":1300},[1015,2007,1297],{"class":1296},[1015,2009,2010],{"class":1028},");",[1015,2012,2013],{"class":1021},"           \u002F\u002F IncludeTree\n",[1015,2015,2017,2019,2021,2023,2026,2028,2031,2033,2035,2037,2039,2041,2043,2045,2047,2049],{"class":1017,"line":2016},7,[1015,2018,1029],{"class":1028},[1015,2020,1991],{"class":1032},[1015,2022,1044],{"class":1036},[1015,2024,2025],{"class":1032},"fields",[1015,2027,1044],{"class":1036},[1015,2029,2030],{"class":1047},"allows",[1015,2032,1067],{"class":1028},[1015,2034,1297],{"class":1296},[1015,2036,1758],{"class":1300},[1015,2038,1297],{"class":1296},[1015,2040,1447],{"class":1028},[1015,2042,1918],{"class":1296},[1015,2044,1059],{"class":1300},[1015,2046,1297],{"class":1296},[1015,2048,2010],{"class":1028},[1015,2050,2051],{"class":1021}," \u002F\u002F SparseFieldsets\n",[318,2053,2055],{"id":2054},"validation-rules","Validation rules",[309,2057,2058,763,2061,2064,2065,2068,2069,2072,2073,2076],{},[313,2059,2060],{},"Rules\\Fields",[313,2062,2063],{},"Rules\\Includes"," move to the ",[313,2066,2067],{},"Http"," layer: replace ",[313,2070,2071],{},"Ark4ne\\JsonApi\\Requests\\Rules\\"," by\n",[313,2074,2075],{},"Ark4ne\\JsonApi\\Http\\Rules\\"," in your imports:",[1006,2078,2080],{"className":1008,"code":2079,"language":1010,"meta":1011,"style":1011},"\u002F\u002F 1.x\nuse Ark4ne\\JsonApi\\Requests\\Rules\\Includes;\n\u002F\u002F 2.0\nuse Ark4ne\\JsonApi\\Http\\Rules\\Includes;\n",[313,2081,2082,2086,2114,2118],{"__ignoreMap":1011},[1015,2083,2084],{"class":1017,"line":1018},[1015,2085,1022],{"class":1021},[1015,2087,2088,2091,2094,2096,2098,2100,2102,2104,2107,2109,2111],{"class":1017,"line":1025},[1015,2089,2090],{"class":1174},"use",[1015,2092,2093],{"class":1150}," Ark4ne",[1015,2095,1154],{"class":1040},[1015,2097,1157],{"class":1150},[1015,2099,1154],{"class":1040},[1015,2101,166],{"class":1150},[1015,2103,1154],{"class":1040},[1015,2105,2106],{"class":1150},"Rules",[1015,2108,1154],{"class":1040},[1015,2110,1904],{"class":1150},[1015,2112,2113],{"class":1028},";\n",[1015,2115,2116],{"class":1017,"line":1054},[1015,2117,1086],{"class":1021},[1015,2119,2120,2122,2124,2126,2128,2130,2132,2134,2136,2138,2140],{"class":1017,"line":1076},[1015,2121,2090],{"class":1174},[1015,2123,2093],{"class":1150},[1015,2125,1154],{"class":1040},[1015,2127,1157],{"class":1150},[1015,2129,1154],{"class":1040},[1015,2131,2067],{"class":1150},[1015,2133,1154],{"class":1040},[1015,2135,2106],{"class":1150},[1015,2137,1154],{"class":1040},[1015,2139,1904],{"class":1150},[1015,2141,2113],{"class":1028},[309,2143,2144,2145,763,2147,2149,2150,2153,2154,1761],{},"A form request that only validates ",[313,2146,1909],{},[313,2148,2025],{}," can extend\n",[313,2151,2152],{},"Ark4ne\\JsonApi\\Http\\JsonApiFormRequest"," instead (",[313,2155,2156],{},"protected string $resource = PostResource::class;",[318,2158,2160],{"id":2159},"validation-messages","Validation messages",[309,2162,2163,2164,763,2166,2168,2169,625,2172,2175,2176,2179,2180,2183,2184,2187,2188,422,2191,2194,2195,2198,2199,2202],{},"The messages of ",[313,2165,2060],{},[313,2167,2063],{}," are translations of the package. Messages customized under\n",[313,2170,2171],{},"validation.custom.jsonapi.*",[313,2173,2174],{},"lang\u002F{locale}\u002Fvalidation.php"," are no longer read: publish the translations\n(",[313,2177,2178],{},"php artisan vendor:publish --tag=jsonapi-lang",") and edit ",[313,2181,2182],{},"lang\u002Fvendor\u002Fjsonapi\u002F{locale}\u002Fvalidation.php",", whose keys\nare the same without the ",[313,2185,2186],{},"custom.jsonapi."," prefix (",[313,2189,2190],{},"fields.invalid_fields",[313,2192,2193],{},"includes.invalid_depth","…). A test\nasserting ",[313,2196,2197],{},"\":resource\" doesn't exists."," reads ",[313,2200,2201],{},"\":resource\" doesn't exist."," now.",[309,2204,2205,2206,2209,2210,2213],{},"Both rules are ",[313,2207,2208],{},"final",": compose them instead of extending them. ",[313,2211,2212],{},"Rules\\Traits\\UseTrans"," is removed.",[318,2215,2217],{"id":2216},"schema-and-assertions","Schema and assertions",[309,2219,2220,422,2223,763,2226,2229,2230,2233,2234,2237],{},[313,2221,2222],{},"JsonApiResource::schema()",[313,2224,2225],{},"JsonApiCollection::schema()",[313,2227,2228],{},"Skeleton"," are removed: ",[313,2231,2232],{},"PostResource::definition()","\nreturns the ",[313,2235,2236],{},"ResourceDefinition"," (type, attributes, relationships with their related class and eager-loads).",[309,2239,2240,2243,2244,2247,2248,2251,2252,2254],{},[313,2241,2242],{},"Support\\FakeModel",", internal, is replaced by ",[313,2245,2246],{},"Support\\Probe",": code that built a resource on a ",[313,2249,2250],{},"FakeModel"," to read\nwhat it declares reads ",[313,2253,2232],{}," instead.",[309,2256,2257,2260,2261,2263,2264,2267],{},[313,2258,2259],{},"Asserts\\AssertJsonApiResource"," is removed: run ",[313,2262,712],{}," in the CI, or call\n",[313,2265,2266],{},"Testing\\ResourceAssertions::assertValid(PostResource::class)"," in a test.",[309,2269,2270,2271,2274,2275,422,2278,571,2281,2284],{},"A condition written with an ",[313,2272,2273],{},"if"," on the request inside a hook is not seen by the definition, which is built with an\nempty request: write it with ",[313,2276,2277],{},"->when()",[313,2279,2280],{},"->unless()",[313,2282,2283],{},"applyWhen()"," (README, section \"Definition\").",[309,2286,2287,2288,763,2291,2294,2295,2298,2299,763,2301,2303,2304,1469],{},"The members of ",[313,2289,2290],{},"mergeWhen()",[313,2292,2293],{},"mergeUnless()"," are missing from the definition whatever the condition, with a\n",[313,2296,2297],{},"merge-when"," warning: they are still rendered, but ",[313,2300,2025],{},[313,2302,1909],{}," cannot request them and their relations are\nnot eager-loaded. Group conditional members with ",[313,2305,2283],{},[1006,2307,2309],{"className":1008,"code":2308,"language":1010,"meta":1011,"style":1011},"\u002F\u002F 1.x\n$this->mergeWhen($this->is_admin, ['secret' => $this->secret]),\n\u002F\u002F 2.0\n$this->applyWhen(fn() => $this->is_admin, ['secret' => $this->string()]),\n",[313,2310,2311,2315,2357,2361],{"__ignoreMap":1011},[1015,2312,2313],{"class":1017,"line":1018},[1015,2314,1022],{"class":1021},[1015,2316,2317,2320,2322,2325,2327,2329,2331,2334,2336,2339,2341,2344,2346,2348,2350,2352,2354],{"class":1017,"line":1025},[1015,2318,2319],{"class":1040},"$this",[1015,2321,1044],{"class":1036},[1015,2323,2324],{"class":1047},"mergeWhen",[1015,2326,1067],{"class":1028},[1015,2328,2319],{"class":1040},[1015,2330,1044],{"class":1036},[1015,2332,2333],{"class":1032},"is_admin",[1015,2335,1447],{"class":1028},[1015,2337,2338],{"class":1028}," [",[1015,2340,1297],{"class":1296},[1015,2342,2343],{"class":1300},"secret",[1015,2345,1297],{"class":1296},[1015,2347,1306],{"class":1036},[1015,2349,1041],{"class":1040},[1015,2351,1044],{"class":1036},[1015,2353,2343],{"class":1032},[1015,2355,2356],{"class":1028},"]),\n",[1015,2358,2359],{"class":1017,"line":1054},[1015,2360,1086],{"class":1021},[1015,2362,2363,2365,2367,2370,2372,2375,2377,2379,2381,2383,2385,2387,2389,2391,2393,2395,2397,2399,2401,2403],{"class":1017,"line":1076},[1015,2364,2319],{"class":1040},[1015,2366,1044],{"class":1036},[1015,2368,2369],{"class":1047},"applyWhen",[1015,2371,1067],{"class":1028},[1015,2373,2374],{"class":1426},"fn",[1015,2376,1104],{"class":1028},[1015,2378,1306],{"class":1028},[1015,2380,1041],{"class":1040},[1015,2382,1044],{"class":1036},[1015,2384,2333],{"class":1032},[1015,2386,1447],{"class":1028},[1015,2388,2338],{"class":1028},[1015,2390,1297],{"class":1296},[1015,2392,2343],{"class":1300},[1015,2394,1297],{"class":1296},[1015,2396,1306],{"class":1036},[1015,2398,1041],{"class":1040},[1015,2400,1044],{"class":1036},[1015,2402,1048],{"class":1047},[1015,2404,2405],{"class":1028},"()]),\n",[309,2407,2408,422,2411,763,2413,2415,2416,2419,2420,2423,2424,2427,2428,2430],{},[313,2409,2410],{},"merge()",[313,2412,2290],{},[313,2414,2293],{}," throw a ",[313,2417,2418],{},"DefinitionException"," when given a scalar or an object that is\nneither iterable, ",[313,2421,2422],{},"Arrayable"," nor ",[313,2425,2426],{},"JsonSerializable","; ",[313,2429,578],{}," merges nothing.",[318,2432,2434,763,2436,2438],{"id":2433},"include-and-fields-come-from-the-query-string",[313,2435,1909],{},[313,2437,2025],{}," come from the query string",[309,2440,2441,2442,763,2444,2446,2447,2450,2451,2454,2455,316],{},"1.x read ",[313,2443,1909],{},[313,2445,2025],{}," from all the input, body included. 2.0 reads them from the query string only, where\nthe specification defines them. A middleware adding a default include on a ",[313,2448,2449],{},"GET"," request\n(",[313,2452,2453],{},"$request->merge(['include' => …])",") keeps working: Laravel merges into the query of a ",[313,2456,2449],{},[318,2458,2460,2463],{"id":2459},"toarray-returns-the-resource-object",[313,2461,2462],{},"toArray()"," returns the resource object",[309,2465,2466,2469,2470,422,2473,422,2476,422,2479,422,2482,422,2485,2488,2489,2491,2492,940,2495,2498,2499,2501,2502,2505,2506,571,2508,2511,2512,804,2514,1839,2517,2520],{},[313,2467,2468],{},"toArray($request)"," returns the resource object only (",[313,2471,2472],{},"type",[313,2474,2475],{},"id",[313,2477,2478],{},"attributes",[313,2480,2481],{},"relationships",[313,2483,2484],{},"links",[313,2486,2487],{},"meta","),\nand a collection the list of them. ",[313,2490,1774],{},", the document meta and the pagination are only in the response:\nreturn the resource from the controller, or call ",[313,2493,2494],{},"->toResponse($request)",[313,2496,2497],{},"with()"," no longer returns ",[313,2500,1774],{}," nor\nthe meta of ",[313,2503,2504],{},"toDocumentMeta()","; what you add in ",[313,2507,2497],{},[313,2509,2510],{},"additional()"," is still merged into the response. The second\nargument of ",[313,2513,2462],{},[313,2515,2516],{},"$included",[313,2518,2519],{},"$minimal",") is removed: remove it from your overrides.",[1006,2522,2524],{"className":1008,"code":2523,"language":1010,"meta":1011,"style":1011},"\u002F\u002F 1.x\n$document = (new PostResource($post))->toArray($request, true);\n\u002F\u002F 2.0\n$document = (new PostResource($post))->toResponse($request)->getData(true);\n",[313,2525,2526,2530,2570,2574],{"__ignoreMap":1011},[1015,2527,2528],{"class":1017,"line":1018},[1015,2529,1022],{"class":1021},[1015,2531,2532,2534,2537,2539,2541,2544,2547,2549,2551,2554,2556,2559,2561,2563,2565,2568],{"class":1017,"line":1025},[1015,2533,1029],{"class":1028},[1015,2535,2536],{"class":1032},"document ",[1015,2538,1037],{"class":1036},[1015,2540,804],{"class":1028},[1015,2542,2543],{"class":1174},"new",[1015,2545,2546],{"class":1167}," PostResource",[1015,2548,1534],{"class":1028},[1015,2550,1758],{"class":1032},[1015,2552,2553],{"class":1028},"))",[1015,2555,1044],{"class":1036},[1015,2557,2558],{"class":1047},"toArray",[1015,2560,1534],{"class":1028},[1015,2562,1455],{"class":1032},[1015,2564,1447],{"class":1028},[1015,2566,2567],{"class":1040}," true",[1015,2569,1073],{"class":1028},[1015,2571,2572],{"class":1017,"line":1054},[1015,2573,1086],{"class":1021},[1015,2575,2576,2578,2580,2582,2584,2586,2588,2590,2592,2594,2596,2599,2601,2603,2605,2607,2610,2612,2614],{"class":1017,"line":1076},[1015,2577,1029],{"class":1028},[1015,2579,2536],{"class":1032},[1015,2581,1037],{"class":1036},[1015,2583,804],{"class":1028},[1015,2585,2543],{"class":1174},[1015,2587,2546],{"class":1167},[1015,2589,1534],{"class":1028},[1015,2591,1758],{"class":1032},[1015,2593,2553],{"class":1028},[1015,2595,1044],{"class":1036},[1015,2597,2598],{"class":1047},"toResponse",[1015,2600,1534],{"class":1028},[1015,2602,1455],{"class":1032},[1015,2604,409],{"class":1028},[1015,2606,1044],{"class":1036},[1015,2608,2609],{"class":1047},"getData",[1015,2611,1067],{"class":1028},[1015,2613,1601],{"class":1040},[1015,2615,1073],{"class":1028},[309,2617,2618,763,2621,2624,2625,2628,2629,2631,2632,2634],{},[313,2619,2620],{},"Resources\\Resourceable",[313,2622,2623],{},"Relationship::toArray()"," are removed. A relationship points to a ",[313,2626,2627],{},"JsonApiResource"," or a\n",[313,2630,1502],{},", and a collection collects ",[313,2633,2627],{},"s: anything else renders no resource object.",[318,2636,2638],{"id":2637},"the-json-follows-the-specification","The JSON follows the specification",[1006,2640,2644],{"className":2641,"code":2642,"language":2643,"meta":1011,"style":1011},"language-jsonc shiki shiki-themes material-theme-lighter github-light github-dark","\u002F\u002F 1.x\n{\"data\": {\"type\": \"post\", \"id\": 1, \"attributes\": [], \"relationships\": {\"author\": []}}}\n\u002F\u002F 2.0\n{\"jsonapi\": {\"version\": \"1.1\"}, \"data\": {\"type\": \"post\", \"id\": \"1\", \"relationships\": {\"author\": {\"data\": null}}}}\n","jsonc",[313,2645,2646,2650,2655,2659],{"__ignoreMap":1011},[1015,2647,2648],{"class":1017,"line":1018},[1015,2649,1022],{},[1015,2651,2652],{"class":1017,"line":1025},[1015,2653,2654],{},"{\"data\": {\"type\": \"post\", \"id\": 1, \"attributes\": [], \"relationships\": {\"author\": []}}}\n",[1015,2656,2657],{"class":1017,"line":1054},[1015,2658,1086],{},[1015,2660,2661],{"class":1017,"line":1076},[1015,2662,2663],{},"{\"jsonapi\": {\"version\": \"1.1\"}, \"data\": {\"type\": \"post\", \"id\": \"1\", \"relationships\": {\"author\": {\"data\": null}}}}\n",[309,2665,2666],{},"Clients reading the documents must expect:",[1223,2668,2669,2690,2695,2705,2727,2758,2763,2809],{},[1226,2670,2671,2672,2675,2676,2679,2680,2683,2684,2686,2687,2689],{},"a top-level ",[313,2673,2674],{},"jsonapi"," member, ",[313,2677,2678],{},"{\"version\": \"1.1\"}"," by default. Set ",[313,2681,2682],{},"document.jsonapi"," to ",[313,2685,1070],{}," in\n",[313,2688,1212],{}," to leave it out;",[1226,2691,2692,2694],{},[313,2693,2475],{}," always a string, in resource objects and in relationship linkage;",[1226,2696,2697,2700,2701,2704],{},[313,2698,2699],{},"{\"data\": null}"," for an empty to-one relationship, ",[313,2702,2703],{},"{\"data\": []}"," for an empty to-many; a relationship that has\nneither data, links nor meta is left out;",[1226,2706,2707,2708,2711,2712,422,2714,2716,2717,2720,2721,2723,2724,2726],{},"without ",[313,2709,2710],{},"toAttributes()",", no ",[313,2713,2475],{},[313,2715,2472],{},", model key, foreign keys of the declared relationships (",[313,2718,2719],{},"user_id","…) nor\nloaded relations in ",[313,2722,2478],{},". Write ",[313,2725,2710],{}," if a client reads them there;",[1226,2728,2729,2730,422,2732,422,2734,571,2736,2738,2739,2742,2743,388,2745,422,2748,388,2751,2754,2755,2757],{},"empty ",[313,2731,2478],{},[313,2733,2481],{},[313,2735,2484],{},[313,2737,2487],{}," left out instead of ",[313,2740,2741],{},"[]",". A hook returning members without\nnames (",[313,2744,2710],{},[313,2746,2747],{},"['a', 'b']",[313,2749,2750],{},"toMeta()",[313,2752,2753],{},"['x']",") now throws a ",[313,2756,1395],{},":\ngive each member a name;",[1226,2759,2760,2762],{},[313,2761,1774],{}," without the primary resources and without duplicates;",[1226,2764,2765,2768,2769],{},[313,2766,2767],{},"fields[type]"," restricting the relationships of the type too. To keep the 1.x behaviour:",[1006,2770,2772],{"className":1008,"code":2771,"language":1010,"meta":1011,"style":1011},"\u002F\u002F config\u002Fjsonapi.php\n'fields' => ['relationships' => 'keep'],\n",[313,2773,2774,2779],{"__ignoreMap":1011},[1015,2775,2776],{"class":1017,"line":1018},[1015,2777,2778],{"class":1021},"\u002F\u002F config\u002Fjsonapi.php\n",[1015,2780,2781,2783,2785,2787,2789,2791,2793,2795,2797,2799,2801,2804,2806],{"class":1017,"line":1025},[1015,2782,1297],{"class":1296},[1015,2784,2025],{"class":1300},[1015,2786,1297],{"class":1296},[1015,2788,1306],{"class":1036},[1015,2790,2338],{"class":1028},[1015,2792,1297],{"class":1296},[1015,2794,2481],{"class":1300},[1015,2796,1297],{"class":1296},[1015,2798,1306],{"class":1036},[1015,2800,1918],{"class":1296},[1015,2802,2803],{"class":1300},"keep",[1015,2805,1297],{"class":1296},[1015,2807,2808],{"class":1028},"],\n",[1226,2810,2811,2812,2814,2815,2817],{},"document meta (",[313,2813,2504],{},") from the primary resources only: an included resource adds none. In a collection they\nare merged key by key, the first resource setting a key keeping it, instead of gathered into lists. To set document\nmeta for the whole collection, override ",[313,2816,2504],{}," on the collection class: it wins over those of the resources.",[318,2819,2821],{"id":2820},"closures-that-are-not-requested-are-not-run","Closures that are not requested are not run",[309,2823,2824,2825,2827],{},"A closure of an attribute left out by ",[313,2826,2767],{},", or of a relationship whose linkage is not rendered, is never\ncalled: 1.x called it, then dropped the value. Code that relied on the side effects of such a closure (a counter, a\nlog, a lazy load) must do it elsewhere.",[1006,2829,2831],{"className":1008,"code":2830,"language":1010,"meta":1011,"style":1011},"\u002F\u002F GET \u002Fposts?fields[post]=title\n'word-count' => $this->integer(fn() => $this->countWords()), \u002F\u002F 1.x: called; 2.0: not called\n",[313,2832,2833,2838],{"__ignoreMap":1011},[1015,2834,2835],{"class":1017,"line":1018},[1015,2836,2837],{"class":1021},"\u002F\u002F GET \u002Fposts?fields[post]=title\n",[1015,2839,2840,2842,2845,2847,2849,2851,2853,2856,2858,2860,2862,2864,2866,2868,2871,2874],{"class":1017,"line":1025},[1015,2841,1297],{"class":1296},[1015,2843,2844],{"class":1300},"word-count",[1015,2846,1297],{"class":1296},[1015,2848,1306],{"class":1036},[1015,2850,1041],{"class":1040},[1015,2852,1044],{"class":1036},[1015,2854,2855],{"class":1047},"integer",[1015,2857,1067],{"class":1028},[1015,2859,2374],{"class":1426},[1015,2861,1104],{"class":1028},[1015,2863,1306],{"class":1028},[1015,2865,1041],{"class":1040},[1015,2867,1044],{"class":1036},[1015,2869,2870],{"class":1047},"countWords",[1015,2872,2873],{"class":1028},"()),",[1015,2875,2876],{"class":1021}," \u002F\u002F 1.x: called; 2.0: not called\n",[318,2878,2880],{"id":2879},"new-value-helpers","New value helpers",[309,2882,2883,422,2886,422,2889,422,2892,422,2895,763,2898,2901,2902,2904],{},[313,2884,2885],{},"$this->uuid()",[313,2887,2888],{},"ulid()",[313,2890,2891],{},"decimal()",[313,2893,2894],{},"json()",[313,2896,2897],{},"time()",[313,2899,2900],{},"datetime()"," are value descriptors now. A resource that\ncalled a model method of one of these names through ",[313,2903,2319],{}," must call it on the model:",[1006,2906,2908],{"className":1008,"code":2907,"language":1010,"meta":1011,"style":1011},"\u002F\u002F 1.x: the uuid() method of the model, through the resource\n'uuid' => $this->uuid(),\n\u002F\u002F 2.0\n'uuid' => $this->resource->uuid(),\n",[313,2909,2910,2915,2934,2938],{"__ignoreMap":1011},[1015,2911,2912],{"class":1017,"line":1018},[1015,2913,2914],{"class":1021},"\u002F\u002F 1.x: the uuid() method of the model, through the resource\n",[1015,2916,2917,2919,2922,2924,2926,2928,2930,2932],{"class":1017,"line":1025},[1015,2918,1297],{"class":1296},[1015,2920,2921],{"class":1300},"uuid",[1015,2923,1297],{"class":1296},[1015,2925,1306],{"class":1036},[1015,2927,1041],{"class":1040},[1015,2929,1044],{"class":1036},[1015,2931,2921],{"class":1047},[1015,2933,1316],{"class":1028},[1015,2935,2936],{"class":1017,"line":1054},[1015,2937,1086],{"class":1021},[1015,2939,2940,2942,2944,2946,2948,2950,2952,2954,2956,2958],{"class":1017,"line":1076},[1015,2941,1297],{"class":1296},[1015,2943,2921],{"class":1300},[1015,2945,1297],{"class":1296},[1015,2947,1306],{"class":1036},[1015,2949,1041],{"class":1040},[1015,2951,1044],{"class":1036},[1015,2953,1537],{"class":1032},[1015,2955,1044],{"class":1036},[1015,2957,2921],{"class":1047},[1015,2959,1316],{"class":1028},[318,2961,2963],{"id":2962},"renamed-methods","Renamed methods",[1223,2965,2966,2983,3198],{},[1226,2967,2968,2970,2971,2973,2974,2976,2977,2979,2980,2982],{},[313,2969,2750],{}," (document meta) is renamed ",[313,2972,2504],{},", on resources and collections: a class still declaring\n",[313,2975,2750],{}," throws a ",[313,2978,2418],{}," (when compiled for a resource, when rendered for a collection) instead\nof losing its meta silently. ",[313,2981,387],{}," is unchanged.",[1226,2984,2985,2986,804,2989,1358,2992,763,2995,2998,2999,928,3001,3004,3005],{},"On ",[313,2987,2988],{},"Relationship",[313,2990,2991],{},"PostResource::relationship(...)",[313,2993,2994],{},"withLinks()",[313,2996,2997],{},"withMeta()"," are renamed ",[313,3000,1859],{},[313,3002,3003],{},"meta()",", as on the relationship descriptors.",[1006,3006,3008],{"className":1008,"code":3007,"language":1010,"meta":1011,"style":1011},"\u002F\u002F 1.x\nprotected function toMeta(Request $request): ?iterable { return ['total' => …]; }\nPostResource::relationship(fn() => …)->withLinks(fn() => […]);\n\u002F\u002F 2.0\nprotected function toDocumentMeta(Request $request): ?iterable { return ['total' => …]; }\nPostResource::relationship(fn() => …)->links(fn() => […]);\n",[313,3009,3010,3014,3068,3111,3115,3160],{"__ignoreMap":1011},[1015,3011,3012],{"class":1017,"line":1018},[1015,3013,1022],{"class":1021},[1015,3015,3016,3018,3020,3023,3025,3028,3030,3032,3034,3036,3039,3042,3045,3048,3050,3052,3055,3057,3059,3062,3065],{"class":1017,"line":1025},[1015,3017,1427],{"class":1426},[1015,3019,1430],{"class":1426},[1015,3021,3022],{"class":1047}," toMeta",[1015,3024,1067],{"class":1028},[1015,3026,3027],{"class":1167},"Request",[1015,3029,1441],{"class":1028},[1015,3031,1455],{"class":1032},[1015,3033,409],{"class":1028},[1015,3035,1469],{"class":1036},[1015,3037,3038],{"class":1036}," ?",[1015,3040,3041],{"class":1174},"iterable",[1015,3043,3044],{"class":1028}," {",[1015,3046,3047],{"class":1554}," return",[1015,3049,2338],{"class":1028},[1015,3051,1297],{"class":1296},[1015,3053,3054],{"class":1300},"total",[1015,3056,1297],{"class":1296},[1015,3058,1306],{"class":1036},[1015,3060,3061],{"class":1150}," …",[1015,3063,3064],{"class":1028},"];",[1015,3066,3067],{"class":1028}," }\n",[1015,3069,3070,3073,3075,3078,3080,3082,3084,3086,3088,3090,3092,3095,3097,3099,3101,3103,3105,3108],{"class":1017,"line":1054},[1015,3071,3072],{"class":1167},"PostResource",[1015,3074,1171],{"class":1036},[1015,3076,3077],{"class":1047},"relationship",[1015,3079,1067],{"class":1028},[1015,3081,2374],{"class":1426},[1015,3083,1104],{"class":1028},[1015,3085,1306],{"class":1028},[1015,3087,3061],{"class":1150},[1015,3089,409],{"class":1028},[1015,3091,1044],{"class":1036},[1015,3093,3094],{"class":1047},"withLinks",[1015,3096,1067],{"class":1028},[1015,3098,2374],{"class":1426},[1015,3100,1104],{"class":1028},[1015,3102,1306],{"class":1028},[1015,3104,2338],{"class":1028},[1015,3106,3107],{"class":1150},"…",[1015,3109,3110],{"class":1028},"]);\n",[1015,3112,3113],{"class":1017,"line":1076},[1015,3114,1086],{"class":1021},[1015,3116,3117,3119,3121,3124,3126,3128,3130,3132,3134,3136,3138,3140,3142,3144,3146,3148,3150,3152,3154,3156,3158],{"class":1017,"line":1083},[1015,3118,1427],{"class":1426},[1015,3120,1430],{"class":1426},[1015,3122,3123],{"class":1047}," toDocumentMeta",[1015,3125,1067],{"class":1028},[1015,3127,3027],{"class":1167},[1015,3129,1441],{"class":1028},[1015,3131,1455],{"class":1032},[1015,3133,409],{"class":1028},[1015,3135,1469],{"class":1036},[1015,3137,3038],{"class":1036},[1015,3139,3041],{"class":1174},[1015,3141,3044],{"class":1028},[1015,3143,3047],{"class":1554},[1015,3145,2338],{"class":1028},[1015,3147,1297],{"class":1296},[1015,3149,3054],{"class":1300},[1015,3151,1297],{"class":1296},[1015,3153,1306],{"class":1036},[1015,3155,3061],{"class":1150},[1015,3157,3064],{"class":1028},[1015,3159,3067],{"class":1028},[1015,3161,3162,3164,3166,3168,3170,3172,3174,3176,3178,3180,3182,3184,3186,3188,3190,3192,3194,3196],{"class":1017,"line":1089},[1015,3163,3072],{"class":1167},[1015,3165,1171],{"class":1036},[1015,3167,3077],{"class":1047},[1015,3169,1067],{"class":1028},[1015,3171,2374],{"class":1426},[1015,3173,1104],{"class":1028},[1015,3175,1306],{"class":1028},[1015,3177,3061],{"class":1150},[1015,3179,409],{"class":1028},[1015,3181,1044],{"class":1036},[1015,3183,2484],{"class":1047},[1015,3185,1067],{"class":1028},[1015,3187,2374],{"class":1426},[1015,3189,1104],{"class":1028},[1015,3191,1306],{"class":1028},[1015,3193,2338],{"class":1028},[1015,3195,3107],{"class":1150},[1015,3197,3110],{"class":1028},[1226,3199,3200,3203,3204,3207,3208,3211],{},[313,3201,3202],{},"toId(Request $request): int|string|null"," is a hook of the resources, read by the default ",[313,3205,3206],{},"toIdentifier()",": a\nresource declaring a ",[313,3209,3210],{},"toId()"," of another signature must rename it.",[318,3213,3215],{"id":3214},"final-classes","Final classes",[309,3217,3218,3219,422,3222,422,3225,3228,3229,422,3231,915,3233,763,3236,744,3239,3241,3242,3245,3246,3249,3250,3253,3254,3257,3258,422,3261,763,3264,3267,3268,3271,3272,3275,3276,316],{},"The descriptors (",[313,3220,3221],{},"RelationOne",[313,3223,3224],{},"RelationMany",[313,3226,3227],{},"ValueString"," and the other values), ",[313,3230,2988],{},[313,3232,1830],{},[313,3234,3235],{},"CallbackFilterRule",[313,3237,3238],{},"PolicyFilterRule",[313,3240,2208],{},". A subclass of one of them must become a wrapper, or a\n",[313,3243,3244],{},"Closure"," rule (",[313,3247,3248],{},"->when(fn($request, $model, $attribute) => …)","). ",[313,3251,3252],{},"Support\\Arr",", the ",[313,3255,3256],{},"Descriptors\\Descriptors"," trait,\n",[313,3259,3260],{},"Descriptors\\Resolver",[313,3262,3263],{},"Traits\\HasRelationLoad",[313,3265,3266],{},"RelationMissing"," are removed: use Laravel's ",[313,3269,3270],{},"Arr",", and\n",[313,3273,3274],{},"withLoad()"," on the descriptors and on ",[313,3277,2988],{},[318,3279,3281],{"id":3280},"applywhen",[313,3282,2283],{},[1223,3284,3285,3291],{},[1226,3286,3287,3288,3290],{},"A relationship given to ",[313,3289,2283],{}," is now left out when the condition fails (1.x rendered it anyway).",[1226,3292,3293,3294,3296,3297,422,3300,3303,3304,1761],{},"Only a ",[313,3295,3244],{}," member is called to read its value: another callable (",[313,3298,3299],{},"'strlen'",[313,3301,3302],{},"[$service, 'method']",") is rendered\nas it is. Wrap it in a closure (",[313,3305,3306],{},"fn() => $service->method()",[318,3308,3310],{"id":3309},"casts","Casts",[309,3312,3313,422,3316,763,3319,2415,3321,3323,3324,3327],{},[313,3314,3315],{},"string()",[313,3317,3318],{},"integer()",[313,3320,1577],{},[313,3322,1395],{}," for a value they cannot cast (an array, an object\nthat is not ",[313,3325,3326],{},"Stringable","), and a resource whose identifier is neither an integer nor a string throws one too.",[318,3329,227],{"id":3330},"static-analysis",[309,3332,3333,3336,3337,3340,3341,422,3344,3347,3348,3351,3352,571,3355,804,3358,3361,3362,3365,3366,3369],{},[313,3334,3335],{},"JsonApiResource\u003CUser>"," now types the descriptors: ",[313,3338,3339],{},"$this->string()"," is a ",[313,3342,3343],{},"ValueString\u003CUser>",[313,3345,3346],{},"$this->one(…)"," a\n",[313,3349,3350],{},"RelationOne\u003CUser>",". A hook annotated with ",[313,3353,3354],{},"Relation\u003Cmixed>",[313,3356,3357],{},"Value\u003Cmixed>",[313,3359,3360],{},"@return iterable\u003Cstring, Relation\u003Cmixed>>",") fails PHPStan: name the model (",[313,3363,3364],{},"Relation\u003CUser>","), or remove the ",[313,3367,3368],{},"@return",", inherited from the\nparent. Nothing changes at runtime.",[309,3371,3372,3374,3375,3378,3379,2427,3381,3383,3384,1761],{},[313,3373,1830],{}," is no longer generic: replace ",[313,3376,3377],{},"Filters\u003CPost>"," with ",[313,3380,1830],{},[313,3382,1842],{}," takes a closure typed on the model\n(",[313,3385,3386],{},"fn(Request $request, Post $post) => …",[318,3388,231],{"id":3389},"deployment",[309,3391,3392,3393,3396,3397,1761],{},"Add nothing if you already run ",[313,3394,3395],{},"php artisan optimize",": it now compiles the resource definitions too\n(",[313,3398,1824],{},[3400,3401,3402],"style",{},"html pre.shiki code .sutJx, html code.shiki .sutJx{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s39Yj, html code.shiki .s39Yj{--shiki-light:#39ADB5;--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 .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 .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sw1J6, html code.shiki .sw1J6{--shiki-light:#F76D47;--shiki-default:#D73A49;--shiki-dark:#F97583}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 .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}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}",{"title":1011,"searchDepth":1054,"depth":1054,"links":3404},[3405,3411],{"id":306,"depth":1025,"text":307,"children":3406},[3407,3408,3410],{"id":320,"depth":1054,"text":321},{"id":337,"depth":1054,"text":3409},"Values are declared, and rendered by ark4ne\u002Flaravel-api-revisions",{"id":716,"depth":1054,"text":717},{"id":965,"depth":1025,"text":966,"children":3412},[3413,3414,3415,3416,3417,3418,3419,3420,3421,3422,3423,3424,3426,3428,3429,3430,3431,3432,3433,3434,3435,3436],{"id":986,"depth":1054,"text":321},{"id":1000,"depth":1054,"text":1001},{"id":1117,"depth":1054,"text":1118},{"id":1207,"depth":1054,"text":255},{"id":1220,"depth":1054,"text":1221},{"id":1492,"depth":1054,"text":1493},{"id":1583,"depth":1054,"text":1584},{"id":1863,"depth":1054,"text":1864},{"id":2054,"depth":1054,"text":2055},{"id":2159,"depth":1054,"text":2160},{"id":2216,"depth":1054,"text":2217},{"id":2433,"depth":1054,"text":3425},"include and fields come from the query string",{"id":2459,"depth":1054,"text":3427},"toArray() returns the resource object",{"id":2637,"depth":1054,"text":2638},{"id":2820,"depth":1054,"text":2821},{"id":2879,"depth":1054,"text":2880},{"id":2962,"depth":1054,"text":2963},{"id":3214,"depth":1054,"text":3215},{"id":3280,"depth":1054,"text":2283},{"id":3309,"depth":1054,"text":3310},{"id":3330,"depth":1054,"text":227},{"id":3389,"depth":1054,"text":231},"md",{},"# Upgrade guide\n\n## From 2.0 to 3.0\n\nThe design behind these changes is `docs\u002Frfc\u002Fapi-revisions-integration.md`.\n\n### Requirements\n\n`ark4ne\u002Flaravel-api-revisions` `^1.0` is required and installed with the package; `JsonApiServiceProvider` registers its\nprovider. An application that declares no revision configures nothing: it keeps one shape, the head.\n\n### Values are declared, and rendered by `ark4ne\u002Flaravel-api-revisions`\n\nThe helpers keep their names and return the descriptors of the base. What changes in a resource:\n\n| 2.0 | 3.0 |\n| --- | --- |\n| `'name' => $this->resource->name` (a plain value) | `'name' => $this->string()`, or a closure: `'name' => fn() => $this->resource->name` |\n| `toResourceMeta()` returning `['version' => 3]` | `['version' => fn() => 3]`, or `$this->integer(fn() => 3)` |\n| a member without name (`$this->string('email')`) | `'email' => $this->string()` |\n| `$this->when($condition, $value)`, `$this->whenHas('email')` in a hook | `$this->string()->when(fn() => …)`, `->whenHas()` |\n| `$this->mergeWhen($condition, [...])` | `$this->applyWhen(fn() => $condition, [...])` |\n| `$this->applyWhen($bool, [...])` | `$this->applyWhen(fn() => $bool, [...])`: a closure, read for each resource |\n| `->when(true)`, `->when(fn(Request $request, $model, string $attribute) => …)` | `->when(fn($model, string $attribute) => …)`, run before the value as in 2.0; the request is the one of the hook (`use ($request)`) |\n| `$this->whenInFields($request, 'name', $value)` | the value is a descriptor or a closure: `$this->whenInFields($request, 'name', fn() => $value)` |\n| `$this->enum()->of(State::class)`, `$this->enum()` | `$this->enum(State::class)` (a backed enum) |\n| `$this->struct(fn() => ['city' => $this->string()])` | `$this->struct(['city' => $this->string()])`; with a source, the members are read on its value |\n| `$this->array()->of($this->string())`, `->of('money')` | `$this->arrayOf($this->string())`, `$this->arrayOf($this->money())` |\n| `$this->float()->precision(1)`, `->truncate()` | unchanged: `$this->float()` returns `Descriptors\\Schemas\\FloatSchema`, a float of the base that rounds |\n| `->nullable(false)` rendering `0` or `''` for `null` | `null` is a value error (`revisions.strict_values`) |\n| `->was(X, value: $this->integer())` | `->was(X, schema: $this->integer())`, with `down:` when the base knows no conversion |\n| `->was(X, value: $this->one(OldResource::class))` on a relationship | `->was(X, schema: $this->one(OldResource::class))` |\n| a descriptor with `was()` in `toLinks()` | a plain link; compute it with `ApiRevision::current()` if it changes |\n| `protected static function toDefinition()` | removed: the definition is compiled from the hooks |\n| `JsonApi::valueType('money', MoneyValue::class)`, `describer.types` | a `Descriptor` of the base registered with `TypeRegistry::register('money', MoneySchema::class)` |\n| `describer.datetime`, `describer.strict` | `date_time_format`, `strict_values` of `config\u002Frevisions.php` |\n\nThe hooks of values run **once per response**, on a template instance whose `$this->resource` is set to each model\nbefore its values are read: a closure reading `$this->resource` works as before, an expression evaluated in the hook\n(`$this->resource->name`, `$request->user()->isAdmin()` as a plain boolean) is the same for every resource and is\nrefused where it would be a value. `php artisan jsonapi:check` names every member to rewrite.\n\n### Definitions\n\n`Definitions::for($class, $revision)` gives one definition per revision; `ResourceDefinition::$revision` is `null` for\nthe head (the newest revision). Its values are the model of `ark4ne\u002Flaravel-api-revisions`: `$attributes`, `$meta`\nand `$documentMeta` are `Shape`s (`null` where the resource has no values), `attribute($name)` a `FieldDefinition`\nread by its name at the revision. `Definition\\AttributeDefinition` and `ValueType` are removed:\n\n| 2.0 | 3.0 |\n| --- | --- |\n| `array_keys($definition->attributes)` | `$definition->attributes?->names()` |\n| `$attribute->type === ValueType::String` | `$attribute->type->kind === Kind::String` (`Ark4ne\\ApiRevisions\\Definition\\Kind`) |\n| `$attribute->format`, `->enum`, `->items`, `->children` | `$attribute->type->format`, `->enum`, `->items`, `->children` |\n| a custom type: its `ValueType` and `format` | `Kind::Custom`, `$attribute->type->name` and its JSON Schema `->fragment` |\n| `$attribute->sparse` | `$definition->isSparse($name)` |\n| `$definition->links` (definitions by name) | `$definition->links`, the names |\n| `$attribute->source`, `->computed` | removed |\n\n`jsonapi:cache` writes every revision, without the shapes (those of the base): run it again after the upgrade; a file\nof 2.0 is ignored.\n\n`php artisan jsonapi:check` and `ResourceAssertions` run the check of `ark4ne\u002Flaravel-api-revisions` on the\nresources: the history of their fields is checked with its codes, and the diagnostics `reserved-name`,\n`name-collision` and `unavailable-resource` are `jsonapi-reserved-name`, `jsonapi-name-collision` and\n`jsonapi-absent-resource`. They are no longer among `ResourceDefinition::$diagnostics`: a tool reading them there\ncalls `Compilation\\ResourceChecker`. `php artisan revision:check` checks every declaring class of the application,\nrequests included, and its lock.\n\nA body that changes across the revisions is declared in the `body()` of a request using `RevisionedRequest`\n(`$this->resourceObject(attributes: …, relationships: …)`, `Http\\Body`): see the README, \"Write requests across\nrevisions\".\n\n## From 1.x to 2.0\n\n> This section gives the code of 2.0. Upgrading from 1.x to 3.0, apply it, then \"From 2.0 to 3.0\" above, whose\n> tables replace what 3.0 changed again (values, value types, configuration of the dates, definitions).\n\nCoding agents can follow the `laravel-json-api-upgrade` skill shipped in the package\n(`vendor\u002Fark4ne\u002Flaravel-json-api\u002Fskills\u002Flaravel-json-api-upgrade\u002F`): the same changes as a procedure, with a mapping\nof every 1.x construct and tested examples.\n\n### Requirements\n\nPHP `^8.3` and Laravel `^12.46` or `^13.0`.\n\n### Descriptors are immutable\n\nEvery fluent method of a descriptor returns a copy. Chained calls are unchanged; a descriptor modified on its own line\nmust keep the returned value:\n\n```php\n\u002F\u002F 1.x\n$title = $this->string();\n$title->nullable(false);\n\n\u002F\u002F 2.0\n$title = $this->string()->nullable(false);\n```\n\n### Service provider\n\nThe provider is now `Ark4ne\\JsonApi\\Laravel\\JsonApiServiceProvider`. Package discovery registers it; if your\napplication lists `Ark4ne\\JsonApi\\Providers\\LaravelJsonApiProvider` in `bootstrap\u002Fproviders.php` or\n`config\u002Fapp.php`, replace it:\n\n```php\n\u002F\u002F 1.x\nArk4ne\\JsonApi\\Providers\\LaravelJsonApiProvider::class,\n\u002F\u002F 2.0\nArk4ne\\JsonApi\\Laravel\\JsonApiServiceProvider::class,\n```\n\n### Configuration\n\n`config\u002Fjsonapi.php` is validated at boot: a value of the wrong type throws an `InvalidConfigurationException` that\nnames the key. Compare your published file with the package one for the new keys.\n\n### Values\n\n- **`$this->date()` renders a date without time** (`2026-10-31`, `Y-m-d`); a date and time is `$this->datetime()`,\n  in the format of `describer.datetime` (ex-`describer.date`, ATOM by default). Replace `->date(` by `->datetime(`\n  wherever the time is rendered: a resource left with `date()` loses the time without error. A published\n  `config\u002Fjsonapi.php` still setting `describer.date` throws an `InvalidConfigurationException` at boot: rename it\n  `describer.datetime`. `Values\\ValueDate` is the date without time; the 1.x class is\n  `Values\\ValueDateTime`.\n\n  ```php\n  \u002F\u002F 1.x: 2026-10-31T10:00:00+00:00\n  'published-at' => $this->date(),\n  \u002F\u002F 2.0: the same output\n  'published-at' => $this->datetime(),\n  ```\n- A float with a precision is rounded instead of floored: `$this->float()->precision(2)` renders `1.24` for `1.239`\n  (1.x: `1.23`), `1.15` for `1.15` (1.x: `1.14`). Add `->truncate()` to truncate.\n- A date declared `nullable(false)` renders `null` for `null` (1.x: `1970-01-01T00:00:00+00:00`). With\n  `describer.strict`, true by default when `APP_DEBUG` is, it throws a `RenderingException` instead: make the value\n  nullable, or give it a value.\n- `enum()->of(State::class)` validates the value: a raw value is cast through the enum, and a value that is not one\n  of its cases throws a `RenderingException`. Remove `of()`, or fix the data, where a value outside the enum is\n  expected.\n- A custom value extending `Descriptors\\Values\\Value` receives the configuration:\n\n  ```php\n  protected function value(mixed $of, Request $request, Configuration $configuration): mixed\n  ```\n\n  `Support\\Config` is removed: read the defaults (`$configuration->nullable`, `datetimeFormat`, `precision`) from it.\n\n### Collections\n\n`collection()` returns a `JsonApiCollection`, no longer an anonymous subclass. `$preserveKeys` is ignored: `data` is a\nJSON list whatever the keys of the collection. To return a collection class of your own, override `collection()`:\n\n```php\npublic static function collection($resource): UserCollection\n{\n    return new UserCollection($resource);\n}\n```\n\n`float()` is `protected`, like the other value helpers: call it from the resource only.\n\n### Relationships and loading\n\n- `relationship.when-included` is replaced by `relationship.linkage`: `'included'` for `true`; remove the key for\n  `false` (`'always'`, the default). A published configuration keeping the old key throws at boot.\n- A relationship read from a relation (`$this->one(UserResource::class)`) loads it, in batch, even when it is not\n  included. Add `->withLoad(false)` where an application loads it itself, or `->whenIncluded()` to render its `data`\n  only when included.\n\n  ```php\n  \u002F\u002F 1.x: the relation is read as it is, loaded resource by resource if it is not\n  'author' => $this->one(UserResource::class),\n  \u002F\u002F 2.0: loaded in batch; to load it yourself, or render it only when included\n  'author' => $this->one(UserResource::class)->withLoad(false),\n  'author' => $this->one(UserResource::class)->whenIncluded(),\n  ```\n- `->withLoad(true)` loads the relation the relationship is read from: `$this->one(PostResource::class, 'post')` under\n  the name `main-post` loads `post` (1.x: `main-post`).\n- A `withLoad(['comments' => fn($query) => …])` constraint now filters the linkage too: the identifiers listed in\n  `data` are those of `included`.\n- A relationship with `->whenLoaded()` is loaded when included. Add `->withLoad(false)` to keep the 1.x behaviour.\n- `whenIncluded($request, $type, $value)` of the resources is renamed `whenInIncludes($request, $relationship,\n  $value)`.\n- `RelationshipDefinition::$whenIncluded` is `$linkage` (`Configuration\\Linkage|null`).\n- `RelationshipDefinition::$related` is a list of resource classes (`$relationship->related[0]` for a relationship\n  that is not polymorphic), empty for a relationship to Laravel's native resources (`isNative()`, `$native`). Run\n  `php artisan jsonapi:cache` again after upgrading.\n- `Filters` is immutable: `->filters(fn(Filters $filters) => $filters->can('view'))` works as before, but a closure\n  calling `can()` \u002F `when()` without returning their result loses the rules. Chain them and return the result.\n- `Relationship::links()` is `links(?Closure $links = null, string|Closure|null $self = null, string|Closure|null\n  $related = null)`: a subclass overriding `links(Closure $links)` must take the new signature. `links()` without any\n  link throws.\n\n### Static helpers\n\n`Support\\Includes`, `Support\\Fields`, `Support\\With`, `Support\\Supported` and `Support\\Traits\\HasLocalCache` are\nremoved, with `PrepareData::prepareData()` and the Octane `RequestReceived` listener (each request gets its own\ncontext, nothing to reset). Read the requested include and fields from the context of the request:\n\n```php\n\u002F\u002F 1.x\nIncludes::include($request, 'posts');\nFields::has($request, 'title', 'post');\n\u002F\u002F 2.0\n$context = app(JsonApiContext::class);\n$context->include->has('posts');           \u002F\u002F IncludeTree\n$context->fields->allows('post', 'title'); \u002F\u002F SparseFieldsets\n```\n\n### Validation rules\n\n`Rules\\Fields` and `Rules\\Includes` move to the `Http` layer: replace `Ark4ne\\JsonApi\\Requests\\Rules\\` by\n`Ark4ne\\JsonApi\\Http\\Rules\\` in your imports:\n\n```php\n\u002F\u002F 1.x\nuse Ark4ne\\JsonApi\\Requests\\Rules\\Includes;\n\u002F\u002F 2.0\nuse Ark4ne\\JsonApi\\Http\\Rules\\Includes;\n```\n\nA form request that only validates `include` and `fields` can extend\n`Ark4ne\\JsonApi\\Http\\JsonApiFormRequest` instead (`protected string $resource = PostResource::class;`).\n\n### Validation messages\n\nThe messages of `Rules\\Fields` and `Rules\\Includes` are translations of the package. Messages customized under\n`validation.custom.jsonapi.*` in `lang\u002F{locale}\u002Fvalidation.php` are no longer read: publish the translations\n(`php artisan vendor:publish --tag=jsonapi-lang`) and edit `lang\u002Fvendor\u002Fjsonapi\u002F{locale}\u002Fvalidation.php`, whose keys\nare the same without the `custom.jsonapi.` prefix (`fields.invalid_fields`, `includes.invalid_depth`…). A test\nasserting `\":resource\" doesn't exists.` reads `\":resource\" doesn't exist.` now.\n\nBoth rules are `final`: compose them instead of extending them. `Rules\\Traits\\UseTrans` is removed.\n\n### Schema and assertions\n\n`JsonApiResource::schema()`, `JsonApiCollection::schema()` and `Skeleton` are removed: `PostResource::definition()`\nreturns the `ResourceDefinition` (type, attributes, relationships with their related class and eager-loads).\n\n`Support\\FakeModel`, internal, is replaced by `Support\\Probe`: code that built a resource on a `FakeModel` to read\nwhat it declares reads `PostResource::definition()` instead.\n\n`Asserts\\AssertJsonApiResource` is removed: run `php artisan jsonapi:check` in the CI, or call\n`Testing\\ResourceAssertions::assertValid(PostResource::class)` in a test.\n\nA condition written with an `if` on the request inside a hook is not seen by the definition, which is built with an\nempty request: write it with `->when()`, `->unless()` or `applyWhen()` (README, section \"Definition\").\n\nThe members of `mergeWhen()` and `mergeUnless()` are missing from the definition whatever the condition, with a\n`merge-when` warning: they are still rendered, but `fields` and `include` cannot request them and their relations are\nnot eager-loaded. Group conditional members with `applyWhen()`:\n\n```php\n\u002F\u002F 1.x\n$this->mergeWhen($this->is_admin, ['secret' => $this->secret]),\n\u002F\u002F 2.0\n$this->applyWhen(fn() => $this->is_admin, ['secret' => $this->string()]),\n```\n\n`merge()`, `mergeWhen()` and `mergeUnless()` throw a `DefinitionException` when given a scalar or an object that is\nneither iterable, `Arrayable` nor `JsonSerializable`; `null` merges nothing.\n\n### `include` and `fields` come from the query string\n\n1.x read `include` and `fields` from all the input, body included. 2.0 reads them from the query string only, where\nthe specification defines them. A middleware adding a default include on a `GET` request\n(`$request->merge(['include' => …])`) keeps working: Laravel merges into the query of a `GET`.\n\n### `toArray()` returns the resource object\n\n`toArray($request)` returns the resource object only (`type`, `id`, `attributes`, `relationships`, `links`, `meta`),\nand a collection the list of them. `included`, the document meta and the pagination are only in the response:\nreturn the resource from the controller, or call `->toResponse($request)`. `with()` no longer returns `included` nor\nthe meta of `toDocumentMeta()`; what you add in `with()` or `additional()` is still merged into the response. The second\nargument of `toArray()` (`$included` \u002F `$minimal`) is removed: remove it from your overrides.\n\n```php\n\u002F\u002F 1.x\n$document = (new PostResource($post))->toArray($request, true);\n\u002F\u002F 2.0\n$document = (new PostResource($post))->toResponse($request)->getData(true);\n```\n\n`Resources\\Resourceable` and `Relationship::toArray()` are removed. A relationship points to a `JsonApiResource` or a\n`JsonApiCollection`, and a collection collects `JsonApiResource`s: anything else renders no resource object.\n\n### The JSON follows the specification\n\n```jsonc\n\u002F\u002F 1.x\n{\"data\": {\"type\": \"post\", \"id\": 1, \"attributes\": [], \"relationships\": {\"author\": []}}}\n\u002F\u002F 2.0\n{\"jsonapi\": {\"version\": \"1.1\"}, \"data\": {\"type\": \"post\", \"id\": \"1\", \"relationships\": {\"author\": {\"data\": null}}}}\n```\n\nClients reading the documents must expect:\n\n- a top-level `jsonapi` member, `{\"version\": \"1.1\"}` by default. Set `document.jsonapi` to `false` in\n  `config\u002Fjsonapi.php` to leave it out;\n- `id` always a string, in resource objects and in relationship linkage;\n- `{\"data\": null}` for an empty to-one relationship, `{\"data\": []}` for an empty to-many; a relationship that has\n  neither data, links nor meta is left out;\n- without `toAttributes()`, no `id`, `type`, model key, foreign keys of the declared relationships (`user_id`…) nor\n  loaded relations in `attributes`. Write `toAttributes()` if a client reads them there;\n- empty `attributes`, `relationships`, `links` or `meta` left out instead of `[]`. A hook returning members without\n  names (`toAttributes()` returning `['a', 'b']`, `toMeta()` returning `['x']`) now throws a `RenderingException`:\n  give each member a name;\n- `included` without the primary resources and without duplicates;\n- `fields[type]` restricting the relationships of the type too. To keep the 1.x behaviour:\n\n  ```php\n  \u002F\u002F config\u002Fjsonapi.php\n  'fields' => ['relationships' => 'keep'],\n  ```\n\n- document meta (`toDocumentMeta()`) from the primary resources only: an included resource adds none. In a collection they\n  are merged key by key, the first resource setting a key keeping it, instead of gathered into lists. To set document\n  meta for the whole collection, override `toDocumentMeta()` on the collection class: it wins over those of the resources.\n\n### Closures that are not requested are not run\n\nA closure of an attribute left out by `fields[type]`, or of a relationship whose linkage is not rendered, is never\ncalled: 1.x called it, then dropped the value. Code that relied on the side effects of such a closure (a counter, a\nlog, a lazy load) must do it elsewhere.\n\n```php\n\u002F\u002F GET \u002Fposts?fields[post]=title\n'word-count' => $this->integer(fn() => $this->countWords()), \u002F\u002F 1.x: called; 2.0: not called\n```\n\n### New value helpers\n\n`$this->uuid()`, `ulid()`, `decimal()`, `json()`, `time()` and `datetime()` are value descriptors now. A resource that\ncalled a model method of one of these names through `$this` must call it on the model:\n\n```php\n\u002F\u002F 1.x: the uuid() method of the model, through the resource\n'uuid' => $this->uuid(),\n\u002F\u002F 2.0\n'uuid' => $this->resource->uuid(),\n```\n\n### Renamed methods\n\n- `toMeta()` (document meta) is renamed `toDocumentMeta()`, on resources and collections: a class still declaring\n  `toMeta()` throws a `DefinitionException` (when compiled for a resource, when rendered for a collection) instead\n  of losing its meta silently. `toResourceMeta()` is unchanged.\n- On `Relationship` (`PostResource::relationship(...)`), `withLinks()` and `withMeta()` are renamed `links()` and\n  `meta()`, as on the relationship descriptors.\n\n  ```php\n  \u002F\u002F 1.x\n  protected function toMeta(Request $request): ?iterable { return ['total' => …]; }\n  PostResource::relationship(fn() => …)->withLinks(fn() => […]);\n  \u002F\u002F 2.0\n  protected function toDocumentMeta(Request $request): ?iterable { return ['total' => …]; }\n  PostResource::relationship(fn() => …)->links(fn() => […]);\n  ```\n- `toId(Request $request): int|string|null` is a hook of the resources, read by the default `toIdentifier()`: a\n  resource declaring a `toId()` of another signature must rename it.\n\n### Final classes\n\nThe descriptors (`RelationOne`, `RelationMany`, `ValueString` and the other values), `Relationship`, `Filters`,\n`CallbackFilterRule` and `PolicyFilterRule` are `final`. A subclass of one of them must become a wrapper, or a\n`Closure` rule (`->when(fn($request, $model, $attribute) => …)`). `Support\\Arr`, the `Descriptors\\Descriptors` trait,\n`Descriptors\\Resolver`, `Traits\\HasRelationLoad` and `RelationMissing` are removed: use Laravel's `Arr`, and\n`withLoad()` on the descriptors and on `Relationship`.\n\n### `applyWhen()`\n\n- A relationship given to `applyWhen()` is now left out when the condition fails (1.x rendered it anyway).\n- Only a `Closure` member is called to read its value: another callable (`'strlen'`, `[$service, 'method']`) is rendered\n  as it is. Wrap it in a closure (`fn() => $service->method()`).\n\n### Casts\n\n`string()`, `integer()` and `float()` throw a `RenderingException` for a value they cannot cast (an array, an object\nthat is not `Stringable`), and a resource whose identifier is neither an integer nor a string throws one too.\n\n### Static analysis\n\n`JsonApiResource\u003CUser>` now types the descriptors: `$this->string()` is a `ValueString\u003CUser>`, `$this->one(…)` a\n`RelationOne\u003CUser>`. A hook annotated with `Relation\u003Cmixed>` or `Value\u003Cmixed>` (`@return iterable\u003Cstring,\nRelation\u003Cmixed>>`) fails PHPStan: name the model (`Relation\u003CUser>`), or remove the `@return`, inherited from the\nparent. Nothing changes at runtime.\n\n`Filters` is no longer generic: replace `Filters\u003CPost>` with `Filters`; `when()` takes a closure typed on the model\n(`fn(Request $request, Post $post) => …`).\n\n### Deployment\n\nAdd nothing if you already run `php artisan optimize`: it now compiles the resource definitions too\n(`php artisan jsonapi:cache`).\n",{"title":287,"description":1011},"jSFIj4pCiixB7QUJoA0-75J5QwYFPQL3uWAJYYcC1fQ",[3443,118],{"title":291,"path":292,"stem":293,"description":3444,"children":-1},"All notable changes to this project are documented in this file.",1795438902864]