[{"data":1,"prerenderedAt":1769},["ShallowReactive",2],{"libs":3,"navigation-openapi-writer":115,"\u002Fopenapi-writer\u002Fschemas\u002Fcomposition-and-polymorphism":256,"\u002Fopenapi-writer\u002Fschemas\u002Fcomposition-and-polymorphism-surround":1764},[4,45,69,95],{"id":5,"color":6,"compatibility":7,"extension":20,"icon":21,"links":22,"meta":27,"name":28,"order":29,"package":30,"related":31,"stem":34,"tagline":35,"__hash__":36,"slug":37,"repository":38,"branch":39,"path":40,"collection":41,"entry":42,"home":43,"version":44},"laravel_json_api_meta\u002Fdocs\u002Fsite\u002Flib.yml","violet",[8,13,16],{"version":9,"php":10,"laravel":11,"status":12},"3.x","^8.3","^12.46 || ^13.0","active",{"version":14,"php":10,"laravel":11,"status":15},"2.x","eol",{"version":17,"php":18,"laravel":19,"status":15},"1.x","^8.1","^10.0 || ^11.0 || ^12.0 || ^13.0","yml","i-lucide-braces",[23],{"label":24,"to":25,"icon":26},"JSON:API 1.1","https:\u002F\u002Fjsonapi.org\u002Fformat\u002F","i-lucide-book-marked",{},"Laravel JSON:API",10,"ark4ne\u002Flaravel-json-api",[32,33],"laravel-api-revisions","laravel-openapi-generator","docs\u002Fsite\u002Flib","JSON:API 1.1 resources for Laravel, with typed values, validated includes and fieldsets, and API revisions.","ILGoVp9rzKYDQc18VV8kkXy3EQOQ8rv87JblFKXYDrU","laravel-json-api","Ark4ne\u002Flaravel-json-api","master","docs\u002Fsite","laravel_json_api","\u002Flaravel-json-api\u002Fgetting-started\u002Fintroduction","\u002Flaravel-json-api","v3.0.0",{"id":46,"color":47,"compatibility":48,"extension":20,"icon":50,"links":51,"meta":56,"name":57,"order":58,"package":59,"related":60,"stem":34,"tagline":61,"__hash__":62,"slug":32,"repository":63,"branch":64,"path":40,"collection":65,"entry":66,"home":67,"version":68},"laravel_api_revisions_meta\u002Fdocs\u002Fsite\u002Flib.yml","amber",[49],{"version":17,"php":10,"laravel":11,"status":12},"i-lucide-git-branch",[52],{"label":53,"to":54,"icon":55},"Agent skill","https:\u002F\u002Fgithub.com\u002FArk4ne\u002Flaravel-api-revisions\u002Ftree\u002Fmain\u002Fskills\u002Flaravel-api-revisions","i-lucide-bot",{},"Laravel API Revisions",20,"ark4ne\u002Flaravel-api-revisions",[37,33],"Typed schemas for Laravel resources and form requests, evolved through dated API revisions, Stripe-style.","w24MBVK4_XliIZ8nVcfnuT9OgR-m-Ytxz31Pxua_mLM","Ark4ne\u002Flaravel-api-revisions","main","laravel_api_revisions","\u002Flaravel-api-revisions\u002Fgetting-started\u002Fintroduction","\u002Flaravel-api-revisions","v1.0.0",{"id":70,"color":71,"compatibility":72,"extension":20,"icon":77,"links":78,"meta":82,"name":83,"order":84,"package":85,"related":86,"stem":34,"tagline":88,"__hash__":89,"slug":33,"repository":90,"branch":39,"path":40,"collection":91,"entry":92,"home":93,"version":94},"laravel_openapi_generator_meta\u002Fdocs\u002Fsite\u002Flib.yml","emerald",[73,75],{"version":17,"php":10,"laravel":74,"status":12},"^13.0",{"version":76,"php":18,"laravel":19,"status":15},"0.6","i-lucide-file-json",[79],{"label":80,"to":81,"icon":26},"OpenAPI Specification","https:\u002F\u002Fspec.openapis.org\u002Foas\u002Flatest.html",{},"Laravel OpenAPI Generator",30,"ark4ne\u002Flaravel-openapi-generator",[87,37,32],"openapi-writer","Generates OpenAPI 3.0, 3.1 and 3.2 documents from a Laravel application, its routes, form requests and resources.","DTt0SVqegMImLmWmwL8LCW5lxRCWFYcnBFOaquLpVwc","Ark4ne\u002Flaravel-openapi-generator","laravel_openapi_generator","\u002Flaravel-openapi-generator\u002Fgetting-started\u002Fintroduction","\u002Flaravel-openapi-generator","v1.2.0",{"id":96,"color":97,"compatibility":98,"extension":20,"icon":101,"links":102,"meta":104,"name":105,"order":106,"package":107,"related":108,"stem":34,"tagline":109,"__hash__":110,"slug":87,"repository":111,"branch":64,"path":40,"collection":112,"entry":113,"home":114,"version":68},"openapi_writer_meta\u002Fdocs\u002Fsite\u002Flib.yml","sky",[99],{"version":17,"php":100,"status":12},"^8.2","i-lucide-file-pen-line",[103],{"label":80,"to":81,"icon":26},{},"OpenAPI Writer",40,"ark4ne\u002Fopenapi-writer",[33],"Framework-agnostic, fluent and immutable PHP builder for OpenAPI 3.0, 3.1 and 3.2 documents, written as JSON or YAML and validated.","JFQcdQ9GEChOkfRKibLjoxZOfnt6HYNsayX2melOzMk","Ark4ne\u002Fopenapi-writer","openapi_writer","\u002Fopenapi-writer\u002Fgetting-started\u002Fintroduction","\u002Fopenapi-writer",[116,135,169,182,212,226,248],{"title":117,"since":118,"experimental":119,"icon":120,"path":121,"stem":122,"children":123,"page":119},"Getting started",null,false,"i-lucide-rocket","\u002Fopenapi-writer\u002Fgetting-started","openapi-writer\u002F1.getting-started",[124,127,131],{"title":125,"path":113,"stem":126,"since":118,"experimental":119},"Introduction","openapi-writer\u002F1.getting-started\u002F1.introduction",{"title":128,"path":129,"stem":130,"since":118,"experimental":119},"Installation","\u002Fopenapi-writer\u002Fgetting-started\u002Finstallation","openapi-writer\u002F1.getting-started\u002F2.installation",{"title":132,"path":133,"stem":134,"since":118,"experimental":119},"Quick start","\u002Fopenapi-writer\u002Fgetting-started\u002Fquick-start","openapi-writer\u002F1.getting-started\u002F3.quick-start",{"title":136,"since":118,"experimental":119,"icon":137,"path":138,"stem":139,"children":140,"page":119},"Building documents","i-lucide-blocks","\u002Fopenapi-writer\u002Fbuilding-documents","openapi-writer\u002F2.building-documents",[141,145,149,153,157,161,165],{"title":142,"path":143,"stem":144,"since":118,"experimental":119},"The object model","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fthe-object-model","openapi-writer\u002F2.building-documents\u002F1.the-object-model",{"title":146,"path":147,"stem":148,"since":118,"experimental":119},"Document","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fdocument","openapi-writer\u002F2.building-documents\u002F2.document",{"title":150,"path":151,"stem":152,"since":118,"experimental":119},"Paths and operations","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fpaths-and-operations","openapi-writer\u002F2.building-documents\u002F3.paths-and-operations",{"title":154,"path":155,"stem":156,"since":118,"experimental":119},"Requests and responses","\u002Fopenapi-writer\u002Fbuilding-documents\u002Frequests-and-responses","openapi-writer\u002F2.building-documents\u002F4.requests-and-responses",{"title":158,"path":159,"stem":160,"since":118,"experimental":119},"Components and references","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fcomponents-and-references","openapi-writer\u002F2.building-documents\u002F5.components-and-references",{"title":162,"path":163,"stem":164,"since":118,"experimental":119},"Security","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fsecurity","openapi-writer\u002F2.building-documents\u002F6.security",{"title":166,"path":167,"stem":168,"since":118,"experimental":119},"Webhooks and callbacks","\u002Fopenapi-writer\u002Fbuilding-documents\u002Fwebhooks-and-callbacks","openapi-writer\u002F2.building-documents\u002F7.webhooks-and-callbacks",{"title":170,"since":118,"experimental":119,"icon":21,"path":171,"stem":172,"children":173,"page":119},"Schemas","\u002Fopenapi-writer\u002Fschemas","openapi-writer\u002F3.schemas",[174,178],{"title":175,"path":176,"stem":177,"since":118,"experimental":119},"Types and constraints","\u002Fopenapi-writer\u002Fschemas\u002Ftypes-and-constraints","openapi-writer\u002F3.schemas\u002F1.types-and-constraints",{"title":179,"path":180,"stem":181,"since":118,"experimental":119},"Composition and polymorphism","\u002Fopenapi-writer\u002Fschemas\u002Fcomposition-and-polymorphism","openapi-writer\u002F3.schemas\u002F2.composition-and-polymorphism",{"title":183,"since":118,"experimental":119,"icon":184,"path":185,"stem":186,"children":187,"page":119},"Versions and output","i-lucide-layers","\u002Fopenapi-writer\u002Fversions-and-output","openapi-writer\u002F4.versions-and-output",[188,192,196,200,204,208],{"title":189,"path":190,"stem":191,"since":118,"experimental":119},"Writing a document","\u002Fopenapi-writer\u002Fversions-and-output\u002Fwriting-a-document","openapi-writer\u002F4.versions-and-output\u002F1.writing-a-document",{"title":193,"path":194,"stem":195,"since":118,"experimental":119},"Choosing a version","\u002Fopenapi-writer\u002Fversions-and-output\u002Fchoosing-a-version","openapi-writer\u002F4.versions-and-output\u002F2.choosing-a-version",{"title":197,"path":198,"stem":199,"since":118,"experimental":119},"Conversions","\u002Fopenapi-writer\u002Fversions-and-output\u002Fconversions","openapi-writer\u002F4.versions-and-output\u002F3.conversions",{"title":201,"path":202,"stem":203,"since":118,"experimental":119},"Strict and lenient","\u002Fopenapi-writer\u002Fversions-and-output\u002Fstrict-and-lenient","openapi-writer\u002F4.versions-and-output\u002F4.strict-and-lenient",{"title":205,"path":206,"stem":207,"since":118,"experimental":119},"OpenAPI 3.2","\u002Fopenapi-writer\u002Fversions-and-output\u002Fopenapi-3-2","openapi-writer\u002F4.versions-and-output\u002F5.openapi-3-2",{"title":209,"path":210,"stem":211,"since":118,"experimental":119},"Redoc extensions","\u002Fopenapi-writer\u002Fversions-and-output\u002Fredoc-extensions","openapi-writer\u002F4.versions-and-output\u002F6.redoc-extensions",{"title":213,"since":118,"experimental":119,"icon":214,"path":215,"stem":216,"children":217,"page":119},"Validation","i-lucide-badge-check","\u002Fopenapi-writer\u002Fvalidation","openapi-writer\u002F5.validation",[218,222],{"title":219,"path":220,"stem":221,"since":118,"experimental":119},"Validating a document","\u002Fopenapi-writer\u002Fvalidation\u002Fvalidating-a-document","openapi-writer\u002F5.validation\u002F1.validating-a-document",{"title":223,"path":224,"stem":225,"since":118,"experimental":119},"Custom rules","\u002Fopenapi-writer\u002Fvalidation\u002Fcustom-rules","openapi-writer\u002F5.validation\u002F2.custom-rules",{"title":227,"since":118,"experimental":119,"icon":228,"path":229,"stem":230,"children":231,"page":119},"Reference","i-lucide-library","\u002Fopenapi-writer\u002Freference","openapi-writer\u002F6.reference",[232,236,240,244],{"title":233,"path":234,"stem":235,"since":118,"experimental":119},"Objects","\u002Fopenapi-writer\u002Freference\u002Fobjects","openapi-writer\u002F6.reference\u002F1.objects",{"title":237,"path":238,"stem":239,"since":118,"experimental":119},"Enums","\u002Fopenapi-writer\u002Freference\u002Fenums","openapi-writer\u002F6.reference\u002F2.enums",{"title":241,"path":242,"stem":243,"since":118,"experimental":119},"Validation rules","\u002Fopenapi-writer\u002Freference\u002Fvalidation-rules","openapi-writer\u002F6.reference\u002F3.validation-rules",{"title":245,"path":246,"stem":247,"since":118,"experimental":119},"Exceptions","\u002Fopenapi-writer\u002Freference\u002Fexceptions","openapi-writer\u002F6.reference\u002F4.exceptions",{"title":249,"path":250,"children":251},"Releases","\u002Fopenapi-writer\u002Freleases",[252],{"title":253,"path":254,"stem":255,"since":118,"experimental":119},"Changelog","\u002Fopenapi-writer\u002Fchangelog","openapi-writer\u002FCHANGELOG",{"id":257,"title":179,"body":258,"description":1758,"experimental":119,"extension":1759,"links":118,"meta":1760,"navigation":342,"path":180,"rawbody":1761,"seo":1762,"since":118,"stem":181,"__hash__":1763},"openapi_writer\u002Fopenapi-writer\u002F3.schemas\u002F2.composition-and-polymorphism.md",{"type":259,"value":260,"toc":1751},"minimark",[261,283,288,670,674,687,1165,1176,1180,1193,1309,1316,1320,1323,1591,1595,1730,1747],[262,263,264,265,269,270,273,274,277,278,282],"p",{},"Composition builds a schema from others: ",[266,267,268],"code",{},"allOf"," extends, ",[266,271,272],{},"oneOf"," and ",[266,275,276],{},"anyOf"," choose. Combined with\n",[279,280,281],"a",{"href":159},"references",", it keeps each shape declared once.",[284,285,287],"h2",{"id":286},"extending-a-schema","Extending a schema",[289,290,293,481],"example",{"input":291,"output":292},"Schema","components.schemas.Admin",[294,295,297],"template",{"v-slot:input":296},"",[298,299,303],"pre",{"className":300,"code":301,"language":302,"meta":296,"style":296},"language-php shiki shiki-themes material-theme-lighter github-light github-dark","use Ark4ne\\OpenApiWriter\\Objects\\Schema;\n\nSchema::create('Admin')->allOf(\n    Schema::ref('User'),\n    Schema::object()->properties(\n        Schema::array('permissions')\n            ->items(Schema::string()),\n    ),\n);\n","php",[266,304,305,337,344,382,405,425,448,469,475],{"__ignoreMap":296},[306,307,310,314,318,322,325,327,329,331,333],"span",{"class":308,"line":309},"line",1,[306,311,313],{"class":312},"sw1J6","use",[306,315,317],{"class":316},"s_hVV"," Ark4ne",[306,319,321],{"class":320},"s39Yj","\\",[306,323,324],{"class":316},"OpenApiWriter",[306,326,321],{"class":320},[306,328,233],{"class":316},[306,330,321],{"class":320},[306,332,291],{"class":316},[306,334,336],{"class":335},"sP7_E",";\n",[306,338,340],{"class":308,"line":339},2,[306,341,343],{"emptyLinePlaceholder":342},true,"\n",[306,345,347,350,354,358,361,365,369,371,374,377,379],{"class":308,"line":346},3,[306,348,291],{"class":349},"sZMiF",[306,351,353],{"class":352},"smGrS","::",[306,355,357],{"class":356},"sGLFI","create",[306,359,360],{"class":335},"(",[306,362,364],{"class":363},"sjJ54","'",[306,366,368],{"class":367},"s_sjI","Admin",[306,370,364],{"class":363},[306,372,373],{"class":335},")",[306,375,376],{"class":352},"->",[306,378,268],{"class":356},[306,380,381],{"class":335},"(\n",[306,383,385,388,390,393,395,397,400,402],{"class":308,"line":384},4,[306,386,387],{"class":349},"    Schema",[306,389,353],{"class":352},[306,391,392],{"class":356},"ref",[306,394,360],{"class":335},[306,396,364],{"class":363},[306,398,399],{"class":367},"User",[306,401,364],{"class":363},[306,403,404],{"class":335},"),\n",[306,406,408,410,412,415,418,420,423],{"class":308,"line":407},5,[306,409,387],{"class":349},[306,411,353],{"class":352},[306,413,414],{"class":356},"object",[306,416,417],{"class":335},"()",[306,419,376],{"class":352},[306,421,422],{"class":356},"properties",[306,424,381],{"class":335},[306,426,428,431,433,436,438,440,443,445],{"class":308,"line":427},6,[306,429,430],{"class":349},"        Schema",[306,432,353],{"class":352},[306,434,435],{"class":356},"array",[306,437,360],{"class":335},[306,439,364],{"class":363},[306,441,442],{"class":367},"permissions",[306,444,364],{"class":363},[306,446,447],{"class":335},")\n",[306,449,451,454,457,459,461,463,466],{"class":308,"line":450},7,[306,452,453],{"class":352},"            ->",[306,455,456],{"class":356},"items",[306,458,360],{"class":335},[306,460,291],{"class":349},[306,462,353],{"class":352},[306,464,465],{"class":356},"string",[306,467,468],{"class":335},"()),\n",[306,470,472],{"class":308,"line":471},8,[306,473,474],{"class":335},"    ),\n",[306,476,478],{"class":308,"line":477},9,[306,479,480],{"class":335},");\n",[294,482,483],{"v-slot:output":296},[298,484,488],{"className":485,"code":486,"language":487,"meta":296,"style":296},"language-json shiki shiki-themes material-theme-lighter github-light github-dark","{\n  \"allOf\": [\n    { \"$ref\": \"#\u002Fcomponents\u002Fschemas\u002FUser\" },\n    {\n      \"type\": \"object\",\n      \"properties\": {\n        \"permissions\": {\n          \"type\": \"array\",\n          \"items\": { \"type\": \"string\" }\n        }\n      }\n    }\n  ]\n}\n","json",[266,489,490,495,512,537,542,563,576,590,610,641,646,652,658,664],{"__ignoreMap":296},[306,491,492],{"class":308,"line":309},[306,493,494],{"class":335},"{\n",[306,496,497,500,503,506,509],{"class":308,"line":339},[306,498,499],{"class":320},"  \"",[306,501,268],{"class":502},"sseR_",[306,504,505],{"class":320},"\"",[306,507,508],{"class":335},":",[306,510,511],{"class":335}," [\n",[306,513,514,517,520,523,525,527,529,532,534],{"class":308,"line":346},[306,515,516],{"class":335},"    {",[306,518,519],{"class":320}," \"",[306,521,522],{"class":349},"$ref",[306,524,505],{"class":320},[306,526,508],{"class":335},[306,528,519],{"class":363},[306,530,531],{"class":367},"#\u002Fcomponents\u002Fschemas\u002FUser",[306,533,505],{"class":363},[306,535,536],{"class":335}," },\n",[306,538,539],{"class":308,"line":384},[306,540,541],{"class":335},"    {\n",[306,543,544,547,550,552,554,556,558,560],{"class":308,"line":407},[306,545,546],{"class":320},"      \"",[306,548,549],{"class":349},"type",[306,551,505],{"class":320},[306,553,508],{"class":335},[306,555,519],{"class":363},[306,557,414],{"class":367},[306,559,505],{"class":363},[306,561,562],{"class":335},",\n",[306,564,565,567,569,571,573],{"class":308,"line":427},[306,566,546],{"class":320},[306,568,422],{"class":349},[306,570,505],{"class":320},[306,572,508],{"class":335},[306,574,575],{"class":335}," {\n",[306,577,578,581,584,586,588],{"class":308,"line":450},[306,579,580],{"class":320},"        \"",[306,582,442],{"class":583},"srdBf",[306,585,505],{"class":320},[306,587,508],{"class":335},[306,589,575],{"class":335},[306,591,592,595,598,600,602,604,606,608],{"class":308,"line":471},[306,593,594],{"class":320},"          \"",[306,596,549],{"class":597},"swQdS",[306,599,505],{"class":320},[306,601,508],{"class":335},[306,603,519],{"class":363},[306,605,435],{"class":367},[306,607,505],{"class":363},[306,609,562],{"class":335},[306,611,612,614,616,618,620,623,625,628,630,632,634,636,638],{"class":308,"line":477},[306,613,594],{"class":320},[306,615,456],{"class":597},[306,617,505],{"class":320},[306,619,508],{"class":335},[306,621,622],{"class":335}," {",[306,624,519],{"class":320},[306,626,549],{"class":627},"sAQsV",[306,629,505],{"class":320},[306,631,508],{"class":335},[306,633,519],{"class":363},[306,635,465],{"class":367},[306,637,505],{"class":363},[306,639,640],{"class":335}," }\n",[306,642,643],{"class":308,"line":29},[306,644,645],{"class":335},"        }\n",[306,647,649],{"class":308,"line":648},11,[306,650,651],{"class":335},"      }\n",[306,653,655],{"class":308,"line":654},12,[306,656,657],{"class":335},"    }\n",[306,659,661],{"class":308,"line":660},13,[306,662,663],{"class":335},"  ]\n",[306,665,667],{"class":308,"line":666},14,[306,668,669],{"class":335},"}\n",[284,671,673],{"id":672},"polymorphism-with-a-discriminator","Polymorphism with a discriminator",[262,675,676,678,679,682,683,686],{},[266,677,272],{}," lists the variants; the ",[266,680,681],{},"Discriminator"," names the property that tells them apart, and ",[266,684,685],{},"mapping()"," maps its\nvalues to schema names or references.",[298,688,690],{"className":300,"code":689,"language":302,"meta":296,"style":296},"use Ark4ne\\OpenApiWriter\\Objects\\Discriminator;\n\n$payment = Schema::create('Payment')\n    ->oneOf(\n        Schema::ref('CardPayment'),\n        Schema::ref('TransferPayment'),\n    )\n    ->discriminator(\n        Discriminator::create()\n            ->propertyName('method')\n            ->mapping([\n                'card' => '#\u002Fcomponents\u002Fschemas\u002FCardPayment',\n                'transfer' => '#\u002Fcomponents\u002Fschemas\u002FTransferPayment',\n            ]),\n    );\n\n$card = Schema::object('CardPayment')\n    ->properties(\n        Schema::string('method')->const('card'),\n        Schema::string('last4')->pattern('^[0-9]{4}$'),\n    )\n    ->required('method', 'last4');\n\n$transfer = Schema::object('TransferPayment')\n    ->properties(\n        Schema::string('method')->const('transfer'),\n        Schema::string('iban'),\n    )\n    ->required('method', 'iban');\n",[266,691,692,712,716,746,755,774,793,798,807,819,837,847,870,890,895,901,906,932,941,975,1010,1015,1042,1047,1073,1082,1115,1135,1140],{"__ignoreMap":296},[306,693,694,696,698,700,702,704,706,708,710],{"class":308,"line":309},[306,695,313],{"class":312},[306,697,317],{"class":316},[306,699,321],{"class":320},[306,701,324],{"class":316},[306,703,321],{"class":320},[306,705,233],{"class":316},[306,707,321],{"class":320},[306,709,681],{"class":316},[306,711,336],{"class":335},[306,713,714],{"class":308,"line":339},[306,715,343],{"emptyLinePlaceholder":342},[306,717,718,721,725,728,731,733,735,737,739,742,744],{"class":308,"line":346},[306,719,720],{"class":335},"$",[306,722,724],{"class":723},"su5hD","payment ",[306,726,727],{"class":352},"=",[306,729,730],{"class":349}," Schema",[306,732,353],{"class":352},[306,734,357],{"class":356},[306,736,360],{"class":335},[306,738,364],{"class":363},[306,740,741],{"class":367},"Payment",[306,743,364],{"class":363},[306,745,447],{"class":335},[306,747,748,751,753],{"class":308,"line":384},[306,749,750],{"class":352},"    ->",[306,752,272],{"class":356},[306,754,381],{"class":335},[306,756,757,759,761,763,765,767,770,772],{"class":308,"line":407},[306,758,430],{"class":349},[306,760,353],{"class":352},[306,762,392],{"class":356},[306,764,360],{"class":335},[306,766,364],{"class":363},[306,768,769],{"class":367},"CardPayment",[306,771,364],{"class":363},[306,773,404],{"class":335},[306,775,776,778,780,782,784,786,789,791],{"class":308,"line":427},[306,777,430],{"class":349},[306,779,353],{"class":352},[306,781,392],{"class":356},[306,783,360],{"class":335},[306,785,364],{"class":363},[306,787,788],{"class":367},"TransferPayment",[306,790,364],{"class":363},[306,792,404],{"class":335},[306,794,795],{"class":308,"line":450},[306,796,797],{"class":335},"    )\n",[306,799,800,802,805],{"class":308,"line":471},[306,801,750],{"class":352},[306,803,804],{"class":356},"discriminator",[306,806,381],{"class":335},[306,808,809,812,814,816],{"class":308,"line":477},[306,810,811],{"class":349},"        Discriminator",[306,813,353],{"class":352},[306,815,357],{"class":356},[306,817,818],{"class":335},"()\n",[306,820,821,823,826,828,830,833,835],{"class":308,"line":29},[306,822,453],{"class":352},[306,824,825],{"class":356},"propertyName",[306,827,360],{"class":335},[306,829,364],{"class":363},[306,831,832],{"class":367},"method",[306,834,364],{"class":363},[306,836,447],{"class":335},[306,838,839,841,844],{"class":308,"line":648},[306,840,453],{"class":352},[306,842,843],{"class":356},"mapping",[306,845,846],{"class":335},"([\n",[306,848,849,852,855,857,860,863,866,868],{"class":308,"line":654},[306,850,851],{"class":363},"                '",[306,853,854],{"class":367},"card",[306,856,364],{"class":363},[306,858,859],{"class":352}," =>",[306,861,862],{"class":363}," '",[306,864,865],{"class":367},"#\u002Fcomponents\u002Fschemas\u002FCardPayment",[306,867,364],{"class":363},[306,869,562],{"class":335},[306,871,872,874,877,879,881,883,886,888],{"class":308,"line":660},[306,873,851],{"class":363},[306,875,876],{"class":367},"transfer",[306,878,364],{"class":363},[306,880,859],{"class":352},[306,882,862],{"class":363},[306,884,885],{"class":367},"#\u002Fcomponents\u002Fschemas\u002FTransferPayment",[306,887,364],{"class":363},[306,889,562],{"class":335},[306,891,892],{"class":308,"line":666},[306,893,894],{"class":335},"            ]),\n",[306,896,898],{"class":308,"line":897},15,[306,899,900],{"class":335},"    );\n",[306,902,904],{"class":308,"line":903},16,[306,905,343],{"emptyLinePlaceholder":342},[306,907,909,911,914,916,918,920,922,924,926,928,930],{"class":308,"line":908},17,[306,910,720],{"class":335},[306,912,913],{"class":723},"card ",[306,915,727],{"class":352},[306,917,730],{"class":349},[306,919,353],{"class":352},[306,921,414],{"class":356},[306,923,360],{"class":335},[306,925,364],{"class":363},[306,927,769],{"class":367},[306,929,364],{"class":363},[306,931,447],{"class":335},[306,933,935,937,939],{"class":308,"line":934},18,[306,936,750],{"class":352},[306,938,422],{"class":356},[306,940,381],{"class":335},[306,942,944,946,948,950,952,954,956,958,960,962,965,967,969,971,973],{"class":308,"line":943},19,[306,945,430],{"class":349},[306,947,353],{"class":352},[306,949,465],{"class":356},[306,951,360],{"class":335},[306,953,364],{"class":363},[306,955,832],{"class":367},[306,957,364],{"class":363},[306,959,373],{"class":335},[306,961,376],{"class":352},[306,963,964],{"class":356},"const",[306,966,360],{"class":335},[306,968,364],{"class":363},[306,970,854],{"class":367},[306,972,364],{"class":363},[306,974,404],{"class":335},[306,976,977,979,981,983,985,987,990,992,994,996,999,1001,1003,1006,1008],{"class":308,"line":58},[306,978,430],{"class":349},[306,980,353],{"class":352},[306,982,465],{"class":356},[306,984,360],{"class":335},[306,986,364],{"class":363},[306,988,989],{"class":367},"last4",[306,991,364],{"class":363},[306,993,373],{"class":335},[306,995,376],{"class":352},[306,997,998],{"class":356},"pattern",[306,1000,360],{"class":335},[306,1002,364],{"class":363},[306,1004,1005],{"class":367},"^[0-9]{4}$",[306,1007,364],{"class":363},[306,1009,404],{"class":335},[306,1011,1013],{"class":308,"line":1012},21,[306,1014,797],{"class":335},[306,1016,1018,1020,1023,1025,1027,1029,1031,1034,1036,1038,1040],{"class":308,"line":1017},22,[306,1019,750],{"class":352},[306,1021,1022],{"class":356},"required",[306,1024,360],{"class":335},[306,1026,364],{"class":363},[306,1028,832],{"class":367},[306,1030,364],{"class":363},[306,1032,1033],{"class":335},",",[306,1035,862],{"class":363},[306,1037,989],{"class":367},[306,1039,364],{"class":363},[306,1041,480],{"class":335},[306,1043,1045],{"class":308,"line":1044},23,[306,1046,343],{"emptyLinePlaceholder":342},[306,1048,1050,1052,1055,1057,1059,1061,1063,1065,1067,1069,1071],{"class":308,"line":1049},24,[306,1051,720],{"class":335},[306,1053,1054],{"class":723},"transfer ",[306,1056,727],{"class":352},[306,1058,730],{"class":349},[306,1060,353],{"class":352},[306,1062,414],{"class":356},[306,1064,360],{"class":335},[306,1066,364],{"class":363},[306,1068,788],{"class":367},[306,1070,364],{"class":363},[306,1072,447],{"class":335},[306,1074,1076,1078,1080],{"class":308,"line":1075},25,[306,1077,750],{"class":352},[306,1079,422],{"class":356},[306,1081,381],{"class":335},[306,1083,1085,1087,1089,1091,1093,1095,1097,1099,1101,1103,1105,1107,1109,1111,1113],{"class":308,"line":1084},26,[306,1086,430],{"class":349},[306,1088,353],{"class":352},[306,1090,465],{"class":356},[306,1092,360],{"class":335},[306,1094,364],{"class":363},[306,1096,832],{"class":367},[306,1098,364],{"class":363},[306,1100,373],{"class":335},[306,1102,376],{"class":352},[306,1104,964],{"class":356},[306,1106,360],{"class":335},[306,1108,364],{"class":363},[306,1110,876],{"class":367},[306,1112,364],{"class":363},[306,1114,404],{"class":335},[306,1116,1118,1120,1122,1124,1126,1128,1131,1133],{"class":308,"line":1117},27,[306,1119,430],{"class":349},[306,1121,353],{"class":352},[306,1123,465],{"class":356},[306,1125,360],{"class":335},[306,1127,364],{"class":363},[306,1129,1130],{"class":367},"iban",[306,1132,364],{"class":363},[306,1134,404],{"class":335},[306,1136,1138],{"class":308,"line":1137},28,[306,1139,797],{"class":335},[306,1141,1143,1145,1147,1149,1151,1153,1155,1157,1159,1161,1163],{"class":308,"line":1142},29,[306,1144,750],{"class":352},[306,1146,1022],{"class":356},[306,1148,360],{"class":335},[306,1150,364],{"class":363},[306,1152,832],{"class":367},[306,1154,364],{"class":363},[306,1156,1033],{"class":335},[306,1158,862],{"class":363},[306,1160,1130],{"class":367},[306,1162,364],{"class":363},[306,1164,480],{"class":335},[262,1166,1167,1168,1171,1172,1175],{},"Each variant declares the discriminator property. The validator checks that every mapping resolves\n(",[266,1169,1170],{},"LocalReferencesRule","). ",[266,1173,1174],{},"Discriminator::defaultMapping()"," exists from OpenAPI 3.2.",[284,1177,1179],{"id":1178},"a-nullable-reference","A nullable reference",[262,1181,1182,1185,1186,1188,1189,1192],{},[266,1183,1184],{},"nullable()"," on a reference writes an ",[266,1187,276],{}," with the ",[266,1190,1191],{},"null"," type:",[289,1194,1196,1238],{"input":291,"output":1195},"3.1.2",[294,1197,1198],{"v-slot:input":296},[298,1199,1201],{"className":300,"code":1200,"language":302,"meta":296,"style":296},"Schema::ref('User', 'owner')->nullable();\n",[266,1202,1203],{"__ignoreMap":296},[306,1204,1205,1207,1209,1211,1213,1215,1217,1219,1221,1223,1226,1228,1230,1232,1235],{"class":308,"line":309},[306,1206,291],{"class":349},[306,1208,353],{"class":352},[306,1210,392],{"class":356},[306,1212,360],{"class":335},[306,1214,364],{"class":363},[306,1216,399],{"class":367},[306,1218,364],{"class":363},[306,1220,1033],{"class":335},[306,1222,862],{"class":363},[306,1224,1225],{"class":367},"owner",[306,1227,364],{"class":363},[306,1229,373],{"class":335},[306,1231,376],{"class":352},[306,1233,1234],{"class":356},"nullable",[306,1236,1237],{"class":335},"();\n",[294,1239,1240],{"v-slot:output":296},[298,1241,1243],{"className":485,"code":1242,"language":487,"meta":296,"style":296},"{\n  \"anyOf\": [\n    { \"$ref\": \"#\u002Fcomponents\u002Fschemas\u002FUser\" },\n    { \"type\": \"null\" }\n  ]\n}\n",[266,1244,1245,1249,1261,1281,1301,1305],{"__ignoreMap":296},[306,1246,1247],{"class":308,"line":309},[306,1248,494],{"class":335},[306,1250,1251,1253,1255,1257,1259],{"class":308,"line":339},[306,1252,499],{"class":320},[306,1254,276],{"class":502},[306,1256,505],{"class":320},[306,1258,508],{"class":335},[306,1260,511],{"class":335},[306,1262,1263,1265,1267,1269,1271,1273,1275,1277,1279],{"class":308,"line":346},[306,1264,516],{"class":335},[306,1266,519],{"class":320},[306,1268,522],{"class":349},[306,1270,505],{"class":320},[306,1272,508],{"class":335},[306,1274,519],{"class":363},[306,1276,531],{"class":367},[306,1278,505],{"class":363},[306,1280,536],{"class":335},[306,1282,1283,1285,1287,1289,1291,1293,1295,1297,1299],{"class":308,"line":384},[306,1284,516],{"class":335},[306,1286,519],{"class":320},[306,1288,549],{"class":349},[306,1290,505],{"class":320},[306,1292,508],{"class":335},[306,1294,519],{"class":363},[306,1296,1191],{"class":367},[306,1298,505],{"class":363},[306,1300,640],{"class":335},[306,1302,1303],{"class":308,"line":407},[306,1304,663],{"class":335},[306,1306,1307],{"class":308,"line":427},[306,1308,669],{"class":335},[262,1310,1311,1312,1315],{},"For 3.0, the second branch is ",[266,1313,1314],{},"{\"enum\": [null], \"type\": \"object\", \"nullable\": true}",".",[284,1317,1319],{"id":1318},"a-generic-envelope","A generic envelope",[262,1321,1322],{},"A closure returning a schema gives a reusable envelope, here a page of items:",[298,1324,1326],{"className":300,"code":1325,"language":302,"meta":296,"style":296},"use Ark4ne\\OpenApiWriter\\Objects\\MediaType;\nuse Ark4ne\\OpenApiWriter\\Objects\\Response;\n\n$paginated = static fn(string $item): Schema => Schema::create()->allOf(\n    Schema::ref('Page'),\n    Schema::object()\n        ->properties(\n            Schema::array('data')->items(Schema::ref($item)),\n        )\n        ->required('data'),\n);\n\n$books = Response::ok()->content(\n    MediaType::json()->schema($paginated('Book')),\n);\n",[266,1327,1328,1349,1370,1374,1422,1441,1451,1460,1500,1505,1521,1525,1529,1555,1587],{"__ignoreMap":296},[306,1329,1330,1332,1334,1336,1338,1340,1342,1344,1347],{"class":308,"line":309},[306,1331,313],{"class":312},[306,1333,317],{"class":316},[306,1335,321],{"class":320},[306,1337,324],{"class":316},[306,1339,321],{"class":320},[306,1341,233],{"class":316},[306,1343,321],{"class":320},[306,1345,1346],{"class":316},"MediaType",[306,1348,336],{"class":335},[306,1350,1351,1353,1355,1357,1359,1361,1363,1365,1368],{"class":308,"line":339},[306,1352,313],{"class":312},[306,1354,317],{"class":316},[306,1356,321],{"class":320},[306,1358,324],{"class":316},[306,1360,321],{"class":320},[306,1362,233],{"class":316},[306,1364,321],{"class":320},[306,1366,1367],{"class":316},"Response",[306,1369,336],{"class":335},[306,1371,1372],{"class":308,"line":346},[306,1373,343],{"emptyLinePlaceholder":342},[306,1375,1376,1378,1381,1383,1387,1390,1392,1394,1397,1400,1402,1404,1406,1408,1410,1412,1414,1416,1418,1420],{"class":308,"line":384},[306,1377,720],{"class":335},[306,1379,1380],{"class":723},"paginated ",[306,1382,727],{"class":352},[306,1384,1386],{"class":1385},"sbsja"," static",[306,1388,1389],{"class":1385}," fn",[306,1391,360],{"class":335},[306,1393,465],{"class":312},[306,1395,1396],{"class":335}," $",[306,1398,1399],{"class":723},"item",[306,1401,373],{"class":335},[306,1403,508],{"class":352},[306,1405,730],{"class":349},[306,1407,859],{"class":335},[306,1409,730],{"class":349},[306,1411,353],{"class":352},[306,1413,357],{"class":356},[306,1415,417],{"class":335},[306,1417,376],{"class":352},[306,1419,268],{"class":356},[306,1421,381],{"class":335},[306,1423,1424,1426,1428,1430,1432,1434,1437,1439],{"class":308,"line":407},[306,1425,387],{"class":349},[306,1427,353],{"class":352},[306,1429,392],{"class":356},[306,1431,360],{"class":335},[306,1433,364],{"class":363},[306,1435,1436],{"class":367},"Page",[306,1438,364],{"class":363},[306,1440,404],{"class":335},[306,1442,1443,1445,1447,1449],{"class":308,"line":427},[306,1444,387],{"class":349},[306,1446,353],{"class":352},[306,1448,414],{"class":356},[306,1450,818],{"class":335},[306,1452,1453,1456,1458],{"class":308,"line":450},[306,1454,1455],{"class":352},"        ->",[306,1457,422],{"class":356},[306,1459,381],{"class":335},[306,1461,1462,1465,1467,1469,1471,1473,1476,1478,1480,1482,1484,1486,1488,1490,1492,1495,1497],{"class":308,"line":471},[306,1463,1464],{"class":349},"            Schema",[306,1466,353],{"class":352},[306,1468,435],{"class":356},[306,1470,360],{"class":335},[306,1472,364],{"class":363},[306,1474,1475],{"class":367},"data",[306,1477,364],{"class":363},[306,1479,373],{"class":335},[306,1481,376],{"class":352},[306,1483,456],{"class":356},[306,1485,360],{"class":335},[306,1487,291],{"class":349},[306,1489,353],{"class":352},[306,1491,392],{"class":356},[306,1493,1494],{"class":335},"($",[306,1496,1399],{"class":723},[306,1498,1499],{"class":335},")),\n",[306,1501,1502],{"class":308,"line":477},[306,1503,1504],{"class":335},"        )\n",[306,1506,1507,1509,1511,1513,1515,1517,1519],{"class":308,"line":29},[306,1508,1455],{"class":352},[306,1510,1022],{"class":356},[306,1512,360],{"class":335},[306,1514,364],{"class":363},[306,1516,1475],{"class":367},[306,1518,364],{"class":363},[306,1520,404],{"class":335},[306,1522,1523],{"class":308,"line":648},[306,1524,480],{"class":335},[306,1526,1527],{"class":308,"line":654},[306,1528,343],{"emptyLinePlaceholder":342},[306,1530,1531,1533,1536,1538,1541,1543,1546,1548,1550,1553],{"class":308,"line":660},[306,1532,720],{"class":335},[306,1534,1535],{"class":723},"books ",[306,1537,727],{"class":352},[306,1539,1540],{"class":349}," Response",[306,1542,353],{"class":352},[306,1544,1545],{"class":356},"ok",[306,1547,417],{"class":335},[306,1549,376],{"class":352},[306,1551,1552],{"class":356},"content",[306,1554,381],{"class":335},[306,1556,1557,1560,1562,1564,1566,1568,1571,1573,1576,1578,1580,1583,1585],{"class":308,"line":666},[306,1558,1559],{"class":349},"    MediaType",[306,1561,353],{"class":352},[306,1563,487],{"class":356},[306,1565,417],{"class":335},[306,1567,376],{"class":352},[306,1569,1570],{"class":356},"schema",[306,1572,1494],{"class":335},[306,1574,1575],{"class":723},"paginated",[306,1577,360],{"class":335},[306,1579,364],{"class":363},[306,1581,1582],{"class":367},"Book",[306,1584,364],{"class":363},[306,1586,1499],{"class":335},[306,1588,1589],{"class":308,"line":897},[306,1590,480],{"class":335},[284,1592,1594],{"id":1593},"conditions-and-the-json-schema-core","Conditions and the JSON Schema core",[1596,1597,1598,1611],"table",{},[1599,1600,1601],"thead",{},[1602,1603,1604,1608],"tr",{},[1605,1606,1607],"th",{},"Method",[1605,1609,1610],{},"Keyword",[1612,1613,1614,1637,1649,1665,1678,1696,1720],"tbody",{},[1602,1615,1616,1634],{},[1617,1618,1619,1622,1623,1622,1626,1629,1630,1633],"td",{},[266,1620,1621],{},"allOf()",", ",[266,1624,1625],{},"anyOf()",[266,1627,1628],{},"oneOf()"," and their ",[266,1631,1632],{},"add"," methods",[1617,1635,1636],{},"composition",[1602,1638,1639,1644],{},[1617,1640,1641],{},[266,1642,1643],{},"not(SchemaContract|bool|null)",[1617,1645,1646],{},[266,1647,1648],{},"not",[1602,1650,1651,1662],{},[1617,1652,1653,1622,1656,1622,1659],{},[266,1654,1655],{},"if()",[266,1657,1658],{},"then()",[266,1660,1661],{},"else()",[1617,1663,1664],{},"conditional schemas",[1602,1666,1667,1672],{},[1617,1668,1669],{},[266,1670,1671],{},"defs(SchemaContract ...)",[1617,1673,1674,1677],{},[266,1675,1676],{},"$defs",", keyed by objectId",[1602,1679,1680,1688],{},[1617,1681,1682,1622,1685],{},[266,1683,1684],{},"schema(?string)",[266,1686,1687],{},"id(?string)",[1617,1689,1690,1622,1693],{},[266,1691,1692],{},"$schema",[266,1694,1695],{},"$id",[1602,1697,1698,1709],{},[1617,1699,1700,1622,1703,1622,1706],{},[266,1701,1702],{},"anchor(?string)",[266,1704,1705],{},"dynamicAnchor(?string)",[266,1707,1708],{},"dynamicRef(?string)",[1617,1710,1711,1622,1714,1622,1717],{},[266,1712,1713],{},"$anchor",[266,1715,1716],{},"$dynamicAnchor",[266,1718,1719],{},"$dynamicRef",[1602,1721,1722,1727],{},[1617,1723,1724],{},[266,1725,1726],{},"contentSchema(?SchemaContract)",[1617,1728,1729],{},"schema of an encoded string's content",[262,1731,1732,1622,1734,1622,1736,273,1738,1740,1741,1744,1745,1315],{},[266,1733,268],{},[266,1735,276],{},[266,1737,272],{},[266,1739,1648],{}," exist in every version. The others exist from OpenAPI 3.1: written for 3.0,\nthey throw an ",[266,1742,1743],{},"UnsupportedFeatureException"," in strict mode, or are dropped in lenient mode. See\n",[279,1746,201],{"href":202},[1748,1749,1750],"style",{},"html pre.shiki code .sw1J6, html code.shiki .sw1J6{--shiki-light:#F76D47;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .s39Yj, html code.shiki .s39Yj{--shiki-light:#39ADB5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sseR_, html code.shiki .sseR_{--shiki-light:#9C3EDA;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .swQdS, html code.shiki .swQdS{--shiki-light:#E53935;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sAQsV, html code.shiki .sAQsV{--shiki-light:#916B53;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}",{"title":296,"searchDepth":346,"depth":346,"links":1752},[1753,1754,1755,1756,1757],{"id":286,"depth":339,"text":287},{"id":672,"depth":339,"text":673},{"id":1178,"depth":339,"text":1179},{"id":1318,"depth":339,"text":1319},{"id":1593,"depth":339,"text":1594},"Combine schemas with allOf, oneOf and anyOf, add a discriminator, and use generic envelopes.","md",{},"---\ntitle: Composition and polymorphism\ndescription: Combine schemas with allOf, oneOf and anyOf, add a discriminator, and use generic envelopes.\n---\n\nComposition builds a schema from others: `allOf` extends, `oneOf` and `anyOf` choose. Combined with\n[references](\u002Fopenapi-writer\u002Fbuilding-documents\u002Fcomponents-and-references), it keeps each shape declared once.\n\n## Extending a schema\n\n::example{input=\"Schema\" output=\"components.schemas.Admin\"}\n#input\n```php\nuse Ark4ne\\OpenApiWriter\\Objects\\Schema;\n\nSchema::create('Admin')->allOf(\n    Schema::ref('User'),\n    Schema::object()->properties(\n        Schema::array('permissions')\n            ->items(Schema::string()),\n    ),\n);\n```\n#output\n```json\n{\n  \"allOf\": [\n    { \"$ref\": \"#\u002Fcomponents\u002Fschemas\u002FUser\" },\n    {\n      \"type\": \"object\",\n      \"properties\": {\n        \"permissions\": {\n          \"type\": \"array\",\n          \"items\": { \"type\": \"string\" }\n        }\n      }\n    }\n  ]\n}\n```\n::\n\n## Polymorphism with a discriminator\n\n`oneOf` lists the variants; the `Discriminator` names the property that tells them apart, and `mapping()` maps its\nvalues to schema names or references.\n\n```php\nuse Ark4ne\\OpenApiWriter\\Objects\\Discriminator;\n\n$payment = Schema::create('Payment')\n    ->oneOf(\n        Schema::ref('CardPayment'),\n        Schema::ref('TransferPayment'),\n    )\n    ->discriminator(\n        Discriminator::create()\n            ->propertyName('method')\n            ->mapping([\n                'card' => '#\u002Fcomponents\u002Fschemas\u002FCardPayment',\n                'transfer' => '#\u002Fcomponents\u002Fschemas\u002FTransferPayment',\n            ]),\n    );\n\n$card = Schema::object('CardPayment')\n    ->properties(\n        Schema::string('method')->const('card'),\n        Schema::string('last4')->pattern('^[0-9]{4}$'),\n    )\n    ->required('method', 'last4');\n\n$transfer = Schema::object('TransferPayment')\n    ->properties(\n        Schema::string('method')->const('transfer'),\n        Schema::string('iban'),\n    )\n    ->required('method', 'iban');\n```\n\nEach variant declares the discriminator property. The validator checks that every mapping resolves\n(`LocalReferencesRule`). `Discriminator::defaultMapping()` exists from OpenAPI 3.2.\n\n## A nullable reference\n\n`nullable()` on a reference writes an `anyOf` with the `null` type:\n\n::example{input=\"Schema\" output=\"3.1.2\"}\n#input\n```php\nSchema::ref('User', 'owner')->nullable();\n```\n#output\n```json\n{\n  \"anyOf\": [\n    { \"$ref\": \"#\u002Fcomponents\u002Fschemas\u002FUser\" },\n    { \"type\": \"null\" }\n  ]\n}\n```\n::\n\nFor 3.0, the second branch is `{\"enum\": [null], \"type\": \"object\", \"nullable\": true}`.\n\n## A generic envelope\n\nA closure returning a schema gives a reusable envelope, here a page of items:\n\n```php\nuse Ark4ne\\OpenApiWriter\\Objects\\MediaType;\nuse Ark4ne\\OpenApiWriter\\Objects\\Response;\n\n$paginated = static fn(string $item): Schema => Schema::create()->allOf(\n    Schema::ref('Page'),\n    Schema::object()\n        ->properties(\n            Schema::array('data')->items(Schema::ref($item)),\n        )\n        ->required('data'),\n);\n\n$books = Response::ok()->content(\n    MediaType::json()->schema($paginated('Book')),\n);\n```\n\n## Conditions and the JSON Schema core\n\n| Method | Keyword |\n| --- | --- |\n| `allOf()`, `anyOf()`, `oneOf()` and their `add` methods | composition |\n| `not(SchemaContract\\|bool\\|null)` | `not` |\n| `if()`, `then()`, `else()` | conditional schemas |\n| `defs(SchemaContract ...)` | `$defs`, keyed by objectId |\n| `schema(?string)`, `id(?string)` | `$schema`, `$id` |\n| `anchor(?string)`, `dynamicAnchor(?string)`, `dynamicRef(?string)` | `$anchor`, `$dynamicAnchor`, `$dynamicRef` |\n| `contentSchema(?SchemaContract)` | schema of an encoded string's content |\n\n`allOf`, `anyOf`, `oneOf` and `not` exist in every version. The others exist from OpenAPI 3.1: written for 3.0,\nthey throw an `UnsupportedFeatureException` in strict mode, or are dropped in lenient mode. See\n[Strict and lenient](\u002Fopenapi-writer\u002Fversions-and-output\u002Fstrict-and-lenient).\n",{"title":179,"description":1758},"mvI_A_pHTxzs53i4JQfC6jNmp1dhcxeZ7mLfR49h920",[1765,1767],{"title":175,"path":176,"stem":177,"description":1766,"children":-1},"Describe values with Schema - types, nullable, formats, constraints, objects, arrays and metadata.",{"title":189,"path":190,"stem":191,"description":1768,"children":-1},"Write any object as JSON, YAML or a PHP array, and save it to a file.",1795438901019]